From patchwork Sat Jul 16 17:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2181 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3D55E440EE for ; Sat, 16 Jul 2022 19:00:15 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id o13-20020a056402438d00b0043aa846b2d2sf5392051edc.8 for ; Sat, 16 Jul 2022 10:00:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657990815; cv=pass; d=google.com; s=arc-20160816; b=MVmoXwlOZjFlLzjL0YeCAT9X7+DKtk4u3lJrUb8hcYMhav9WP6mqYDItBder52TVe7 MK6zUeJmiX7D8A8JEHZMcijQ/w2duOcEeLU7hj1QsHK7A4WSS7+8KdByET9i+xJ2R11R DdhULu2veDHRdRxJ8i5+F5vU2Pb+3AavAhr/tq3YRRULGsFcUarIhqkJZuJA3dfcI6IM nMG36rjUVrCOzJwrp+5kGFBCzJ4l2FBrmpymeKxreKYMbDkoLsBDg9PN8TxIldwCoVG5 8V7oTdOUFWmRzl8pvegPtzAlipyixgS7q1Rs7XSespPDUfNd2WV9sTgpkUCTmcQHHaM5 uJOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=XEVOel6YdiDZm+3M30kwhvzv2QHaO751G45LDXyhpzY=; b=dBOT60Anbi9OR6SiFr1NnD49Hj4pPE2RTVb4nCT2k2i+B7REWObII2s+5StzZMdJuN pferqNK5Z+aybK0aBDMYNkKoljVODOJRnXNR9509fF4hY0o7p6gRrev2Ljq3E9ORWgGA bgpNzbQmgZhCPIHrJUex6aeRIgencyZdz6GjOcZXiGRvVgVHmZEYYYAiTbPr/rxQTdcX KMFyWzjU3sS4M5Jxy8x58gARGxtx728hJDbyEP1kt5RMLH4GsrZUL5vFjkJuQUZhA+ol a4TgHflo7p797fvZVT7y+9mxQs8gsG4cGMJs6516pt08S5hEqXEtBEV7bBNtkzKN1WTS Q00w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X6UeE44p; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=XEVOel6YdiDZm+3M30kwhvzv2QHaO751G45LDXyhpzY=; b=cLlveLYAR8+0pU39LnFN4GE/dPQhaMcaBpOmMaYO1hniEU9E93u26NQ9tfLzoAjhEl Oi3zIudZ25zXT6v/ADga6TvPkz8N6wRApj0xieyEVvSPbIKMfHoVTAKRNWfriSIgJo6y lLzqJlKHDOpCEIN7p4MZ6wSKPpY+22hq1cH/c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=XEVOel6YdiDZm+3M30kwhvzv2QHaO751G45LDXyhpzY=; b=2VJsOpFqyx/SJT0y1409NYJ/mFOz1sECf//1aWVVmDgjPf6Kl4dMSFAD6Zn9/dx3AQ 3gV+Vq4IEskMsXdtr5AJtorddMt5rwiA48+4pdf4cstJPzMsgKqVa3aV4hOlSviv1iu9 BoBvWzkrbi9rm7gXeQRcn0nA1+2/xP+GOcWZKOD3dNMBjtticXSaiCyOiO09LiVwLavx Q08MTQJrQoCAQzdJjNL8GHWJYIb9bSUQaFQavTvSH19GBd4+r8eXZWHcr3WXOgaGQH+3 gtJsPKnv6apXzQt7h8VBIPeGea9rbdtkgLVrsrokBwLS2wbvWuLTullc36pXsma9XEJM pYkg== X-Gm-Message-State: AJIora/t1RGGjAIykFAzbvVekeB4zdAjbo8sZ6vcCQXRzCygBy0suIrK MmZAa//ikCH8lLA0KhMVKAYHhsbD X-Google-Smtp-Source: AGRyM1sjUw4Nehf/zKqu3sqxcWkZRUyzmW3bT72Fps3fOwtoN3yR0WxAPWP/c0fZd/81DtlwVlDZzg== X-Received: by 2002:a17:907:6d86:b0:72b:5ad6:6df1 with SMTP id sb6-20020a1709076d8600b0072b5ad66df1mr19919878ejc.264.1657990814904; Sat, 16 Jul 2022 10:00:14 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42d1:b0:425:ff69:1a2d with SMTP id i17-20020a05640242d100b00425ff691a2dls8055edc.1.-pod-prod-gmail; Sat, 16 Jul 2022 10:00:14 -0700 (PDT) X-Received: by 2002:a05:6402:c47:b0:437:ce2d:c30d with SMTP id cs7-20020a0564020c4700b00437ce2dc30dmr26287166edb.395.1657990813740; Sat, 16 Jul 2022 10:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990813; cv=none; d=google.com; s=arc-20160816; b=G4D/izIl+lfW/vPDiFTIltG2RcJuPSMJjfAOVegoqKjTPFQZgUlEuVQYl/99ZiJOIt C+ixuphYHCxukAtdxLUPUEh/zlweCUB9khIFeTumvavIjZHVu28PZ57j68ff8dYwDcRk FGv4epl7eVZlCBmGyTdwwkwSrAxLeYyuhCjV8MFOrJ7LOfIfzXL0K084VQJ51KxK3Ey5 m9vjUDuL6Wtik7QFEgKLt6Dm+1WQ15T+oXO6vBJec99bxsIgpMYbrDfKutkw1nXrL5ur NrDkV1+A4ELDnE70iI1CMjzX9tApQB1SkeA2iOgF/oTMeQ1E+XxrBe94Rrsz0bBwyphd PCxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Yd81WywVreUCPKtVR38dM58arAjDVuFKjNWVnevwfZU=; b=oHS1eqqxiBB4I84Ni5Kd1I2krjcSUpV7DNsBmihfsfgZSjFz/eq8QHJLZHDQzDicbC bzAREtH4h2af6Dx1p9qxECH3HzB694uuzm19NZtYqpjjma6uhZXccjp9ilStGMbd75z0 seSmom0RmoNTuboW6u1rif/dS33iaiND3n8neOrOVYc8yYePCioP0p4QJswslDQn5+pe 0D8h8k5BEjOhZL12lj65PAvVVy11QLg6MyFN2b+z+vWYIMz6ndrURGKhWR/dUfTRzBVy qIaEZSobhE3p5L6iO9aVYVbU5m8qxjzpjr5B+507dxwgSddZbeE8g+GkODf6gxuVAqKC LoFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X6UeE44p; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id du7-20020a056402226700b0043a991ee7b5sor3607886edb.40.2022.07.16.10.00.13 for (Google Transport Security); Sat, 16 Jul 2022 10:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:aa7:d64b:0:b0:43b:1f5d:1443 with SMTP id v11-20020aa7d64b000000b0043b1f5d1443mr19322822edr.370.1657990813572; Sat, 16 Jul 2022 10:00:13 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-182-13-224.pool80182.interbusiness.it. [80.182.13.224]) by smtp.gmail.com with ESMTPSA id g3-20020a170906538300b0072b14836087sm3363135ejo.103.2022.07.16.10.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 10:00:13 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Dario Binacchi , "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 1/5] can: slcan: remove useless header inclusions Date: Sat, 16 Jul 2022 19:00:03 +0200 Message-Id: <20220716170007.2020037-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> References: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=X6UeE44p; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Include only the necessary headers. Signed-off-by: Dario Binacchi --- drivers/net/can/slcan/slcan-core.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index dfd1baba4130..3394d059fc29 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -36,26 +36,8 @@ */ #include -#include - -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include "slcan.h" From patchwork Sat Jul 16 17:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2182 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C0D2B3F046 for ; Sat, 16 Jul 2022 19:00:16 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id s17-20020a056402521100b0043ade613038sf5413449edd.17 for ; Sat, 16 Jul 2022 10:00:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657990816; cv=pass; d=google.com; s=arc-20160816; b=lNiEQr+VlHOyF2KYKjkmvgzuvtup2cz6d8MZBzurP4wqW/m7MFTn6XmJ1JB6jPpR7Y /M+uHrban4DllTAn0rzKRW02nNvTxCEAQlMa0bNi4fINNopieubQqWGCW6XNN6rrbtTP ixsQ2ph4ckWV0Cp/qrlExPq/recCzyv9AMAPHJWBdoDFx1RJfayl5izLtjYOw4G+hAYq x3gwGvo6DDKW9/eQIm6BfQL0iFBlv8pI4f9B8o5BP4ebDhCT/uShTYo3ITn4xKeLCTg4 Yvws9DEbnSeA4wOK7b1AU6GQ/zE+l24S4vlLp9hwvB2rCNVVLrq/vKsaU4kh3k2sJEA3 ps8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=tlvb7B1ma1wehm0an+Za9Utt0XTSbyPGlgNlkvezPGc=; b=PM1ML8ol01O0Cy57sU4m9uWOWfZ+B5Pp8HxMrm/9ws4uSUyDxP20SEw3cJ7ZebNZPP PoZGsSAvrx4TsGYhPYg0ntT0QTJc7fjcXPfB9ecHevnO+sEV1wUjTmj3s78EcFyCXQ6i kI5ec4+Zs3Kby1dfhoQGkOZNTfpgAFyyoPGS++7t2BjFaeg0fsuORiJrI2gK4ecEXd7h 2rLo5RIq1UlD1B6KihqBc002UeYKVVQJEVtgnbGHMay9ICK0CuHNitSRAipUDH6NEmOf ELiUgJ/hnVzSrWwjo72M3Jfzu14wWKPcnxFUkgKp5jc/VlyUP0YE0k4TDQlxY0cEDLJ5 BRzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=moSSrdV0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=tlvb7B1ma1wehm0an+Za9Utt0XTSbyPGlgNlkvezPGc=; b=Ws4UjyKvLGpHzxdOZEiwxMyKlsDERCHetQBnR9Rw2fw18JQik3f88i3BRNqcgNnF4+ E++zCG2RwxmHx9PpLkcWWmtIts/hp2f1Mv53L7DcEUQnRXfyOl3HSO/OdPa1Kzp0niS4 wGtCW+WFRs/xxFGuMbx1aKHA3gdBm5Wh8LHRk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=tlvb7B1ma1wehm0an+Za9Utt0XTSbyPGlgNlkvezPGc=; b=nU4KzMflNMcsVzUywxh1TSBaU/3reOsHPKfomT4XthvwJyocuWu1n5e8YPlFjZxMx9 vtRJbdU+yyyfc2yoW49Xjy50PIi+2+Int9/zqflt3rw87cHWs4KPzigtHyprBFoP4n1N FnmeX8FxPMsk1gSEtE3qF6Wf7O9yOqpKUQ55uo+kISr1tKwuxvA+TlXkEJKxuEFqqvVs KB/+eNl2EZKUyHYnqOCBvIWtzddJQt4LvTu/ircTE6z9BqRj8oQ40MCKzflXkFcduRv8 vt6YhgEAN/pBzgYmBn9GQL632MCEvc4pART07oDl49USEawTbLHYY5tINNeGbOJH2VyN scMQ== X-Gm-Message-State: AJIora9QSCuYMZaY6EVHUbOM8jMR6mszOmpk2Hv35AvGsB4P5kX8d4qO 3odbOSs3G4JO5OmHHoobpAwP2RDV X-Google-Smtp-Source: AGRyM1vroQMwvPxx0nYM/ihseQMvGq1bHpkCLzbAigdhUEbjyBiyFl/aCIasEu/oboq1dggQ1C8laA== X-Received: by 2002:a05:6402:1bda:b0:43a:55d7:9f2f with SMTP id ch26-20020a0564021bda00b0043a55d79f2fmr26148496edb.360.1657990816420; Sat, 16 Jul 2022 10:00:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:7811:b0:726:abf9:5f2e with SMTP id u17-20020a170906781100b00726abf95f2els281619ejm.9.-pod-prod-gmail; Sat, 16 Jul 2022 10:00:15 -0700 (PDT) X-Received: by 2002:a17:906:53ca:b0:6fe:ae32:e01e with SMTP id p10-20020a17090653ca00b006feae32e01emr18727904ejo.455.1657990815238; Sat, 16 Jul 2022 10:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990815; cv=none; d=google.com; s=arc-20160816; b=yBRVMOC2sAtN6Fr0yfc26LVFboTtrFLRbSq8osAUeh5BArjnFGhP2XfNzy3w90juRK GcTCLDTmRGRodZnG6kmzCAhmCf/sjG7zLocjf74JaXTadk4BPhA3kOuH/rfVNoUinFLA gYiyUUeo6vpNBSHmaufJTa7JERbulkez2QR+GdU4UomWVsBUQqCKBw+vgB0OPwtRK8he fgpBHdXWuSZasGph681JZZcfiQpQDz5JAnm2y/n2XOYTTRLFiXxbQoko/OARODkBGDyy KmOmcNYsqugf94ZChJJYRCi4+/UrwmLKTW6+d5CGKDChqbBKAAKL85amrBYrxbPmyP1N 6GBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=biW2/TBvVZbDTc4kZkNCdTYmUGENKmSrBkE0NXKYE9o=; b=cIdCklDS1K1djDnQs6r9JjE9Gh4w1GFeWAToDeZm4/xsbEtsEMrkNbZADz+W0uOQr1 sHVxA6wRV7cBRmP9rqIkgnCOx5eij1hkY9Xudbj8l7COhWQ2Vq8RoVGP/h/vKtdwPoRa KD8lmidaP7OajfAU+9AYyLxN0AayZHvg2md3G/UNuxjLMRTfwdJgRnjfc/96RdZI0nZ2 4W55wPdpBU1YfAJE8BQKxcnzqSIeZGCHG16hex2mH0lnoZvwYyrGxLsYNbX7YYtsiBcR 7iJJ6CSsCg7xbxWCLOtu0wbVw58rPOnyosLR4Ytyglo/MM+Xh5wYOmODDQJ+y02nvLeQ tigg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=moSSrdV0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id f8-20020a50a6c8000000b0043a71774befsor3580323edc.4.2022.07.16.10.00.15 for (Google Transport Security); Sat, 16 Jul 2022 10:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:2483:b0:43b:3b1c:899 with SMTP id q3-20020a056402248300b0043b3b1c0899mr12436238eda.137.1657990814913; Sat, 16 Jul 2022 10:00:14 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-182-13-224.pool80182.interbusiness.it. [80.182.13.224]) by smtp.gmail.com with ESMTPSA id g3-20020a170906538300b0072b14836087sm3363135ejo.103.2022.07.16.10.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 10:00:14 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Dario Binacchi , Max Staudt , "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 2/5] can: slcan: remove legacy infrastructure Date: Sat, 16 Jul 2022 19:00:04 +0200 Message-Id: <20220716170007.2020037-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> References: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=moSSrdV0; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Taking inspiration from the drivers/net/can/can327.c driver and at the suggestion of its author Max Staudt, I removed legacy stuff like `SLCAN_MAGIC' and `slcan_devs' resulting in simplification of the code and its maintainability. The use of slcan_devs is derived from a very old kernel, since slip.c is about 30 years old, so today's kernel allows us to remove it. The .hangup() ldisc function, which only called the ldisc .close(), has been removed since the ldisc layer calls .close() in a good place anyway. The `maxdev' module parameter has also been removed. CC: Max Staudt Signed-off-by: Dario Binacchi --- drivers/net/can/slcan/slcan-core.c | 317 ++++++----------------------- 1 file changed, 64 insertions(+), 253 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 3394d059fc29..92cab093453d 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -1,11 +1,14 @@ /* * slcan.c - serial line CAN interface driver (using tty line discipline) * - * This file is derived from linux/drivers/net/slip/slip.c + * This file is derived from linux/drivers/net/slip/slip.c and got + * inspiration from linux/drivers/net/can/can327.c for the rework made + * on the line discipline code. * * slip.c Authors : Laurence Culhane * Fred N. van Kempen * slcan.c Author : Oliver Hartkopp + * can327.c Author : Max Staudt * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -46,15 +49,6 @@ MODULE_DESCRIPTION("serial line CAN interface"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Oliver Hartkopp "); -#define SLCAN_MAGIC 0x53CA - -static int maxdev = 10; /* MAX number of SLCAN channels; - * This can be overridden with - * insmod slcan.ko maxdev=nnn - */ -module_param(maxdev, int, 0); -MODULE_PARM_DESC(maxdev, "Maximum number of slcan interfaces"); - /* maximum rx buffer len: extended CAN frame with timestamp */ #define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r") + 1) @@ -68,7 +62,6 @@ MODULE_PARM_DESC(maxdev, "Maximum number of slcan interfaces"); SLC_STATE_BE_TXCNT_LEN) struct slcan { struct can_priv can; - int magic; /* Various fields. */ struct tty_struct *tty; /* ptr to TTY structure */ @@ -84,17 +77,14 @@ struct slcan { int xleft; /* bytes left in XMIT queue */ unsigned long flags; /* Flag values/ mode etc */ -#define SLF_INUSE 0 /* Channel in use */ -#define SLF_ERROR 1 /* Parity, etc. error */ -#define SLF_XCMD 2 /* Command transmission */ +#define SLF_ERROR 0 /* Parity, etc. error */ +#define SLF_XCMD 1 /* Command transmission */ unsigned long cmd_flags; /* Command flags */ #define CF_ERR_RST 0 /* Reset errors on open */ wait_queue_head_t xcmd_wait; /* Wait queue for commands */ /* transmission */ }; -static struct net_device **slcan_devs; - static const u32 slcan_bitrate_const[] = { 10000, 20000, 50000, 100000, 125000, 250000, 500000, 800000, 1000000 @@ -538,9 +528,8 @@ static void slcan_transmit(struct work_struct *work) spin_lock_bh(&sl->lock); /* First make sure we're connected. */ - if (!sl->tty || sl->magic != SLCAN_MAGIC || - (unlikely(!netif_running(sl->dev)) && - likely(!test_bit(SLF_XCMD, &sl->flags)))) { + if (unlikely(!netif_running(sl->dev)) && + likely(!test_bit(SLF_XCMD, &sl->flags))) { spin_unlock_bh(&sl->lock); return; } @@ -575,13 +564,9 @@ static void slcan_transmit(struct work_struct *work) */ static void slcan_write_wakeup(struct tty_struct *tty) { - struct slcan *sl; + struct slcan *sl = (struct slcan *)tty->disc_data; - rcu_read_lock(); - sl = rcu_dereference(tty->disc_data); - if (sl) - schedule_work(&sl->tx_work); - rcu_read_unlock(); + schedule_work(&sl->tx_work); } /* Send a can_frame to a TTY queue. */ @@ -652,25 +637,21 @@ static int slc_close(struct net_device *dev) struct slcan *sl = netdev_priv(dev); int err; - spin_lock_bh(&sl->lock); - if (sl->tty) { - if (sl->can.bittiming.bitrate && - sl->can.bittiming.bitrate != CAN_BITRATE_UNKNOWN) { - spin_unlock_bh(&sl->lock); - err = slcan_transmit_cmd(sl, "C\r"); - spin_lock_bh(&sl->lock); - if (err) - netdev_warn(dev, - "failed to send close command 'C\\r'\n"); - } - - /* TTY discipline is running. */ - clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); + if (sl->can.bittiming.bitrate && + sl->can.bittiming.bitrate != CAN_BITRATE_UNKNOWN) { + err = slcan_transmit_cmd(sl, "C\r"); + if (err) + netdev_warn(dev, + "failed to send close command 'C\\r'\n"); } + + /* TTY discipline is running. */ + clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); + flush_work(&sl->tx_work); + netif_stop_queue(dev); sl->rcount = 0; sl->xleft = 0; - spin_unlock_bh(&sl->lock); close_candev(dev); sl->can.state = CAN_STATE_STOPPED; if (sl->can.bittiming.bitrate == CAN_BITRATE_UNKNOWN) @@ -686,9 +667,6 @@ static int slc_open(struct net_device *dev) unsigned char cmd[SLC_MTU]; int err, s; - if (!sl->tty) - return -ENODEV; - /* The baud rate is not set with the command * `ip link set type can bitrate ' and therefore * can.bittiming.bitrate is CAN_BITRATE_UNSET (0), causing @@ -703,8 +681,6 @@ static int slc_open(struct net_device *dev) return err; } - sl->flags &= BIT(SLF_INUSE); - if (sl->can.bittiming.bitrate != CAN_BITRATE_UNKNOWN) { for (s = 0; s < ARRAY_SIZE(slcan_bitrate_const); s++) { if (sl->can.bittiming.bitrate == slcan_bitrate_const[s]) @@ -748,14 +724,6 @@ static int slc_open(struct net_device *dev) return err; } -static void slc_dealloc(struct slcan *sl) -{ - int i = sl->dev->base_addr; - - free_candev(sl->dev); - slcan_devs[i] = NULL; -} - static int slcan_change_mtu(struct net_device *dev, int new_mtu) { return -EINVAL; @@ -785,7 +753,7 @@ static void slcan_receive_buf(struct tty_struct *tty, { struct slcan *sl = (struct slcan *)tty->disc_data; - if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) + if (!netif_running(sl->dev)) return; /* Read the characters out of the buffer */ @@ -800,80 +768,15 @@ static void slcan_receive_buf(struct tty_struct *tty, } } -/************************************ - * slcan_open helper routines. - ************************************/ - -/* Collect hanged up channels */ -static void slc_sync(void) -{ - int i; - struct net_device *dev; - struct slcan *sl; - - for (i = 0; i < maxdev; i++) { - dev = slcan_devs[i]; - if (!dev) - break; - - sl = netdev_priv(dev); - if (sl->tty) - continue; - if (dev->flags & IFF_UP) - dev_close(dev); - } -} - -/* Find a free SLCAN channel, and link in this `tty' line. */ -static struct slcan *slc_alloc(void) -{ - int i; - struct net_device *dev = NULL; - struct slcan *sl; - - for (i = 0; i < maxdev; i++) { - dev = slcan_devs[i]; - if (!dev) - break; - } - - /* Sorry, too many, all slots in use */ - if (i >= maxdev) - return NULL; - - dev = alloc_candev(sizeof(*sl), 1); - if (!dev) - return NULL; - - snprintf(dev->name, sizeof(dev->name), "slcan%d", i); - dev->netdev_ops = &slc_netdev_ops; - dev->base_addr = i; - slcan_set_ethtool_ops(dev); - sl = netdev_priv(dev); - - /* Initialize channel control data */ - sl->magic = SLCAN_MAGIC; - sl->dev = dev; - sl->can.bitrate_const = slcan_bitrate_const; - sl->can.bitrate_const_cnt = ARRAY_SIZE(slcan_bitrate_const); - spin_lock_init(&sl->lock); - INIT_WORK(&sl->tx_work, slcan_transmit); - init_waitqueue_head(&sl->xcmd_wait); - slcan_devs[i] = dev; - - return sl; -} - /* Open the high-level part of the SLCAN channel. * This function is called by the TTY module when the - * SLCAN line discipline is called for. Because we are - * sure the tty line exists, we only have to link it to - * a free SLCAN channel... + * SLCAN line discipline is called for. * * Called in process context serialized from other ldisc calls. */ static int slcan_open(struct tty_struct *tty) { + struct net_device *dev; struct slcan *sl; int err; @@ -883,72 +786,50 @@ static int slcan_open(struct tty_struct *tty) if (!tty->ops->write) return -EOPNOTSUPP; - /* RTnetlink lock is misused here to serialize concurrent - * opens of slcan channels. There are better ways, but it is - * the simplest one. - */ - rtnl_lock(); + dev = alloc_candev(sizeof(*sl), 1); + if (!dev) + return -ENFILE; - /* Collect hanged up channels. */ - slc_sync(); + sl = netdev_priv(dev); - sl = tty->disc_data; + /* Configure TTY interface */ + tty->receive_room = 65536; /* We don't flow control */ + sl->rcount = 0; + sl->xleft = 0; + spin_lock_init(&sl->lock); + INIT_WORK(&sl->tx_work, slcan_transmit); + init_waitqueue_head(&sl->xcmd_wait); - err = -EEXIST; - /* First make sure we're not already connected. */ - if (sl && sl->magic == SLCAN_MAGIC) - goto err_exit; + /* Configure CAN metadata */ + sl->can.bitrate_const = slcan_bitrate_const; + sl->can.bitrate_const_cnt = ARRAY_SIZE(slcan_bitrate_const); - /* OK. Find a free SLCAN channel to use. */ - err = -ENFILE; - sl = slc_alloc(); - if (!sl) - goto err_exit; + /* Configure netdev interface */ + sl->dev = dev; + strscpy(dev->name, "slcan%d", sizeof(dev->name)); + dev->netdev_ops = &slc_netdev_ops; + slcan_set_ethtool_ops(dev); + /* Mark ldisc channel as alive */ sl->tty = tty; tty->disc_data = sl; - if (!test_bit(SLF_INUSE, &sl->flags)) { - /* Perform the low-level SLCAN initialization. */ - sl->rcount = 0; - sl->xleft = 0; - - set_bit(SLF_INUSE, &sl->flags); - - rtnl_unlock(); - err = register_candev(sl->dev); - if (err) { - pr_err("slcan: can't register candev\n"); - goto err_free_chan; - } - } else { - rtnl_unlock(); + err = register_candev(dev); + if (err) { + free_candev(dev); + pr_err("slcan: can't register candev\n"); + return err; } - tty->receive_room = 65536; /* We don't flow control */ - + netdev_info(dev, "slcan on %s.\n", tty->name); /* TTY layer expects 0 on success */ return 0; - -err_free_chan: - rtnl_lock(); - sl->tty = NULL; - tty->disc_data = NULL; - clear_bit(SLF_INUSE, &sl->flags); - slc_dealloc(sl); - rtnl_unlock(); - return err; - -err_exit: - rtnl_unlock(); - - /* Count references from TTY module */ - return err; } /* Close down a SLCAN channel. * This means flushing out any pending queues, and then returning. This * call is serialized against other ldisc functions. + * Once this is called, no other ldisc function of ours is entered. * * We also use this method for a hangup event. */ @@ -956,28 +837,20 @@ static void slcan_close(struct tty_struct *tty) { struct slcan *sl = (struct slcan *)tty->disc_data; - /* First make sure we're connected. */ - if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) - return; + /* unregister_netdev() calls .ndo_stop() so we don't have to. + * Our .ndo_stop() also flushes the TTY write wakeup handler, + * so we can safely set sl->tty = NULL after this. + */ + unregister_candev(sl->dev); + /* Mark channel as dead */ spin_lock_bh(&sl->lock); - rcu_assign_pointer(tty->disc_data, NULL); + tty->disc_data = NULL; sl->tty = NULL; spin_unlock_bh(&sl->lock); - synchronize_rcu(); - flush_work(&sl->tx_work); - - slc_close(sl->dev); - unregister_candev(sl->dev); - rtnl_lock(); - slc_dealloc(sl); - rtnl_unlock(); -} - -static void slcan_hangup(struct tty_struct *tty) -{ - slcan_close(tty); + netdev_info(sl->dev, "slcan off %s.\n", tty->name); + free_candev(sl->dev); } /* Perform I/O control on an active SLCAN channel. */ @@ -987,10 +860,6 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd, struct slcan *sl = (struct slcan *)tty->disc_data; unsigned int tmp; - /* First make sure we're connected. */ - if (!sl || sl->magic != SLCAN_MAGIC) - return -EINVAL; - switch (cmd) { case SIOCGIFNAME: tmp = strlen(sl->dev->name) + 1; @@ -1012,7 +881,6 @@ static struct tty_ldisc_ops slc_ldisc = { .name = "slcan", .open = slcan_open, .close = slcan_close, - .hangup = slcan_hangup, .ioctl = slcan_ioctl, .receive_buf = slcan_receive_buf, .write_wakeup = slcan_write_wakeup, @@ -1022,78 +890,21 @@ static int __init slcan_init(void) { int status; - if (maxdev < 4) - maxdev = 4; /* Sanity */ - pr_info("slcan: serial line CAN interface driver\n"); - pr_info("slcan: %d dynamic interface channels.\n", maxdev); - - slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL); - if (!slcan_devs) - return -ENOMEM; /* Fill in our line protocol discipline, and register it */ status = tty_register_ldisc(&slc_ldisc); - if (status) { + if (status) pr_err("slcan: can't register line discipline\n"); - kfree(slcan_devs); - } + return status; } static void __exit slcan_exit(void) { - int i; - struct net_device *dev; - struct slcan *sl; - unsigned long timeout = jiffies + HZ; - int busy = 0; - - if (!slcan_devs) - return; - - /* First of all: check for active disciplines and hangup them. - */ - do { - if (busy) - msleep_interruptible(100); - - busy = 0; - for (i = 0; i < maxdev; i++) { - dev = slcan_devs[i]; - if (!dev) - continue; - sl = netdev_priv(dev); - spin_lock_bh(&sl->lock); - if (sl->tty) { - busy++; - tty_hangup(sl->tty); - } - spin_unlock_bh(&sl->lock); - } - } while (busy && time_before(jiffies, timeout)); - - /* FIXME: hangup is async so we should wait when doing this second - * phase + /* This will only be called when all channels have been closed by + * userspace - tty_ldisc.c takes care of the module's refcount. */ - - for (i = 0; i < maxdev; i++) { - dev = slcan_devs[i]; - if (!dev) - continue; - - sl = netdev_priv(dev); - if (sl->tty) - netdev_err(dev, "tty discipline still running\n"); - - slc_close(dev); - unregister_candev(dev); - slc_dealloc(sl); - } - - kfree(slcan_devs); - slcan_devs = NULL; - tty_unregister_ldisc(&slc_ldisc); } From patchwork Sat Jul 16 17:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2183 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DB9053F046 for ; Sat, 16 Jul 2022 19:00:17 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id v19-20020a056402349300b0043b0f690cbasf5434062edc.11 for ; Sat, 16 Jul 2022 10:00:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657990817; cv=pass; d=google.com; s=arc-20160816; b=P8OqtVct3TbKIhkH4oXbjsA28ci71dN6Zpg++tsXt+G1ZZJwr4BU5se0aM9xYnw0Sr lQw41ZsyLQpU6Oz7m59/ha9DomMWgafIW9oF6i2bwNHa/J7RT2bCTDnnSkXb3ziORxaY hp2D+rgdlY9PZ7xgKSVBJWqj1wCLaRTgx59T3Hq8UwdcoOlkLBBQK3rDfYczTMxGPYZP ys7bD4QbWjTh/PoyVgTy6WEDRPNfWKJz0ZUgSzrMUGHHC43eBx4laIqu8PJVTIDZ8rG6 1bt3V+SnKsLBshvYkvWmMoldF+bMr13PMPxG0w3pCouN/KDNRjT5RGmv3lEzs6KUIFvS U4aQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Fah+tAipIJqIO3YEc9LSlTpZbMTiuZTWdXrMXVjb9is=; b=qqoxIarzcBEjrjM8iqkYf1mw+F6RrmmHYD0knpvEDvSScMQKGSYaiKdHqhlwsZ/Xom Ph7TvVdf3s6vGPaHH91zjncY7Bhg+NoIyVYiYfMzvgT1GKyjzUjHck+Xq1iB66D8S+Qz P18+EN8u4us6WfDJQgQpVmPeFtV9mVT9o1mP1M6AsL0opVd4A+bS3Dzziyp2hOyYinkk nN/LUu2qJlmHL8EF0kRAkCBdPooof39yseWtm//A99pB8iwC1GiLOEU81k4aLeLhIRz+ rfMmka/UqBxcgMceLBO8enoj36IhuOfRBanGQKS9AORNrMF02sX8AvK1xrbmLPQsP560 ATBA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jJ5xawQR; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Fah+tAipIJqIO3YEc9LSlTpZbMTiuZTWdXrMXVjb9is=; b=YIMuRZipCHW2K+g6BNL80+Gn71+PJ12i3WvFLejYgbSvKxhvs1TePVM7nP5h7NFztO P779kI+4ecS1pCEzHvo4jnw3R2srLb8QMqrp4aHQ19eLkZOMRyVTBtqMDHm9DqS4QR7+ 5b+wCXRyB3Ku/0GHWekQpCuMQliTzaiIURMJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Fah+tAipIJqIO3YEc9LSlTpZbMTiuZTWdXrMXVjb9is=; b=CSKMp6cJa27W5go9VIO09gEobAJF5/xkkTBeYrjPSmn7IP3RFf+w1wmSh+Dg2IHcfg gA8P9Frw9G/Tc6c61S1liJMc7kZPDqqfb8YdUXaFsQXzL1lupkIBe6ZRsUrm7nMEEuAj nkvC9PMninmtrEZyluUZO8q2Qsh9IMfUU5+4DA87cMGhkzYbh8cPVJxdSb0qYufglkVE 9yPVEwxUJw8VVvl2ummmeMz3XpIVXMWeF9miKyrUU2MxQzAssk42DVE41QuLjjW1Wm69 LFx1c/hsnLfVAmrbSyd7cl6xug/1fuKf6qQHPYof8qpOgqnOihZRQkxpD/s7Hx0/uB32 ZzJw== X-Gm-Message-State: AJIora/dFSod6G1+O7pomrmFNF1XUzwFpONN1A4N1/Lln/LDT9slw7xt 74NEctngIbjqyYcvJoqzL7wpADwj X-Google-Smtp-Source: AGRyM1vFd/Kk8NjsMm5VdD0VeX/5srDccgxnserisIbyqCJedpSlkiVvqDwSm8TRJ7pq5f9XGEyf0w== X-Received: by 2002:a05:6402:5388:b0:435:71b:5d44 with SMTP id ew8-20020a056402538800b00435071b5d44mr25948126edb.364.1657990817710; Sat, 16 Jul 2022 10:00:17 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:c4c:b0:6fe:b664:4b5f with SMTP id t12-20020a1709060c4c00b006feb6644b5fls271421ejf.2.-pod-prod-gmail; Sat, 16 Jul 2022 10:00:16 -0700 (PDT) X-Received: by 2002:a17:906:9b09:b0:72b:9612:d373 with SMTP id eo9-20020a1709069b0900b0072b9612d373mr18192740ejc.606.1657990816574; Sat, 16 Jul 2022 10:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990816; cv=none; d=google.com; s=arc-20160816; b=ja6eSVP0wzRkvtmPARZAdzJVfnVPQV3z4lvkJwFnrMQMTP8IcZ4ug8uozYD9XJSJH+ Lcv7Yung5vWhbHYJZAkuAAhQ7PrmPh8jQ32gel9mlHj+Y+WuHUNzzJDYVuxi9dsPEYN+ DwsFHGmAFu+55hyMVsXr8MsTpAbComNFhLb/GiQa24h9q/ePEv6gPIj/oSubM9ABjmAn I7muPvmElE73VT6f9connjGiM68xfOSS66pUD4CHQiWGgWtIhJujIMBN8D/n4LCXiLkT 9iZrX2/whG7/5ELyxzbQCkOTw4zKsdpKwGCvAoYui09SqaErUUISXJTFd+lIiUhkJrpl hOKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kTz0/chNaRML/52RPmtYk4d+f1Bk9uxvtl5nVSXDbcQ=; b=APLhh3l+MdQUe1FNMf4IZhQNYRH2Z202xkkhn0miZPcVHf0gSfPPW5ivhW5Kqozi/C mgfNNPj864MLrR15XS1I/qGGosqCgQc2pvkKC0D24MwOSNMtrDrUXo0CHSEDt1FO2Ree 2NQ7XJ3ucxBihVnkcInWleBOkSu3nMS99Ix/3O7b8v5wJZnpZRSX1aCSyp3TzpIjYem4 Yb2AHi5MeGwunS3W5Usc/wuJK1Bp3dWBjA4YDsLASZBKuAWX5r4hcy724n4dW3EE3yVN r6wHi0AWtfh9xxKy/BKCh5rctDkG5av1L97CglhS/27Yb3+6Bsjs3+tD/eUCtxstooxy vpzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jJ5xawQR; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id f16-20020a50d550000000b004358cec9cd3sor3606147edj.68.2022.07.16.10.00.16 for (Google Transport Security); Sat, 16 Jul 2022 10:00:16 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:5513:b0:43a:b866:b9ab with SMTP id fi19-20020a056402551300b0043ab866b9abmr27086750edb.290.1657990816350; Sat, 16 Jul 2022 10:00:16 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-182-13-224.pool80182.interbusiness.it. [80.182.13.224]) by smtp.gmail.com with ESMTPSA id g3-20020a170906538300b0072b14836087sm3363135ejo.103.2022.07.16.10.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 10:00:15 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Dario Binacchi , "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 3/5] can: slcan: change every `slc' occurrence in `slcan' Date: Sat, 16 Jul 2022 19:00:05 +0200 Message-Id: <20220716170007.2020037-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> References: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jJ5xawQR; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In the driver there are parts of code where the prefix `slc' is used and others where the prefix `slcan' is used instead. The patch replaces every occurrence of `slc' with `slcan', except for the netdev functions where, to avoid compilation conflicts, it was necessary to replace `slc' with `slcan_netdev'. The patch does not make any functional changes. Signed-off-by: Dario Binacchi --- drivers/net/can/slcan/slcan-core.c | 109 +++++++++++++++-------------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 92cab093453d..093d232c13dd 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -50,16 +50,17 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Oliver Hartkopp "); /* maximum rx buffer len: extended CAN frame with timestamp */ -#define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r") + 1) - -#define SLC_CMD_LEN 1 -#define SLC_SFF_ID_LEN 3 -#define SLC_EFF_ID_LEN 8 -#define SLC_STATE_LEN 1 -#define SLC_STATE_BE_RXCNT_LEN 3 -#define SLC_STATE_BE_TXCNT_LEN 3 -#define SLC_STATE_FRAME_LEN (1 + SLC_CMD_LEN + SLC_STATE_BE_RXCNT_LEN + \ - SLC_STATE_BE_TXCNT_LEN) +#define SLCAN_MTU (sizeof("T1111222281122334455667788EA5F\r") + 1) + +#define SLCAN_CMD_LEN 1 +#define SLCAN_SFF_ID_LEN 3 +#define SLCAN_EFF_ID_LEN 8 +#define SLCAN_STATE_LEN 1 +#define SLCAN_STATE_BE_RXCNT_LEN 3 +#define SLCAN_STATE_BE_TXCNT_LEN 3 +#define SLCAN_STATE_FRAME_LEN (1 + SLCAN_CMD_LEN + \ + SLCAN_STATE_BE_RXCNT_LEN + \ + SLCAN_STATE_BE_TXCNT_LEN) struct slcan { struct can_priv can; @@ -70,9 +71,9 @@ struct slcan { struct work_struct tx_work; /* Flushes transmit buffer */ /* These are pointers to the malloc()ed frame buffers. */ - unsigned char rbuff[SLC_MTU]; /* receiver buffer */ + unsigned char rbuff[SLCAN_MTU]; /* receiver buffer */ int rcount; /* received chars counter */ - unsigned char xbuff[SLC_MTU]; /* transmitter buffer */ + unsigned char xbuff[SLCAN_MTU]; /* transmitter buffer*/ unsigned char *xhead; /* pointer to next XMIT byte */ int xleft; /* bytes left in XMIT queue */ @@ -151,7 +152,7 @@ int slcan_enable_err_rst_on_open(struct net_device *ndev, bool on) *************************************************************************/ /* Send one completely decapsulated can_frame to the network layer */ -static void slc_bump_frame(struct slcan *sl) +static void slcan_bump_frame(struct slcan *sl) { struct sk_buff *skb; struct can_frame *cf; @@ -171,10 +172,10 @@ static void slc_bump_frame(struct slcan *sl) fallthrough; case 't': /* store dlc ASCII value and terminate SFF CAN ID string */ - cf->len = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN]; - sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN] = 0; + cf->len = sl->rbuff[SLCAN_CMD_LEN + SLCAN_SFF_ID_LEN]; + sl->rbuff[SLCAN_CMD_LEN + SLCAN_SFF_ID_LEN] = 0; /* point to payload data behind the dlc */ - cmd += SLC_CMD_LEN + SLC_SFF_ID_LEN + 1; + cmd += SLCAN_CMD_LEN + SLCAN_SFF_ID_LEN + 1; break; case 'R': cf->can_id = CAN_RTR_FLAG; @@ -182,16 +183,16 @@ static void slc_bump_frame(struct slcan *sl) case 'T': cf->can_id |= CAN_EFF_FLAG; /* store dlc ASCII value and terminate EFF CAN ID string */ - cf->len = sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN]; - sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN] = 0; + cf->len = sl->rbuff[SLCAN_CMD_LEN + SLCAN_EFF_ID_LEN]; + sl->rbuff[SLCAN_CMD_LEN + SLCAN_EFF_ID_LEN] = 0; /* point to payload data behind the dlc */ - cmd += SLC_CMD_LEN + SLC_EFF_ID_LEN + 1; + cmd += SLCAN_CMD_LEN + SLCAN_EFF_ID_LEN + 1; break; default: goto decode_failed; } - if (kstrtou32(sl->rbuff + SLC_CMD_LEN, 16, &tmpid)) + if (kstrtou32(sl->rbuff + SLCAN_CMD_LEN, 16, &tmpid)) goto decode_failed; cf->can_id |= tmpid; @@ -238,7 +239,7 @@ static void slc_bump_frame(struct slcan *sl) * sb256256 : state bus-off: rx counter 256, tx counter 256 * sa057033 : state active, rx counter 57, tx counter 33 */ -static void slc_bump_state(struct slcan *sl) +static void slcan_bump_state(struct slcan *sl) { struct net_device *dev = sl->dev; struct sk_buff *skb; @@ -264,16 +265,16 @@ static void slc_bump_state(struct slcan *sl) return; } - if (state == sl->can.state || sl->rcount < SLC_STATE_FRAME_LEN) + if (state == sl->can.state || sl->rcount < SLCAN_STATE_FRAME_LEN) return; - cmd += SLC_STATE_BE_RXCNT_LEN + SLC_CMD_LEN + 1; - cmd[SLC_STATE_BE_TXCNT_LEN] = 0; + cmd += SLCAN_STATE_BE_RXCNT_LEN + SLCAN_CMD_LEN + 1; + cmd[SLCAN_STATE_BE_TXCNT_LEN] = 0; if (kstrtou32(cmd, 10, &txerr)) return; *cmd = 0; - cmd -= SLC_STATE_BE_RXCNT_LEN; + cmd -= SLCAN_STATE_BE_RXCNT_LEN; if (kstrtou32(cmd, 10, &rxerr)) return; @@ -301,7 +302,7 @@ static void slc_bump_state(struct slcan *sl) * e1a : len 1, errors: ACK error * e3bcO: len 3, errors: Bit0 error, CRC error, Tx overrun error */ -static void slc_bump_err(struct slcan *sl) +static void slcan_bump_err(struct slcan *sl) { struct net_device *dev = sl->dev; struct sk_buff *skb; @@ -317,7 +318,7 @@ static void slc_bump_err(struct slcan *sl) else return; - if ((len + SLC_CMD_LEN + 1) > sl->rcount) + if ((len + SLCAN_CMD_LEN + 1) > sl->rcount) return; skb = alloc_can_err_skb(dev, &cf); @@ -325,7 +326,7 @@ static void slc_bump_err(struct slcan *sl) if (skb) cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; - cmd += SLC_CMD_LEN + 1; + cmd += SLCAN_CMD_LEN + 1; for (i = 0; i < len; i++, cmd++) { switch (*cmd) { case 'a': @@ -414,7 +415,7 @@ static void slc_bump_err(struct slcan *sl) netif_rx(skb); } -static void slc_bump(struct slcan *sl) +static void slcan_bump(struct slcan *sl) { switch (sl->rbuff[0]) { case 'r': @@ -424,11 +425,11 @@ static void slc_bump(struct slcan *sl) case 'R': fallthrough; case 'T': - return slc_bump_frame(sl); + return slcan_bump_frame(sl); case 'e': - return slc_bump_err(sl); + return slcan_bump_err(sl); case 's': - return slc_bump_state(sl); + return slcan_bump_state(sl); default: return; } @@ -440,12 +441,12 @@ static void slcan_unesc(struct slcan *sl, unsigned char s) if ((s == '\r') || (s == '\a')) { /* CR or BEL ends the pdu */ if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && sl->rcount > 4) - slc_bump(sl); + slcan_bump(sl); sl->rcount = 0; } else { if (!test_bit(SLF_ERROR, &sl->flags)) { - if (sl->rcount < SLC_MTU) { + if (sl->rcount < SLCAN_MTU) { sl->rbuff[sl->rcount++] = s; return; } @@ -461,7 +462,7 @@ static void slcan_unesc(struct slcan *sl, unsigned char s) *************************************************************************/ /* Encapsulate one can_frame and stuff into a TTY queue. */ -static void slc_encaps(struct slcan *sl, struct can_frame *cf) +static void slcan_encaps(struct slcan *sl, struct can_frame *cf) { int actual, i; unsigned char *pos; @@ -478,11 +479,11 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) /* determine number of chars for the CAN-identifier */ if (cf->can_id & CAN_EFF_FLAG) { id &= CAN_EFF_MASK; - endpos = pos + SLC_EFF_ID_LEN; + endpos = pos + SLCAN_EFF_ID_LEN; } else { *pos |= 0x20; /* convert R/T to lower case for SFF */ id &= CAN_SFF_MASK; - endpos = pos + SLC_SFF_ID_LEN; + endpos = pos + SLCAN_SFF_ID_LEN; } /* build 3 (SFF) or 8 (EFF) digit CAN identifier */ @@ -492,7 +493,8 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) id >>= 4; } - pos += (cf->can_id & CAN_EFF_FLAG) ? SLC_EFF_ID_LEN : SLC_SFF_ID_LEN; + pos += (cf->can_id & CAN_EFF_FLAG) ? + SLCAN_EFF_ID_LEN : SLCAN_SFF_ID_LEN; *pos++ = cf->len + '0'; @@ -570,7 +572,8 @@ static void slcan_write_wakeup(struct tty_struct *tty) } /* Send a can_frame to a TTY queue. */ -static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t slcan_netdev_xmit(struct sk_buff *skb, + struct net_device *dev) { struct slcan *sl = netdev_priv(dev); @@ -589,7 +592,7 @@ static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) } netif_stop_queue(sl->dev); - slc_encaps(sl, (struct can_frame *)skb->data); /* encaps & send */ + slcan_encaps(sl, (struct can_frame *)skb->data); /* encaps & send */ spin_unlock(&sl->lock); out: @@ -632,7 +635,7 @@ static int slcan_transmit_cmd(struct slcan *sl, const unsigned char *cmd) } /* Netdevice UP -> DOWN routine */ -static int slc_close(struct net_device *dev) +static int slcan_netdev_close(struct net_device *dev) { struct slcan *sl = netdev_priv(dev); int err; @@ -661,10 +664,10 @@ static int slc_close(struct net_device *dev) } /* Netdevice DOWN -> UP routine */ -static int slc_open(struct net_device *dev) +static int slcan_netdev_open(struct net_device *dev) { struct slcan *sl = netdev_priv(dev); - unsigned char cmd[SLC_MTU]; + unsigned char cmd[SLCAN_MTU]; int err, s; /* The baud rate is not set with the command @@ -724,16 +727,16 @@ static int slc_open(struct net_device *dev) return err; } -static int slcan_change_mtu(struct net_device *dev, int new_mtu) +static int slcan_netdev_change_mtu(struct net_device *dev, int new_mtu) { return -EINVAL; } -static const struct net_device_ops slc_netdev_ops = { - .ndo_open = slc_open, - .ndo_stop = slc_close, - .ndo_start_xmit = slc_xmit, - .ndo_change_mtu = slcan_change_mtu, +static const struct net_device_ops slcan_netdev_ops = { + .ndo_open = slcan_netdev_open, + .ndo_stop = slcan_netdev_close, + .ndo_start_xmit = slcan_netdev_xmit, + .ndo_change_mtu = slcan_netdev_change_mtu, }; /****************************************** @@ -807,7 +810,7 @@ static int slcan_open(struct tty_struct *tty) /* Configure netdev interface */ sl->dev = dev; strscpy(dev->name, "slcan%d", sizeof(dev->name)); - dev->netdev_ops = &slc_netdev_ops; + dev->netdev_ops = &slcan_netdev_ops; slcan_set_ethtool_ops(dev); /* Mark ldisc channel as alive */ @@ -875,7 +878,7 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd, } } -static struct tty_ldisc_ops slc_ldisc = { +static struct tty_ldisc_ops slcan_ldisc = { .owner = THIS_MODULE, .num = N_SLCAN, .name = "slcan", @@ -893,7 +896,7 @@ static int __init slcan_init(void) pr_info("slcan: serial line CAN interface driver\n"); /* Fill in our line protocol discipline, and register it */ - status = tty_register_ldisc(&slc_ldisc); + status = tty_register_ldisc(&slcan_ldisc); if (status) pr_err("slcan: can't register line discipline\n"); @@ -905,7 +908,7 @@ static void __exit slcan_exit(void) /* This will only be called when all channels have been closed by * userspace - tty_ldisc.c takes care of the module's refcount. */ - tty_unregister_ldisc(&slc_ldisc); + tty_unregister_ldisc(&slcan_ldisc); } module_init(slcan_init); From patchwork Sat Jul 16 17:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2184 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4D8023F046 for ; Sat, 16 Jul 2022 19:00:19 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id s17-20020a056402521100b0043ade613038sf5413571edd.17 for ; Sat, 16 Jul 2022 10:00:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657990819; cv=pass; d=google.com; s=arc-20160816; b=tWnAQFK51Fy7otogddARf/JuSt59G7QJ+WsL21PWWyq3TsNA26i8hWf8dULZFz2XWy XKuIa9xzAPtZp2Kgm0PG/0N7EMPsy8kg3OyTuhzczNMKrSg0n7Rvc77QJ4VeaeR9UXbg 8ftbuljvay1z4VskbTW4sELG1/STaJlax2xVW/5pKwjaHYSoMTmG+HRrqDqo1tJI7jMn uRFjapRUWLxDExGenBZlVIVcS0py92N8hw2qLxmFPA8e55sCY/mkxOvb5nSCeB0gVWbl miV9/543DGzkiQll1pAoM8C0ozNdR3Z6TKW/eOl/Vg1KxYV9GtVD7INByW2yk4QggsxI U1EQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zFfEfnS/aKJzx5JFPouMms1a7V/eYWKEC0HqCoqSteI=; b=OLLD0aSUlxg52GvjBXM3jbd43sdMLteQ5OxynPx1KKxZ/HrazNtBRpL0ysttrfsSos QRwdBrsVim38PpQisPtrwaaylNiqPGOngb1SLw/VzxBtSWqSv47UWGQRb0pL+WEO/aBJ HRJXi4EpmlR32TsRmX3f+NUgetzvlOmjr+v4bGQdnW1umFuIsjTYC34GyDA+7d6l8ygY u42Qt9ZbcIqG++3a/EXoluDTAsmDyv5uuqRbi7YAAxpiRitFT7COFg9tHPD+i2Jx2bvL XQvGThOkWDCAGOk1DA6+h6uis+oMQta3ej3+1rt+9H+9TRiF3iF4sIz4S+Hxl1ZxMeV9 kz4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mGoolG7f; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=zFfEfnS/aKJzx5JFPouMms1a7V/eYWKEC0HqCoqSteI=; b=lqXvGMgFpGUlEdKCDRTvSOWiy4qBdt/mRP/6RdrS2Fi9rbxD1DwSx9DMt6h1NmGM+B v3mski5662ZHFf9KiV1mjymRRxzvuU2g8lK2M1DTTDzqJglPzdv7XWP3WF6mF98DqlD8 yZCfvf1WSJOUycC2HvDpMCVj+vZXerxnsZGkY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=zFfEfnS/aKJzx5JFPouMms1a7V/eYWKEC0HqCoqSteI=; b=HCUsr9C4wmPbgj5QdxS+tGGoQVL1m3frgj2R5y4bSjubkMKXe89j56AKiopWXjcQBI SL0psg517VL+Jx1a8RYviWojji7yT22AhLTVn6nuNKi8HSAilpQdHFggtFsDFWaNoZFF HDdooSUH1WypPCG+v4+x51kIlLemxwXPoQvIIactFxRDb6dEZOP3U8bVnpcP3ej08vzt 4nc7l/tmwP+0N8FQ8QMXwLVfONJpZoWzcNdBCe+77ceM8iLiCeCsJfqB8KSA4w3nCt/h mUv6AJMcWrGG5b21ObV6b7unwGfPbZQ3ITlIrL0lpzwIfkkykgbBrE9D5EMXNWwulNlv xECg== X-Gm-Message-State: AJIora+lwdqM9whPNx1jNS/5egoLo9x61bwNUVLpA4MN733NfMAzJXvp jlj1c5qHUsaSZJNLHY+Yf6ttphJx X-Google-Smtp-Source: AGRyM1ssVxXcgMccjZ1Zsl1y7c5JO4Jygud5qQC/a+HifdpBGR1MwBceYtAQdHppoIb767C0CJpNuA== X-Received: by 2002:a05:6402:212:b0:43b:5419:f89b with SMTP id t18-20020a056402021200b0043b5419f89bmr4202209edv.9.1657990819155; Sat, 16 Jul 2022 10:00:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:98c7:b0:726:2c39:8546 with SMTP id kd7-20020a17090798c700b007262c398546ls18317ejc.8.-pod-prod-gmail; Sat, 16 Jul 2022 10:00:18 -0700 (PDT) X-Received: by 2002:a17:906:4482:b0:70a:19e3:d18a with SMTP id y2-20020a170906448200b0070a19e3d18amr19182434ejo.510.1657990817941; Sat, 16 Jul 2022 10:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990817; cv=none; d=google.com; s=arc-20160816; b=JJVDfTi1ISDpdg2kmiwg2b1wyy49F8+jhHmblNklrBIuHS78A0Xb4gKhkBUoWBNLmT wkN8ALMImuicaLYeVd8MGY4al7GJAHkpbhyK9lUvAAM9SFbR4EAJYI37Y8wBPWSemmvX iisWtLWQOegKzeRIzIaOu1vphBMQBceT/FdpUw4ITnT01E7qqBVKtAlp5nXkw0c9Zs3K d5yCCvmt0qr8Tx9S5qPJSLuL73zXRICEpkLrfbRw+xYjNfAqQb5yBuFQl8vLdkNkENUJ VDFTf6Ne+RGbcFTRDuObd5dUBff/AxxGkRdLATWBGYWgbzbVCa0PFxuJBvG7zBsHodkH t1ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=fHx3+JjARcVqLchAq3IBsPDCyyKS9HCXdr7RVf+WDMo=; b=0j6XwzKEQjENyv8hbveN9fVTC37I+E7p1Heh4vrjccQFh8ptwio3f/koPc+gl+sIcP ZNMYniWTUbC4sweNh+qsWQ1dCoCbUc0+Ztizpzc/AZf5q7hL9hhhyvt9E7hCY4TsU/5a 2m2SVB2oL+ygQ8J7+r9dUMETsEEPgo8QXrxVHtNlNUZ+h1jtVZVn2CehG4+wEEzJg/vZ FKFXJfBUtcFT+6zSUI9inWHH7feKyFOeKZbgbQoY0x2zRklRX9E1mGXtg+3l2WYUx/Hl T50yRvlA2rvpWm37VI19rth4Xfjti95WTY4zUWc5w51klTbeCF/w73sw1hPSGOxIUL1L SPkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mGoolG7f; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ty6-20020a170907c70600b0070afac782cesor2551365ejc.5.2022.07.16.10.00.17 for (Google Transport Security); Sat, 16 Jul 2022 10:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:7294:b0:72b:1ae:9c47 with SMTP id dt20-20020a170907729400b0072b01ae9c47mr18608911ejc.253.1657990817736; Sat, 16 Jul 2022 10:00:17 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-182-13-224.pool80182.interbusiness.it. [80.182.13.224]) by smtp.gmail.com with ESMTPSA id g3-20020a170906538300b0072b14836087sm3363135ejo.103.2022.07.16.10.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 10:00:17 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Dario Binacchi , "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 4/5] can: slcan: use the generic can_change_mtu() Date: Sat, 16 Jul 2022 19:00:06 +0200 Message-Id: <20220716170007.2020037-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> References: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mGoolG7f; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , It is useless to define a custom function that does nothing but always return the same error code. Better to use the generic can_change_mtu() function. Signed-off-by: Dario Binacchi --- drivers/net/can/slcan/slcan-core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 093d232c13dd..7a1540507ecd 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -727,16 +727,11 @@ static int slcan_netdev_open(struct net_device *dev) return err; } -static int slcan_netdev_change_mtu(struct net_device *dev, int new_mtu) -{ - return -EINVAL; -} - static const struct net_device_ops slcan_netdev_ops = { .ndo_open = slcan_netdev_open, .ndo_stop = slcan_netdev_close, .ndo_start_xmit = slcan_netdev_xmit, - .ndo_change_mtu = slcan_netdev_change_mtu, + .ndo_change_mtu = can_change_mtu, }; /****************************************** From patchwork Sat Jul 16 17:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2185 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 972703F046 for ; Sat, 16 Jul 2022 19:00:20 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id w15-20020a056402268f00b0043ac600a6bcsf5344705edd.6 for ; Sat, 16 Jul 2022 10:00:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657990820; cv=pass; d=google.com; s=arc-20160816; b=gHFab/dtOQujY7nhNuS5cQbStAfk3sI+aBIxPcmqh1VwYZ6Tt9zNpLBK6o1kqYsPuM HGqQqjOSXLpP6LhUW/yNiSlIBEBcXTKUiJtCWi8eJqvus3DRUUxE4W1eyKMDSmDFUKLX 51LzmZ9ReQotKD3rt2VdsY55rHfChn/ANuhfXDJ0mUfhzdhzjSY3dDwi/3DVKbUVMel+ lMw8vMppH1XepT7cY597EH+b79puZP8wAGQeUSfFlhXpt5Ofo06cMcqTpwUFw0MtNjKe SOxWar2bs+IRIVER9OCajxtRMjUIf9UQWm3R83OteaTy/uw1qB9ecLlZZzL0S0GWl+nL y8pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=JTe1pHK7dxQyfRxAkRaE9oMjCZ7/bhT9FR3CSdHNO3E=; b=YIIzE1HlKXXPimy6Jggt4MqxcybGmxCpBlzPzSdrUmcfFIuKJ6QPd9/oI2t3NjV0R3 WkoQ/7s3Y3fAmi5TiObLmQXVIBx3bfzl5MsDTqK41BDHr2X6bsvPmNSsnhYQIH8XOIuK k+rgVWw+Gw0xG6BI7JmuEvGgHzZCF+9Ti6Ws0socCZb3Ad6QRl4GnkaYeDZnu1inxkzo STfp4nhdcQCYqvzSCC8eOrk4v48cQ6qCaFWF3xH5PcYz75cesVXWJ+sM9RMROe6YPn6d 064/CduX2+hx0JH2X1JGYNpCwsZR8sd9FqVO+dmjzJi+kTM6OT3P0PPPy8uAryfLLzJD 9Ibg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iQf244o1; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=JTe1pHK7dxQyfRxAkRaE9oMjCZ7/bhT9FR3CSdHNO3E=; b=jQI93GVROOKgigmn5GwQbgiVw8atGVUjtE7LeA58wN+BwfwX8YS29GVGr2h2hw0dLz ApwGml0539dXduYQTJK3nntjgbILoH1eHMvmOTXOB252al80IJksNI3z94Jy7Tc30Cvt KR0ZouVKgQ/cP/lBcqvwlns3EaRYv4CNYLHm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=JTe1pHK7dxQyfRxAkRaE9oMjCZ7/bhT9FR3CSdHNO3E=; b=HBHS14DcraSa48GXryOIFG/nTRwmZJQFTKpl2priQY3Mibz+RnvxUyPqCDmXBOB0Eq SDMeejpcZbaoTRADsDJthblh78hVOdDz/P/X+k3TZS7MiEmaTcIe2+F1a1CISOqrKga9 JQZaUSpVqrqwlcp8p9bBLK3du0wXo67EHYfjJ2lV6HO5UpQaLtClAbzDEicaby+4rbVp V+6oppN2hx+bOlLg4HsbXeEiAlyFx8GtcKh7q95zBGD3Me/z3PF/70vbQ5EniOCyiYAS mmpuw3xUI+aufJSjKQt94nb20FL+UXKUdmy41lY1Y7qtTE0fANQQPn1FtOP0NSpgKd9d viUw== X-Gm-Message-State: AJIora/3+2J7awL+G+JTSbGA9W2P1JIQfmd7lXD/zg82AEys+ZPLEDre i8pabn9EPVYVObgz7TS5E9K+r652 X-Google-Smtp-Source: AGRyM1v2gV0G9WzB00CW9ZqcoMvZnOb4ZUM03RmtsWHBRN8JnDHvK/cra/uw7cpVIzBAJARouy8Nhw== X-Received: by 2002:a17:906:2086:b0:717:4e91:f1db with SMTP id 6-20020a170906208600b007174e91f1dbmr18702049ejq.345.1657990820434; Sat, 16 Jul 2022 10:00:20 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:94c:b0:72f:1dfc:6374 with SMTP id j12-20020a170906094c00b0072f1dfc6374ls270025ejd.3.-pod-prod-gmail; Sat, 16 Jul 2022 10:00:19 -0700 (PDT) X-Received: by 2002:a17:907:d88:b0:72b:1127:33f5 with SMTP id go8-20020a1709070d8800b0072b112733f5mr19361368ejc.725.1657990819286; Sat, 16 Jul 2022 10:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657990819; cv=none; d=google.com; s=arc-20160816; b=IJArz0APbd37wm9GQZOxP0viCaSO7tZbvMBDRTxdWTNcDDNZyojlhOJ4KUAIcBsYc9 DQQ6uWWjEuN9uxJD5NsHvZRhAVDCE+zxIA1EZXHkAfkvCi0LADTulNG0Ngb5DzOK91Tu QIXgy/vvsHm3lNA4Ey71EaH9wH6Qr7Do/tXcH0Cs50yy0/1VMPqiCjThYb313brohgmC oepdrEISHByzJcxwKfg5y0By9ifYSo+pn0h48pakN0KRwGk+N6ENmQxEXRiOdl33ISQj 4pxqiKlFQ+efyZXuOup4h4NYVgROzclW8h1ZrFpW14L9iogBmB8dj4uqxjgj+pE4vvWR fTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+8/uBRwlHoO2r+QA6MM57OwP4K1pVboHuwKMksUhKgk=; b=YbwNZG9NH+WndZ40wCgHURjouev/id3plhIXLkDBaegGfbQ9bYsIUgtRUNieIXU5Kg yqJhlExtYb4+olPkzglNR+I7gA15s6j3+e1x1bnSbBEU02AQSk5H/DnK1puZ3iJQ2dnH W9TnLjS7gLdhi67soR66kuYFJv6TFBedGVBcuus+eSz/f6jvhy0o7qGEKwQsTfe6fDw1 s7y+kohAdknDuClMxIQoRQYOSpwiTcQizFhWMKUhLSWPy0rHJzhU8QQW6Isz0YJp77wY f22HlliVfBLhamhHs0m2QKuU06MmsZopT7BAhWeMkgLF7wTzEfZVFK+ZapU6G11Azw9Y 64/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iQf244o1; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id d11-20020a50c88b000000b00439d5301a15sor3595918edh.14.2022.07.16.10.00.19 for (Google Transport Security); Sat, 16 Jul 2022 10:00:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:e85:b0:434:f9d9:3b18 with SMTP id h5-20020a0564020e8500b00434f9d93b18mr27275747eda.37.1657990819011; Sat, 16 Jul 2022 10:00:19 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-182-13-224.pool80182.interbusiness.it. [80.182.13.224]) by smtp.gmail.com with ESMTPSA id g3-20020a170906538300b0072b14836087sm3363135ejo.103.2022.07.16.10.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 10:00:18 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Dario Binacchi , "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Marc Kleine-Budde , Paolo Abeni , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC PATCH 5/5] can: slcan: send the listen-only command to the adapter Date: Sat, 16 Jul 2022 19:00:07 +0200 Message-Id: <20220716170007.2020037-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> References: <20220716170007.2020037-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iQf244o1; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In case the bitrate has been set via ip tool, this patch changes the driver to send the listen-only ("L\r") command to the adapter. Signed-off-by: Dario Binacchi --- drivers/net/can/slcan/slcan-core.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 7a1540507ecd..d97dfeccbf9c 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -711,10 +711,21 @@ static int slcan_netdev_open(struct net_device *dev) } } - err = slcan_transmit_cmd(sl, "O\r"); - if (err) { - netdev_err(dev, "failed to send open command 'O\\r'\n"); - goto cmd_transmit_failed; + /* listen-only command overrides open command */ + if (sl->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) { + err = slcan_transmit_cmd(sl, "L\r"); + if (err) { + netdev_err(dev, + "failed to send listen-only command 'L\\r'\n"); + goto cmd_transmit_failed; + } + } else { + err = slcan_transmit_cmd(sl, "O\r"); + if (err) { + netdev_err(dev, + "failed to send open command 'O\\r'\n"); + goto cmd_transmit_failed; + } } } @@ -801,6 +812,7 @@ static int slcan_open(struct tty_struct *tty) /* Configure CAN metadata */ sl->can.bitrate_const = slcan_bitrate_const; sl->can.bitrate_const_cnt = ARRAY_SIZE(slcan_bitrate_const); + sl->can.ctrlmode_supported = CAN_CTRLMODE_LISTENONLY; /* Configure netdev interface */ sl->dev = dev;