From patchwork Thu Jul 28 07:02:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2273 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 1CF7D3F013 for ; Thu, 28 Jul 2022 09:03:06 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id i5-20020a05640242c500b0043c17424381sf541128edc.13 for ; Thu, 28 Jul 2022 00:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991786; cv=pass; d=google.com; s=arc-20160816; b=nZPK7SogynWh0UNJ96SJXeQd94EFsMFIue6dV1YtOZiLR/NFEgftndb/itHHgbv+GW Or4oBIr+H4etfjxomuMhdNICKYOX+lbrwWuQJtrm6sfpIRqq1CHpo/j3xNVYglnNGt2V IhEAmypd1axB7DpzFLpRSgAiz0PHxKUgAqH0J+4lf059uOxmeOGKsfXytrgyShOq0fFb r7U2BpvFQ5/SmQ6qcMG4s+msKM7O4bgAOza6EdeEDQnqt9dn9KfLGVRVi56SEUCo0Q4p HFGB2mOkNclCMZDV9YJTx3djZsRADJ0nzPG9lUmgnHywJjxNMrgUrqjQ8RxZzwycuLDB yMyQ== 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=BBinzeBC6GzMFHUqWADB3zp2tYnraOQWE0XQu0kzeUs=; b=A022+EMgaULkJnbLuCv2f5OZ8ksrWdJpMM+3khgsoahfSOJeVb18kwMxVkmWcJNw2+ MlT3tradQJ2sBN0QKzLWHFpO3/zy9tJvnZtl8dS5cbbxEDHYgMVHGZFRuLav4mwM8cg9 eMPUfKK7oLHUqZe4kQ0BaXS2oMYu8pEscL9CZlyWuo/l2jXU+rZ/ZjCEKRU1R0eCNF/7 3SfzzkFnF4drjEcYJfHTOFwu6IWKh7FDqEfklkN9HYrcGwGAioxCN7H5Y8Z0EVuHVp7S LJgDKKMGKfvmawsJK4O65slXAmNZ7JLA6TVpQKeNU5oQYGQwUaaNC96PPj/JCngscW48 JxGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RMGtU7wa; 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=BBinzeBC6GzMFHUqWADB3zp2tYnraOQWE0XQu0kzeUs=; b=AiQae9HyBYpjLpBt6MMEctG9nNZ3Jqt0/Y3JLRo2p6n642J0OPZU9e8pyH626bJPdI d2FjfmKjScVO/1x2DKqg2gaMhcSV7ldomCyF1OEFjfCBkoGIv+JL/WSEVRYhhmxr+8wV 8iMA/+HeRCsnId4iSLgbizp2/9rZjpKlHgcps= 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=BBinzeBC6GzMFHUqWADB3zp2tYnraOQWE0XQu0kzeUs=; b=5W0sWYRATi3AO6Zv1BIApwCbZ7nFxuWmfAGQbco9n0f3UyaLbPsQ2IZl9jU4S1+5l3 KcHkHRJrJzopi227Df6QQ4rKXiXMmAqsaxQXzXNMPo03urN9O31tpZKEToBfdxumQkdi pRVSAH44ZPDIXXs4viFBWtkfHh7pjfKRboAP84393kK8c/rky0YdH8lnOtc7v/hdCz4p 3GPJIGUMrfnQ590KlMyiEMAvqyZjkPwv8oRhyCV9CbfwS/5r80JfE0jBaP2O5z/e2+hI sn8qTp9JKGGOas1Cpk+7Bapm/2NRERiDu/87ZHjqqwmwUi/bGYpAidICZ0MGA3cb7JDI FV/Q== X-Gm-Message-State: AJIora/DbNVw6fq7WrcRTm+d0Bx72RqluhJkXo5PRVfult5uHZ5/Fd1M ECehnrJvLb0svAXeU8qS/O35AziM X-Google-Smtp-Source: AGRyM1vjzC2s53he7d/wkfOxENfGRtZDFB4UeyARdtv6aFLrbpj5pfLewsA8nRRAUCHVwXA9s731ew== X-Received: by 2002:a05:6402:d05:b0:425:b7ab:776e with SMTP id eb5-20020a0564020d0500b00425b7ab776emr27165730edb.142.1658991785933; Thu, 28 Jul 2022 00:03:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:3b8a:b0:72f:b55a:8f8c with SMTP id u10-20020a1709063b8a00b0072fb55a8f8cls422618ejf.6.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:05 -0700 (PDT) X-Received: by 2002:a17:907:3f92:b0:72b:5af8:b87d with SMTP id hr18-20020a1709073f9200b0072b5af8b87dmr19560084ejc.416.1658991784907; Thu, 28 Jul 2022 00:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991784; cv=none; d=google.com; s=arc-20160816; b=fM/x8ns96TKaZQrtR5z2Oy8P4Yl1mPUftQISVEanGffcciHC7lVR3ex+1Zh/HUbdCB 7HgBadtF91xcG1idN0mVbDXn5VxTJhWCfAEwVfuTNtDu7TTyH/ODKSkPGJHXbzhIQhwD iUxv+pDxEkNB/HJvKK3lsr1lgdhWDe/n5hhqJ2QcSVvfGX6Yd4GF5VKnmDLGrd2qWKNd Fwg4mCK+iNO6zZtswrQlKKLA0oeAfkYDqIwdan3FH2GrpKOSMM197KqLnj1rULUkVhg+ g2PIa85cflJPfDGCcGVIyrxoFXGg3VmFvUOfFKCrJ91L6jhS5MzbzMamdzW+XQUknZ4J ELjA== 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=W6W3RCGbQm1ftNxYyveQiUbovGJZ//OaxbWEapVu2yM=; b=vxRC7WYlrsAUF3ii4NMZNKgyMcDbkaMEW5g/GNeY05nrQkqw7oNqRiPweXp4p6di9A 6foQ9HVaas8zxm1Q/8PQhMoDi/cqn/5II2CIr6WKvfVFT1bD2U3pjCyA4So9AY8/lfih wgLkzImSx/Uu+bKLVQ8y8LuLu1ZAsZD+SkTzY3XedmOenQ+pLTXCCaQAVE6L3vGup349 Fckz+Kn2/GK9fzJG6jvYqEG+M/8pjYnuG4A75efPq6PMUm/82DN4mypPEG7rQtNANVb0 1pXHFbHTa6jQYnUUJ4+C0yBWlXZticYO2RcCDtVH4EItw4GZ95woNjrvzmT/u/xnJJ+Q Q38g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RMGtU7wa; 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 fp17-20020a1709069e1100b0072ed895ffb7sor56955ejc.95.2022.07.28.00.03.04 for (Google Transport Security); Thu, 28 Jul 2022 00:03:04 -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:28d6:b0:72b:7497:76b with SMTP id en22-20020a17090728d600b0072b7497076bmr19828979ejc.365.1658991784453; Thu, 28 Jul 2022 00:03:04 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:03 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Vincent Mailhol , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 1/7] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names Date: Thu, 28 Jul 2022 09:02:48 +0200 Message-Id: <20220728070254.267974-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=RMGtU7wa; 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: , From: Vincent Mailhol The driver uses the string "slcan" to populate tty_ldisc_ops::name. KBUILD_MODNAME also evaluates to "slcan". Use KBUILD_MODNAME to get rid on the hardcoded string names. Similarly, the pr_info() and pr_err() hardcoded the "slcan" prefix. Define pr_fmt so that the "slcan" prefix gets automatically added. CC: Dario Binacchi Signed-off-by: Vincent Mailhol Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/net/can/slcan/slcan-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index dfd1baba4130..2c9d9fc19ea9 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -35,6 +35,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include @@ -863,7 +865,7 @@ static struct slcan *slc_alloc(void) if (!dev) return NULL; - snprintf(dev->name, sizeof(dev->name), "slcan%d", i); + snprintf(dev->name, sizeof(dev->name), KBUILD_MODNAME "%d", i); dev->netdev_ops = &slc_netdev_ops; dev->base_addr = i; slcan_set_ethtool_ops(dev); @@ -936,7 +938,7 @@ static int slcan_open(struct tty_struct *tty) rtnl_unlock(); err = register_candev(sl->dev); if (err) { - pr_err("slcan: can't register candev\n"); + pr_err("can't register candev\n"); goto err_free_chan; } } else { @@ -1027,7 +1029,7 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd, static struct tty_ldisc_ops slc_ldisc = { .owner = THIS_MODULE, .num = N_SLCAN, - .name = "slcan", + .name = KBUILD_MODNAME, .open = slcan_open, .close = slcan_close, .hangup = slcan_hangup, @@ -1043,8 +1045,8 @@ static int __init slcan_init(void) if (maxdev < 4) maxdev = 4; /* Sanity */ - pr_info("slcan: serial line CAN interface driver\n"); - pr_info("slcan: %d dynamic interface channels.\n", maxdev); + pr_info("serial line CAN interface driver\n"); + pr_info("%d dynamic interface channels.\n", maxdev); slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL); if (!slcan_devs) @@ -1053,7 +1055,7 @@ static int __init slcan_init(void) /* Fill in our line protocol discipline, and register it */ status = tty_register_ldisc(&slc_ldisc); if (status) { - pr_err("slcan: can't register line discipline\n"); + pr_err("can't register line discipline\n"); kfree(slcan_devs); } return status; From patchwork Thu Jul 28 07:02:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2274 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 5EA2A3F013 for ; Thu, 28 Jul 2022 09:03:07 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id h15-20020a056402280f00b0043bd8412fe0sf544105ede.16 for ; Thu, 28 Jul 2022 00:03:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991787; cv=pass; d=google.com; s=arc-20160816; b=Dm9WsgSDf/C/Uj33XDc8RrqYD8OUSxLD4AO3HmzZM5yr+ZDangujOA60325dol9/xJ 1ha7Gw06WE8MRCsypzqFUTnzf/YiQBT8tEMh0wIIPalrqJd3Tnt4MeQyQzuGFiTEFTfe NAN70umcprPu/pZn+Tr/32L8BRLcZv/V8BcfQfC42TSVlGvBOEvA2RP/QuYc3YDmT/Yg cDJC6vgidiHJ0sx/sXjTKraYe7va+V8OjmLMCn3V6tEcoBm+dSvhuo7uSzKe9V9NFd0o Zar6yyot6VQ3mPb2Kz/HATshBfOX+m8TF7y60ln6CzmKu6ILsbPcYaxQu5USnlOemU0c jAig== 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=rkm1Fxc9RipiGWt+vWTk+rvQXuCD0BPDXoNxKYvD72w=; b=d1v8Vd39XDZCXPWkjt192iJ6HQarJo5wColn4gfPH1ZFDJmg5lbAa51sSHUUtjMOmr KYcZw1GohzWCSjGcNzTp/fgUmaFX7S5L1sGAM+Kfm0Ph17EQRVF0BDZ5jdSKb1bXyVcv inQjmU7GVH0RAf4Fz2PIwiJCjq1G9RTLaRbnxXyZdwLj2HegwVfkQwmI5/sYC2u2kDrw cjZnnkkNOPpkJuNjvexVewVMfznl7UhdfqloMqUiiTIf0ncaa7dH9r4PTEeFCfHQ+3AO A7pU7VuDlYgf0zYoAybQQtp/8wBve8t8D80/H+yYYJGk/THpDGLhPfkxguOKH7VBSNpS O9xQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H6c+CwG8; 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=rkm1Fxc9RipiGWt+vWTk+rvQXuCD0BPDXoNxKYvD72w=; b=AfPCEMryNry0qS9q7L9IVlwnpQ1++dPZHdTx4h9Ac/0VZ9J8bhmNah/4mezitcW5zw rL9jxyPKcRPFfGG62tSHUx03j3hnL4DUA65cMY3vnLUpt77AcrzFsodLXFhtAYr1giLS YLO20u1epEzCSJ0QcyqyU0ivQQ2RwqK9PGzQg= 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=rkm1Fxc9RipiGWt+vWTk+rvQXuCD0BPDXoNxKYvD72w=; b=fI6XNzAyU5zNA0QRO6QWGNF3Lx9LENhmSXiuzeHjl7qv7VIQPY6k9J3oK/x6NRPqwp mSdpEAVNTWu0XuSY3s+/6jbsamRlmoIlTcJ5pHZaI4sQU4aS+3yhV31q1IzxNmF4QwkS pXFH4NdrddQKOUVxO91ziPRtoOXKakdZCYks6APT8kmkEaK4UfFBSEAa5BFs0gvahvLz i14xl0BwBJ4QbGslH4B/CzDaAhvJ0c/nhMneqc2D/NKufAyByl/8V1jJCiMWoz+oprZK wDX+fv81+yx2kbRyhQ7d4nAyCtaqfVe+wrrBJKwy6VRj/IoazjgN2m4ORvASsRDZGN6O z0Lg== X-Gm-Message-State: AJIora8gd7r++S82krUKq59w+EHgjm9QCw5/uVEqvIL3GGumt4i7/XLS soJ5nh1Gh5IzZMXSLGkjMcRLPHXd X-Google-Smtp-Source: AGRyM1tHbnRnOItCHKUKNAtmk18+W/1C1WkvbrZjuke8bza2ZQEGftiPYm30uR5/uDwFzdNIai1JtQ== X-Received: by 2002:a05:6402:34c8:b0:43b:e7b1:353c with SMTP id w8-20020a05640234c800b0043be7b1353cmr21381722edc.171.1658991787212; Thu, 28 Jul 2022 00:03:07 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:1115:b0:726:d068:52af with SMTP id h21-20020a170906111500b00726d06852afls431320eja.1.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:06 -0700 (PDT) X-Received: by 2002:a17:907:2c47:b0:72b:9478:924c with SMTP id hf7-20020a1709072c4700b0072b9478924cmr20247768ejc.188.1658991786171; Thu, 28 Jul 2022 00:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991786; cv=none; d=google.com; s=arc-20160816; b=w8Pa6nslRPjkoHc5tvykKUwJGnGElU7y3TPBKcXr4EvD4GEz40FHkGAAwqcaMVXx92 DdcuNzUcICrf7jPMu3ToXyoLLaRjLQTJxHzyKtPmz7/fq+8hL7Ee9/5whtWrouNQ3aKV BmRwiaukerrJ14mBcKdwdH6eJztezhTF8HxeB0MtwquRLPHFPPwWm4rMD5rFop0+69ls 3P94rciJqwgeV0n6oXAl8ij2cZ9iZq6xp6+3ucLTZ+e5CJ24vD2VulRHMVYGq8sI8kxb GVsc5SWD6sRmHBLk72vSy1z8eKJlelRhAlyNGYo8u3/+qdY7TupTAIWqfGKwms9hqyBp F+wQ== 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=OqbFbN5WONXbXcraJR8YQy0FCGLdvzQc4+bJ+5uxeJs=; b=HZ9wSzumVdHNNO2Mm02amxA5ga/PdNuCK6gAM4Brz9RMNEpHOrXwZLErITGmAPef1p F2YP0xwWviBsuss29GhTUah1/IDnff1u/wrn76Giogc+x5aEGGTlNk923yRvanGAN5Cq aV1SrRJurYaCVQclgxhXUxiznArc49E1kMxf/pO/abFQEo7KLnZXJm+mqHykAEAEsmKR 4rCrKnR7gEpSnyRA/gLsWHgMoLC4R+mb18PDDGo97FkeWtA0jtspGkgisLKHd8ncAV7M eTW8uQtKkLhZUgujiA1V1w9Pq68yrFMaSRxzezxPyniTfS6LVRc9JLIDcfJfvKnziX1j VtoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=H6c+CwG8; 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 ag10-20020a1709069a8a00b00723b6ad1a3esor54160ejc.101.2022.07.28.00.03.06 for (Google Transport Security); Thu, 28 Jul 2022 00:03:06 -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:906:5d16:b0:72f:248d:525a with SMTP id g22-20020a1709065d1600b0072f248d525amr21052749ejt.441.1658991785810; Thu, 28 Jul 2022 00:03:05 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:05 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 2/7] can: slcan: remove useless header inclusions Date: Thu, 28 Jul 2022 09:02:49 +0200 Message-Id: <20220728070254.267974-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=H6c+CwG8; 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 --- (no changes since v2) Changes in v2: - Re-add headers that export at least one symbol used by the module. drivers/net/can/slcan/slcan-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 2c9d9fc19ea9..ca383c43167d 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -48,9 +48,6 @@ #include #include #include -#include -#include -#include #include #include #include From patchwork Thu Jul 28 07:02:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2275 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2F0C83F013 for ; Thu, 28 Jul 2022 09:03:09 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id nc23-20020a1709071c1700b0072b94109144sf327459ejc.2 for ; Thu, 28 Jul 2022 00:03:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991789; cv=pass; d=google.com; s=arc-20160816; b=jxCvMv2n7z4SBaM11xWzqQgTRP/Q+mzOVbNfExut8vY0hIUC3tiTdNDOq5rQeO4zvI 9paVlGqMwJ6ApYwQqFd+zKY1pS0+AAz6MytqfBGDPEabD/zuXOOFdeawZ0uGUR9Gs+KL 4n6WCeBHaz7a2G90G2p0WjRieqZ7sumxlMzz8hMN3wNJCBuibMvownDRujXNq1vfXuUA w/Y+GxR1klHlsEUoEOHk9yJCYRqwGJf45rTUSq9yWzkLchV0yR9RKWZnbqO7HdU0pQOD mX5GKRTaoexWqSHVofHUe3qSLww6VknZvL4sWYQjA3PTdGEr32lbnj7AIix9M/xghq3a NmqA== 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=UgZbut/qa8HdXoS+rtwo0+PB8PCkOZ7vNOusfdkdrNI=; b=mCA3LfIB6Iqrnomtlczna0pSD9ECjr9SHF/mUWjNSfQHptIrYxwgg95a2f1XVMs6Tt UVllC6TEKPb2soEFMYa6+g6GmYo9l63fwNhaNwpPW49ptbdtzTAy9V1lxmua5BnGw+YX MlAEnkNPocAydrIw/psrfVK+j1DICoYDECM3d+IWpN75bMXDnI8ENny1TyD2wbxtU8VN OEUKHeqhl/zGsxYkHQEzaXFhuAviAki6CWrantwOMRUdb0jdjrhWDx9ASzMizCOtLbd0 Noz7Jtvl5iBzj1PopP4jzE7KWyjfrNIdA4zt+HIlblyL8OT/x7JzXn6pOmpM1iatyBG0 81Jw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=pFlhC11P; 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=UgZbut/qa8HdXoS+rtwo0+PB8PCkOZ7vNOusfdkdrNI=; b=TptKJxpbI+eTw0uGZgoYnjnlG8ejWesAkraWegDUFUx+wuxCGXrjFKQ6zJK0uSikyk 9mRQAwbMu7ojSMaVZ9gjISWRu/j5RM9wPSxwN4Gr1wesEvJd7mx8Qn7gpASsXFyRPDy7 GLJ3INwK5BJWMEQFJ767m26ybfTOagzZxwS4Q= 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=UgZbut/qa8HdXoS+rtwo0+PB8PCkOZ7vNOusfdkdrNI=; b=Rw5z1GI0VjVePjlBMNRKOVdXKF60n2pdYH5MB+ilj1L+6lJ5fBqI/X3OFc6UOObANC kolVPSvKx93kzjAHrtTY7KmQxk1g2EkA0aBpgrxIr+xekpk9TUtxqbDFBn7LZLfLEtpx Zpifjp0Vld/02Jg1dGa4VC+mIjx9i1k+l7nLLsDF3lHaT4DbtYLcOtlpmlZ1FquZFzj3 33jZRVXL4XuyjUG2bnp57OCivJRQEOVHrCFS2Qbh1JNvIleD9PlnjjNJk3AP1plwL6c4 yJP1bJNgN+Em5vysX7XBAMGMmXDOS2IzAYwlk+7YGn70cxq5PtJaMB9oshG7dS7g+7OG vj+Q== X-Gm-Message-State: AJIora8M6Vb5p+Gucsmy1LICO5Zce4sM6CIGwLLig97TktKHBfrX6dUK T/O2Z/yOpeBvF4xaQi2BTThc1e4A X-Google-Smtp-Source: AGRyM1vR++/De521R+aj57E+ibNCxd833KjkC7bz82sh3OiXy9L64EuTZ7FXPwqnrTskz3fCENFadA== X-Received: by 2002:a17:907:2855:b0:72b:67b7:2c28 with SMTP id el21-20020a170907285500b0072b67b72c28mr20608572ejc.331.1658991788984; Thu, 28 Jul 2022 00:03:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:6d0e:b0:72b:41fa:b554 with SMTP id m14-20020a1709066d0e00b0072b41fab554ls413529ejr.10.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:07 -0700 (PDT) X-Received: by 2002:a17:906:4785:b0:72e:dd6c:1ba1 with SMTP id cw5-20020a170906478500b0072edd6c1ba1mr20301408ejc.712.1658991787720; Thu, 28 Jul 2022 00:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991787; cv=none; d=google.com; s=arc-20160816; b=VlzQslUpQpoC3giXFvkdgwSJ9dIuDH+mfVxSLN4jkS9aK/n2EukUO+THPadhpG8u2V ODbH6tx61v/O0fcKnymXkabwBLoT0HSwXY891uIPl8+wS8KAaNLy29xzi4wf9Ao42wFc HijWEc/cxXmfRd6I2gripzwPzwhXQgkBgLaTq9y83Hyoe4lTdk3u+GJBJ+jO9Ui7UtGz 7iSmIPqiqSa/nJRpPLED+WD7YIUVgaCnwCZ3k7MY4M1olvcpKhnjnzcB3x4kuvq1H/4M UCsLEL8IwpgpijbM5QVLJzhtWYy6ztKPdWqgzCICrNPUthznniylydQwyzmSwDMXBuIf Y8ww== 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=RIwpnqXVkEPVC9y6D6imEtiW45Xx5sUlsaiN9YQ/yrc=; b=jKoKAbHeXkEqMZiiW3sy92sWEaeiNygtdStuh4e0mj6qz9WOBG7e5jxIEqOZOlP2uU w35vxmgZn88ZyFHbahwjsskZM2tEcMNLRubsn5axy3+ORT8U+iinr4cxRuW7NV5smeb2 +wNhIG54kv15snHqT/7VrT0FmG6/3nvZC6WLY0Rxl9EqzdE2JTAMvs25JlV+/nMkn1GU 5YRFYEcRbspvVYT7pyVRz5CGyYRpp+YmPECUZqfQrw4Xy4IrnhlotbE80qHma8spQVi1 piwmrhG8i0vYluK5w/NyQ4W7KJcjoptJ6mrZ+O4Zq/RHBkqeHd60Cb03FoCg/sffa0Tz uDhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=pFlhC11P; 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 bx19-20020a170906a1d300b0072b960ca210sor58766ejb.86.2022.07.28.00.03.07 for (Google Transport Security); Thu, 28 Jul 2022 00:03:07 -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:8690:b0:72b:552e:67c0 with SMTP id qa16-20020a170907869000b0072b552e67c0mr20012840ejc.600.1658991787258; Thu, 28 Jul 2022 00:03:07 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:06 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , Max Staudt , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 3/7] can: slcan: remove legacy infrastructure Date: Thu, 28 Jul 2022 09:02:50 +0200 Message-Id: <20220728070254.267974-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=pFlhC11P; 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 old slcanX name has been dropped in order to use the standard canX interface naming. The ioctl SIOCGIFNAME can be used to query the name of the created interface. Furthermore, there are several ways to get stable interfaces names in user space, e.g. udev or systemd-networkd. The `maxdev' module parameter has also been removed. CC: Max Staudt Signed-off-by: Dario Binacchi Reviewed-by: Max Staudt --- Changes in v4: - Add Max Staudt's `Reviewed-by' tag. Changes in v3: - Update the commit message. - Use 1 space in front of the =. Changes in v2: - Update the commit description. - Drop the old "slcan" name to use the standard canX interface naming. drivers/net/can/slcan/slcan-core.c | 318 ++++++----------------------- 1 file changed, 63 insertions(+), 255 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index ca383c43167d..0d309d0636df 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 @@ -38,7 +41,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include #include #include @@ -48,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -63,15 +64,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) @@ -85,7 +77,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 */ @@ -101,17 +92,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 @@ -555,9 +543,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; } @@ -592,13 +579,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. */ @@ -669,25 +652,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) @@ -703,9 +682,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 @@ -720,8 +696,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]) @@ -765,14 +739,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; @@ -802,7 +768,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 */ @@ -817,80 +783,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), KBUILD_MODNAME "%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; @@ -900,72 +801,49 @@ 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; + 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("can't register candev\n"); - goto err_free_chan; - } - } else { - rtnl_unlock(); + err = register_candev(dev); + if (err) { + free_candev(dev); + pr_err("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. */ @@ -973,28 +851,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. */ @@ -1004,10 +874,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; @@ -1029,7 +895,6 @@ static struct tty_ldisc_ops slc_ldisc = { .name = KBUILD_MODNAME, .open = slcan_open, .close = slcan_close, - .hangup = slcan_hangup, .ioctl = slcan_ioctl, .receive_buf = slcan_receive_buf, .write_wakeup = slcan_write_wakeup, @@ -1039,78 +904,21 @@ static int __init slcan_init(void) { int status; - if (maxdev < 4) - maxdev = 4; /* Sanity */ - pr_info("serial line CAN interface driver\n"); - pr_info("%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("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 Thu Jul 28 07:02:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2276 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9748A3F013 for ; Thu, 28 Jul 2022 09:03:10 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id nb10-20020a1709071c8a00b006e8f89863cesf322948ejc.18 for ; Thu, 28 Jul 2022 00:03:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991790; cv=pass; d=google.com; s=arc-20160816; b=tG5ZP46V+/XBsRegP21fiewy9Rdu/7mROqdOrnvqSl9A9jKvRhjFUf54UxYbJ+Rmv5 OFGyoXpTpaqRMPqoCnu6Y2p6hCBwHaBezGe7kvMw00yaLhd9vWhkSfFooIRxGL5XzN39 xH8JMU2E7EHC+xIbGKGfMaSSZ2HHpWJ2IR9WIokXcYrvYTJrOPxmIbCdA1Um0LQxqUHp JTFvG0nxxMWdPL9SVYfV3jEe9PwXWAoiccUufonFzBCi+tfykKqca4833wCzDQTxNuG9 WMRRMPTCnp03xHs5h3Tz3KysMvOr+hsMLOFmnCNomK7nxu1VxV+OX/AFZtR3ptbDwAcq IJiA== 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=IJqMRVcZs0KiYrvG03Tp+hGnNTnfsNHjrgP+ICzYAVU=; b=XJQPUNO473n87FnsP/WGkJnbREPIlFmpXoxS2L899Z8pqp/1LkoVttwLB31/H/bgCU h0jkLX9qJ3C9Qn2YUonhYvmjd903BuG4IJi+FLNZNUos/EpOp8845nGMRYZKl1rsiM5t zUuYoTOv65Sx41wd1agixYHNr+8F1S2MMWx+sb42wNITxy+m/6FgLTJR8njFconcSN3f I+uLWLY5VxGCgLnvI1biEewfMLH0k9M4X/UfjQojfPitiY8Alj4xr85E/MKKU8DuZqyM vvupmKepiISLROfrrT9sa8xbLC6YVJwAgJV254kuIzRnPZqVqao6UxCri1TeJofNWWKz RL0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OvopPApE; 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=IJqMRVcZs0KiYrvG03Tp+hGnNTnfsNHjrgP+ICzYAVU=; b=NDjA9LYKMBGILoDpZUiEHEjDtjge73LgNHxDqRcB6Fs0BXUT2CQePWKV8gcbR5eRdh G1RGMPM4meqif3THEujvk8vZS/b3CrfBtBK5F906D/q0sE3zRHvfAgI4DVe0AGQEQz2N mJis2w4DpCz6Ul/3eObViI+v1VN8/UT+hUCBg= 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=IJqMRVcZs0KiYrvG03Tp+hGnNTnfsNHjrgP+ICzYAVU=; b=544Q00GGBekErFLq6fpQ4/wMND9I1GYHQAiKkFUfjQNmsQKjeOrRIvgtYxboGINgFi FfpxLkYfKnWPOoSzBeBOcarbuhCyllx6gtlZ9r8txVHwqPO2O65pUQuwLYiess3KsIz5 dwYH9j2MBjebI+zS4oAxwUfBZkZqDqGiAS79jlQRKlxGtJQ2MSDUpFJFydw4ZFWGQKPP c2sfltbKDcJbmJx2Nqe8yPI8WThdBXLxThcXUTfjyH99rM9Mtt3/Pj0pGFSsh73SOF05 AtsN0CkEpMRlEVJotw5OU+lWmtWOdJ9/sGHK38aJU3AxwM9iho4G5+5Ebqt55ndR+QXR jGNw== X-Gm-Message-State: AJIora8Qw7sfuasqa8Jn1K2sG+f+Fo+2Oy207WvHE9A9u3tvaIY2v5Cn zrCLPrVv3RcHT94eAtca+vC2vcMQ X-Google-Smtp-Source: AGRyM1uye9Yn2sQzLFkhSEkAEQxXbM1Ml3s7p8dQ88M1a3v2DPh3NKlCJHzU/foQtl0kxJu1dXYEzA== X-Received: by 2002:a17:907:72d2:b0:72b:d238:4e81 with SMTP id du18-20020a17090772d200b0072bd2384e81mr20834969ejc.104.1658991790356; Thu, 28 Jul 2022 00:03:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:2b4d:b0:72b:564b:c25b with SMTP id b13-20020a1709062b4d00b0072b564bc25bls421057ejg.7.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:09 -0700 (PDT) X-Received: by 2002:a17:906:8a45:b0:72b:31d4:d537 with SMTP id gx5-20020a1709068a4500b0072b31d4d537mr20217002ejc.170.1658991789035; Thu, 28 Jul 2022 00:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991789; cv=none; d=google.com; s=arc-20160816; b=jeNfxqvJkxySjFLeOW+IO/4ORGvDjAg8HFvapQjTIO6iPBzxZlpPERz1VmD6U4VW8u 5cQhntf7P9o6lMBzQW+h1XJirV3z7pkjb7gcnk9XkyAbZd2LsYhTBkdlxpfDsptWHepC j9cfGRQn2wGNAeg2TlY/qLE1/esTYX/tPCo9bN4g4ckJhgKY7iBr+NaPGsXWlAcmvvT1 ZQyb+WLCbDlgf1/BuvC2K8/GzBwA4R9iZuSbe44DVhDdy7IhPzoBTTiZ127UQWTrLo1W Xs5P141Tg1kK0de0NA3WQljQgp2irtUM7zcij+hS9VqTYvu4cbGW8+yRxAkItXSuYOfL 6Gaw== 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=zm8CDawEO00pmFYhToSSc819K70UuVm9tw0evLiuI+U=; b=PfwVZR0mpRTSGkhKRp46fUZCAvuzmzszhAaDJnyWVmQSEhidl77jXQ3uAQkPwl2/Xt xOxwvO7RvCjTyBEgGKiMXy+hAej8xe+viwcpTRMnH2eW5biqgquSb4QZcii/2pycDHtM 0bmoIAsELeKbhhxIPS9Y7IEJrH79g0CkLNtFml2DKk8m//UQXWPrFuJgqvCcdyZLTPIn 6QPm+4sfKaGRFOhfPaNLHxHIN2Jqm+6gu9aGZwKv7WI+BHGvxYsl0SCNl9NZZ2gBWDs0 9mmJfMlJHaVLHyhRO86PgIvyniKtTZOtocJvRT18UWvJvzThIVUUpHatRXz5vFGxXjN5 KTxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OvopPApE; 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 d22-20020a17090694d600b0072b33959db7sor66247ejy.17.2022.07.28.00.03.09 for (Google Transport Security); Thu, 28 Jul 2022 00:03:09 -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:906:98c8:b0:72b:3a31:6cc3 with SMTP id zd8-20020a17090698c800b0072b3a316cc3mr20327677ejb.597.1658991788676; Thu, 28 Jul 2022 00:03:08 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:08 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 4/7] can: slcan: change every `slc' occurrence in `slcan' Date: Thu, 28 Jul 2022 09:02:51 +0200 Message-Id: <20220728070254.267974-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=OvopPApE; 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 --- (no changes since v1) 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 0d309d0636df..bd8e84ded051 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -65,16 +65,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; @@ -85,9 +86,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 */ @@ -166,7 +167,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; @@ -186,10 +187,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; @@ -197,16 +198,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; @@ -253,7 +254,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; @@ -279,16 +280,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; @@ -316,7 +317,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; @@ -332,7 +333,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); @@ -340,7 +341,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': @@ -429,7 +430,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': @@ -439,11 +440,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; } @@ -455,12 +456,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; } @@ -476,7 +477,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; @@ -493,11 +494,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 */ @@ -507,7 +508,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'; @@ -585,7 +587,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); @@ -604,7 +607,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: @@ -647,7 +650,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; @@ -676,10 +679,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 @@ -739,16 +742,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, }; /****************************************** @@ -821,7 +824,7 @@ static int slcan_open(struct tty_struct *tty) /* Configure netdev interface */ sl->dev = dev; - dev->netdev_ops = &slc_netdev_ops; + dev->netdev_ops = &slcan_netdev_ops; slcan_set_ethtool_ops(dev); /* Mark ldisc channel as alive */ @@ -889,7 +892,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 = KBUILD_MODNAME, @@ -907,7 +910,7 @@ static int __init slcan_init(void) pr_info("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("can't register line discipline\n"); @@ -919,7 +922,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 Thu Jul 28 07:02:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2277 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 C20CE3F013 for ; Thu, 28 Jul 2022 09:03:11 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id g15-20020a056402424f00b0043bff7a68dbsf547292edb.10 for ; Thu, 28 Jul 2022 00:03:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991791; cv=pass; d=google.com; s=arc-20160816; b=vtsZ9T0KrZjeW9bs85toizQNXtP8j74dO3KZPwYyHOshkdsp2RW+DmCbpuckfvfkY7 o+3r3I7AFHJCrA+TkygBILit18DtEnwu1gnIY7yXn9L5YWUlrNHR45FgEJs/DG16DSym VxaCQxdl8o5qBARJSbH86pzcTa94joieETdF3YWfEPOgYhsOF176MAqfkmv1LF7n4t7T 0hRhvPVrTjXUzxsE6oDMgDqijUC3A/9uZeNLQxyUCVwXii9bQrIKJERpN13I79DKl+mb d6WSRe2HRhlTzMJQJFOQIiZ/wEDVbjp+N9SoFTFq2SGqVYr9wIOhfwqjh0KHN5RanVw1 Kpcw== 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=dFdb06VZCuWHvIOKJPwhd1ruGc7GT0RTyPL3NI0kd38=; b=MeQBn9Ja+SuNShzACrP9/+rPDTjMm9quHcv/8FigTy1HaH7SgAvGCiSv2O8bmeTvdH NCQtWlD1bqLKA6tvZjVVnnBwMA2V0+bWbAgrJI6m3F+4ffpKEhXJ72WGNVfV00foHKia STIGL+h9n7Q0NNWrQzMsUvQjiEsEmNVeJN7E8Qu9eSfnQ2TasgV6c4k66Fhjx9Je2ehr cRpJb7VbRwgm39eltLqPtsZGx99HGL2UuUyMuwFOGXLO6RmdBp5sizRG7TxpKW3gcx06 BQFqVQGW4t7wRkedbHM9qWg2LoG4J55ABrXi9P+W5+dlPjQjD7vTD+gygsWUX+nAuYxD 80Uw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NixWIxUe; 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=dFdb06VZCuWHvIOKJPwhd1ruGc7GT0RTyPL3NI0kd38=; b=GAY/nsPN0E2XYak/jV6JDkxikA9UqWi9uE1dbPbQOndvdTd+iZmBBATopXyC2vXvjp 8mZyEs/EKP+Fsn8d90Lb/joff44uyaaPoLDJikytzgo1o0xwcnT2mVOb1yDnlIk9ScBT QfThqV4QoB8JAJozF32cwcupT5HtFyhU/w3Zc= 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=dFdb06VZCuWHvIOKJPwhd1ruGc7GT0RTyPL3NI0kd38=; b=pxqIFpjNCcISmnf4Lg7uNsVupZRz/NtppOy9iG2yfJ534fRTGZzhz1kooL6pmOdy61 h3eOqNvg2kRXeKc2fNfOYP6Zom2lAk01wnxdi8UgDsVB3J8/2VZ6vdbj1m5IZ+s3GGrg uNjRzvr+Kdc4PlLD39rLueYaPBbjYfsr6C0yjvKAIjFGB4IAeeaA5+1YmqBDjTbCNtDj 3vcghAZUEpn1QQYyjoi/Bce5+ChnpScpWPlHGaCV+RXpwiKX6JB3CqRlSSLHu0zpxWmx Fi/PhnwPOPPDN2b/xSenhhfpgzqTFV5IpfYlE6CTD4FYjg4wCMzMFIvBND4SCKj3jlX0 kF/g== X-Gm-Message-State: AJIora8QhjMZVvhmTwpO3P4E+wbApN1vRxAbStwpSsrzcjh1WV77+i0Z gKQXAGl+8oIsMU9hF3fahrER2B0s X-Google-Smtp-Source: AGRyM1t78D0tD47VkLUKSDpz6G4jvvigUYdNla2Pf9ehPjRz0P60pytbdQm7xTkK+HsRjsqOK9Gx2w== X-Received: by 2002:a05:6402:168a:b0:43c:c76b:25ec with SMTP id a10-20020a056402168a00b0043cc76b25ecmr4643910edv.47.1658991791568; Thu, 28 Jul 2022 00:03:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:1e90:b0:43a:77a6:b0d with SMTP id f16-20020a0564021e9000b0043a77a60b0dls944234edf.3.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:10 -0700 (PDT) X-Received: by 2002:aa7:cb58:0:b0:43c:e7ac:3567 with SMTP id w24-20020aa7cb58000000b0043ce7ac3567mr1585175edt.110.1658991790385; Thu, 28 Jul 2022 00:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991790; cv=none; d=google.com; s=arc-20160816; b=wWXpAOFreQTG873drVAYnswn0jZ3yGjrU+dVn7WonTYkz4bKhDWD9woNxuOfbQmhiB 1/4cZ3+KPaj+ILetz3ka5xqi9iXdMcnwPnmKyFeT0R7kCkz1MD9GrsX5xr5BwV9aptSU cFu1z+BflGeCGCiNhdLUMLfWOpqWcigESSVqPv6CO89ysa7dvNZudS58x2qzczpuZ5vg Z3EiZroWoKZ+ewaUSYmWrxxfRwCmTLV/lJYGaMKh9J8QCqUTQcCoQtNGAXA6TFKe4Khr Zwku/ULjHq4whoaRmhUPvlokFsHY/m457ImZEajxKoiNTByWCayd+/9+qsHhuiqRprf2 cGlw== 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=aNGQLRTnPxlP6A96D7J1ivHff8xTlXOO4TAacZru318=; b=hFoIfsPakVtCphgRL+T2g5CnD/93udPWExaXxQaY0GuH+o+uqSrJh2ZJYZW+T9rHo4 WXpmc8RrD4g4vWIQEAfWsAvuJdf/xXsIVyADmjABGuuXLWKn0kXGCmbjvpWn5rHzhdM1 bwJpzmqn6+L2R5gt6fHXQTUuCQTXhv4DLFUsjhbxtQ/e9ZzGDlgrTbVGpEWechH13Bba TWT6HorsUtZ2TsXf0LcPBZL2NH7Xp74A0/jatpws13bOlZoJOFmNLWI9U4b5oUX8chjp O1yAVSYfW3150+0AfSJJ5e5SoBnbTPIEn9anvt0GJrp1oYfbQPnk1o4lINkBkt1eWvPx bgOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NixWIxUe; 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 3-20020a508e03000000b0043b2d1d8528sor115500edw.34.2022.07.28.00.03.10 for (Google Transport Security); Thu, 28 Jul 2022 00:03:10 -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:2b88:b0:43a:6c58:6c64 with SMTP id fj8-20020a0564022b8800b0043a6c586c64mr27065401edb.348.1658991790073; Thu, 28 Jul 2022 00:03:10 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:09 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 5/7] can: slcan: use the generic can_change_mtu() Date: Thu, 28 Jul 2022 09:02:52 +0200 Message-Id: <20220728070254.267974-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=NixWIxUe; 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 --- (no changes since v1) 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 bd8e84ded051..d12d98426f37 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -742,16 +742,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 Thu Jul 28 07:02:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2278 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 EDD1F3F013 for ; Thu, 28 Jul 2022 09:03:12 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id f13-20020a0564021e8d00b00437a2acb543sf547594edf.7 for ; Thu, 28 Jul 2022 00:03:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991792; cv=pass; d=google.com; s=arc-20160816; b=ckli8IMQ9FeNL0WH0MiiaWhwGu6DUQIx2goVIvZZs2ZEoXSTOwZfqFS5jjHggU/JVA jb0nA43vD1WwCx6FhPyYDEL1AsgkvTVuxwTBHM/hGschWexGQV8V3Hx9W/GEJh2d1vgB I68bORY2XLZEppzXSUCtTRdv93F+3iP7z9UrkFWqya5LbtuHp7lg9fj46rX7jTL6oo0m aLPc3zaMJJIQo4CvCgeDttEt2ho1e7Zo6oNslUAdIjQ/MTHOJHGzR2qkszE9KAgmQbfL DnoqKyc+L4KW0sK81SRgXyq6qWlarwgJe6js0/WfBCVD6iEwheobX9ROUhRgcW1YnpcL hm8Q== 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=ld54SDtYXLxUGopup6ScpeTylocEzEsXm7cbEHLuHgE=; b=I/55EAquJsZhl5PFM8DmlqOpWPDol81iHts3LGagiUbq0mfR0qJg7hw+AWGPSu3d5E ua7gXJKeoeIegLXuXbbtnFCNcK4U9b98AJCQ0DiLEa1d+E3hBP2x0jKhLNVMUvt6uFCy hngb5F3Gg+s/cGCAORCV5qQnecXLiB9AcOQfvwihcxYSIhoPXOWRoQ6tMmUxLB2+EFw4 ZgPQw08rUCn2CbIXdtRAHgcS2HHTTeDFTrKqbXqrqbGAvBeQ7PsCxdHbQ+kUgM/m8l/K ZSuq6NiBwHzsX6nlsoVVPNP1u3jZY7eN1X+2yKHLBYFp72rn4anQFSXKYHbPNlVPkzOK CnJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=C7FiLKyP; 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=ld54SDtYXLxUGopup6ScpeTylocEzEsXm7cbEHLuHgE=; b=VBxYhuxJ7f8sjCyNPVDng3aTDMGVZtbb9SnmfKGIfZ9iEPVDDGIi4SjiETAj9QqWyf bPhPVoK7uXVYGSzT03fSP12MPHbqptYfd2/1vXYeAS18/eebo1+XQXD3DlTqpCCIMj5q g1ErVqX61UNWBwefP+7Q6BDoVra8gch6l7xPg= 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=ld54SDtYXLxUGopup6ScpeTylocEzEsXm7cbEHLuHgE=; b=GLpeszBOEYboRHHAoCnIujgYDQjhkmLiKZkinlT3ZbuJfIoanFDxVOcSDkcA4B+qSH dAo9j2aS7cLOtJTZSr+9KR00qjiJ4XOjZb974BgENB9gYDoY2jtcyWIQqIcgJvedwQ2I WL6rvRN9U9Gfeqhj4hyRHeT1BnbKDDdRZf2JLubabw5gDKQj+g0e7737zSfcl2vasKoL ZhDR7zKzmWkrok05IULS1bam49+E9PiqsxiW82jNU07Vd6yxbpfz/4hdOg7p4Q4nElJP mn68n4m+xphOP1mQUPNkX7y71g+xgTNCYk9M8ywHnzPVqqoK4WYhDdLixTzceZr6D+N5 /zlg== X-Gm-Message-State: AJIora8ulJB0ije42N8lkqqStvatszTQcrL6VFoH/DalBrqdK3qjFZQT a7HkXTGWDIUG4aQZ8vVofTCrFc7w X-Google-Smtp-Source: AGRyM1uyCMgPB1NAmwUVw8mkRwm7y46XxaItqZzH6znyppELb0O6HWBX1GIcPD9+xfvxZiskZi3T7A== X-Received: by 2002:a05:6402:27ca:b0:43c:2a52:a90f with SMTP id c10-20020a05640227ca00b0043c2a52a90fmr14999784ede.328.1658991792776; Thu, 28 Jul 2022 00:03:12 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:35cb:b0:43a:7c1c:8981 with SMTP id z11-20020a05640235cb00b0043a7c1c8981ls979353edc.0.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:11 -0700 (PDT) X-Received: by 2002:a05:6402:26cd:b0:43b:e3eb:241b with SMTP id x13-20020a05640226cd00b0043be3eb241bmr23313396edd.133.1658991791637; Thu, 28 Jul 2022 00:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991791; cv=none; d=google.com; s=arc-20160816; b=tIJy9PuVHfO1yoSdWUOXVaFFfiXfAAYjh9FoXv1N7qDbI82VkLmDmCSxWfs+zO6LnP 8WwOHLJ3YSt2kqz31eX3IjnhdZH7Kt91mFr1Sru6V3Z7uc9/7UoaUtp2qA478XsiQtH+ 6VQcQEdqhIES+tBN+sjkyuD9B+p/2yhAXL2+YV+Xi7m9dBkVWTmxgia8bCQyisDzyEjP x8kReLTPST6utilngH3aiZ1EAf691l+aT6KkEvDqUiEJ3E17PxwoZtO3wf20srhGjQLs Yhu1P0IsmP9kgwaLvkHL1bsSZdAJqyIlY1vzd96RqyrgzUCuiqZniObK3/Xih/cfMGLf P83g== 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=rbjoK64u0Nv21CxxlQFKwTPmVGnv7nDMih2pZ9805sY=; b=CQbUwP7OW0FTt42RDGtae2EROY+4zXjG0SF7gwSFs/anZsPVsI3CRPgI5ndJ9nThd9 OYSt0aJ0Gw9bw53QO5vs8fwUErFKp8dTAF792V9+X+GVkVftz3NW+VSsBN5a5LmM1Mnm IB4NNmiL40xxnvbAOkqtPlSY3yNFP6VfubN2BmKFr7uqPbOJNVdZSc9roOR3fzPbEd2m Fqt+YWvtQzahAF4UW+Oei110eN960jbkX/WoF0QVSIBaPscX6veE0UHVT9jrFGCg63Vp tRA2muC38FSpt0jvORWkZTowN0R2OI9n3TrpA6ye9qC351fKfh+rPvCL6cyWfgZlGbnN wdqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=C7FiLKyP; 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 i27-20020a50871b000000b0043a179a030fsor124002edb.26.2022.07.28.00.03.11 for (Google Transport Security); Thu, 28 Jul 2022 00:03:11 -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:194f:b0:43a:298f:f39c with SMTP id f15-20020a056402194f00b0043a298ff39cmr26569587edz.106.1658991791472; Thu, 28 Jul 2022 00:03:11 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:11 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 6/7] can: slcan: add support for listen-only mode Date: Thu, 28 Jul 2022 09:02:53 +0200 Message-Id: <20220728070254.267974-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=C7FiLKyP; 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: , For non-legacy, i.e. ip based configuration, add support for listen-only mode. If listen-only is requested send a listen-only ("L\r") command instead of an open ("O\r") command to the adapter. Signed-off-by: Dario Binacchi --- (no changes since v2) Changes in v2: - Remove comment on listen-only command. - Update the commit subject and description. drivers/net/can/slcan/slcan-core.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index d12d98426f37..45e521910236 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -726,10 +726,20 @@ 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; + 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; + } } } @@ -816,6 +826,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; From patchwork Thu Jul 28 07:02:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2279 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 526C03F013 for ; Thu, 28 Jul 2022 09:03:14 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id i5-20020a05640242c500b0043c17424381sf541305edc.13 for ; Thu, 28 Jul 2022 00:03:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658991794; cv=pass; d=google.com; s=arc-20160816; b=VFFgSiLLOy0eQ41foxOl9YjoJ01AKcavrM0GkMYU6KvC5M4Lxobv24E7yD4Aq3XV7L 6xevB7G4x3Gg5wh/DEHevc0u3SZisr20vxIh01u0Ru8mxC/GaEnfaNqYU9e09hhjqKDg TmrIbVANM/xtcd6qoHYBYoSMB9iYq2VpPfc37qsi8cVU7POakbe/ZrkU7AdGs/zh5YwR Itmd9bNXrWdKJLpgGba08ZurTAcgYyPiRwlfjRL2e7mRnh47ZuGl9xzyFWWxfXaflH5X wrL7KWDfOY55s4UifSNGe9upZDCfWagAJX1BFvHvQO7B2CR46MA3ZCu5b7hBypJTqPAH 1Ugw== 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=2UbRJCd5jKxMvhc4EdNvM978SqHo6GIw0H5alc/PFa8=; b=hjQbBpV20Emh/0huaS4b+rfPGQMFuTMPmBBxnT/IgF/dFtfDFK/2LzgQxpV8vPNl1i TV5C/tA/b02FSCU5E/8C8g/3jszn6WAeNh0JVObXBWj5MvECxJfb6Uva1uSGpo9cjC5b 7Qxl0oDOCyI2yQ6lndyQpwdrj77G8Vhi2hlh+ZnL+aSqRbmL+u4UDYdM+a+I5yHrP3Fh M343utqXMwdvcFNe4dRhFfEaODyZuoF5AiBvxUNSv6rSqYtUNdlGgU0frWix9cIQoAy4 MFeQ3myG6cZhB3znVQDrtfWjwmUPNPUJ/3zAHSlaAZALektq9ReayMkFe08xIAmTfDuX H0/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bhtAgngU; 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=2UbRJCd5jKxMvhc4EdNvM978SqHo6GIw0H5alc/PFa8=; b=Wk/66snLdFQ6eXYUdfQedVAhmQVpQfSnzEHx+kR0cknBWwKYAKcMxp9s17d888khyH Ng9bKINcoOyzVwAIirYQqaL0FDXg0siK4s3S5fCD95JzsjYA0suRxF8etJF1xEpzldN+ xFtxb5jhL6P1vual9tOw/VFmm33203NUMP4Cs= 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=2UbRJCd5jKxMvhc4EdNvM978SqHo6GIw0H5alc/PFa8=; b=4musTJ63T2brlN7SsWX8UXBnSsZe0O6IlQgS35PmKuZTz3b3OzRjQZKJdubACMuiEF foYjz51DESYcrBVBhd8OviNXiBVoC1kaDq2TDRK4rb0zALceJMstl/cVasCY1US6maJA uylPcCxQPt7Lyq/jxvMk1VbUATZ+7uk5Moi2VNHLEZGJTsefElT6pFPdTvaqRoclSnDT FQRxKW846LCTuFUbkNT2VdsZKRUUX2FtZf54GV6jeD+FWjaFpPliTrNIXVDFJYYI5rRv HLi1q1kETnpAdSuIj+FNS0AqJ88i9EpMpbarI/pSr9DJYjPcnnCDoruxk7mfJ2XPK7ql g3aw== X-Gm-Message-State: AJIora+ejhDyZ9WDwkc16yC4CVZ1D1yKgFYiAJFdv8SqHWfpo4x+i9Iy HCtxcYCt3s2kj6x6UnhyteFFoVNB X-Google-Smtp-Source: AGRyM1thphgLjASpyf8UFbvyKXEjXWVyWujCqUwUg6AvgnRM6BsxPT+HsSdkfUwkWN4X7fqlGE4NAg== X-Received: by 2002:a17:907:a427:b0:72b:8cc5:5487 with SMTP id sg39-20020a170907a42700b0072b8cc55487mr20005072ejc.354.1658991794196; Thu, 28 Jul 2022 00:03:14 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:6d0e:b0:72b:41fa:b554 with SMTP id m14-20020a1709066d0e00b0072b41fab554ls413656ejr.10.-pod-prod-gmail; Thu, 28 Jul 2022 00:03:13 -0700 (PDT) X-Received: by 2002:a17:907:168f:b0:72b:5571:2228 with SMTP id hc15-20020a170907168f00b0072b55712228mr20130807ejc.397.1658991793119; Thu, 28 Jul 2022 00:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991793; cv=none; d=google.com; s=arc-20160816; b=oAyhHndC9P2M9MgZBmBSpsG8kptAfgoh8dAb4+7jIuuZEIE7urPa9LJu2xTQG0C8bO yaQqArn3iv3sx++OQyqwCDd+I9Jjhy/OMAxrEVArY/MjSB4GgL3qMrnSE/V5RshsxbOW nyqsYyC03JCJBPgBhzEhOwgHj5JLPOzbzUbS/njEHCrKtxu7byXQ+NiFGYVAbOnyl7vq FnvDhWj5jT1NXeAfF8A2Ma+lZgdEDe4CuziiMx8GqjmBjVXZjiYxuilPz2o+mb0Me5eU UrSdaTi3qv6pSeSjxn2I3wkvlYUKQy43pg6xU3eXkgb3tfVhD1AfyNLtROSqD9Rf+TW5 aszA== 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=fDjEmDyORVH40LT30HT7nddNnjTd9U3ufOmG3gtdwn4=; b=mIcRBYOfPsCPfRWhrZ8QEZjZMdhFKAs39ANMcx6ZqqSIaehPEErcxeGI6azujQ/H/t MyztBY98towdUhHgaNhCi0xs7pT/GdAg2JxOFhrekRFUmOL1WwlK0LdZrcWHVt1zFFPF qVWC00rXlscXVakOvQJ1IWGleJy0IsbwOQYupLCWTUivge/kR/HFefe/MYdygebyy+7s ArxkdFewEQbnjZx5yVmpjL+fd7JIDdbkDU2UIs76hLLRRGWNJ6MBqs4uklCn9v9TMih6 a0dMERzg94TZA0rlLOe5OWjnjb4Zvlfqe4qZvrZ/MNGqFlR0B2gUplOX+vBKPxSuJQVY /odA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bhtAgngU; 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 q22-20020a50cc96000000b0043cdebd116asor116544edi.52.2022.07.28.00.03.13 for (Google Transport Security); Thu, 28 Jul 2022 00:03: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:a05:6402:54:b0:43b:5cbd:d5db with SMTP id f20-20020a056402005400b0043b5cbdd5dbmr27268474edu.264.1658991792820; Thu, 28 Jul 2022 00:03:12 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id r18-20020aa7d152000000b0042de3d661d2sm154742edo.1.2022.07.28.00.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 00:03:12 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Jeroen Hofstee , michael@amarulasolutions.com, Amarula patchwork , Oliver Hartkopp , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [PATCH v4 7/7] MAINTAINERS: Add maintainer for the slcan driver Date: Thu, 28 Jul 2022 09:02:54 +0200 Message-Id: <20220728070254.267974-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com> References: <20220728070254.267974-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=bhtAgngU; 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: , At the suggestion of its author Oliver Hartkopp ([1]), I take over the maintainer-ship and add myself to the authors of the driver. [1] https://lore.kernel.org/all/507b5973-d673-4755-3b64-b41cb9a13b6f@hartkopp.net Suggested-by: Oliver Hartkopp Signed-off-by: Dario Binacchi --- Changes in v4: - Drop the patch "ethtool: add support to get/set CAN bit time register". - Drop the patch "can: slcan: add support to set bit time register (btr)". - Remove the RFC prefix from the series. Changes in v3: - Put the series as RFC again. - Pick up the patch "can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names". - Add the patch "ethtool: add support to get/set CAN bit time register" to the series. - Add the patch "can: slcan: add support to set bit time register (btr)" to the series. - Replace the link https://marc.info/?l=linux-can&m=165806705927851&w=2 with https://lore.kernel.org/all/507b5973-d673-4755-3b64-b41cb9a13b6f@hartkopp.net. - Add the `Suggested-by' tag. Changes in v2: - Add the patch "MAINTAINERS: Add myself as maintainer of the SLCAN driver" to the series. MAINTAINERS | 6 ++++++ drivers/net/can/slcan/slcan-core.c | 1 + 2 files changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c3fc5ff6ffb8..c82b6e74220e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18450,6 +18450,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git F: include/linux/sl?b*.h F: mm/sl?b* +SLCAN CAN NETWORK DRIVER +M: Dario Binacchi +L: linux-can@vger.kernel.org +S: Maintained +F: drivers/net/can/slcan/ + SLEEPABLE READ-COPY UPDATE (SRCU) M: Lai Jiangshan M: "Paul E. McKenney" diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 45e521910236..f079c8f2296b 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -63,6 +63,7 @@ MODULE_ALIAS_LDISC(N_SLCAN); MODULE_DESCRIPTION("serial line CAN interface"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Oliver Hartkopp "); +MODULE_AUTHOR("Dario Binacchi "); /* maximum rx buffer len: extended CAN frame with timestamp */ #define SLCAN_MTU (sizeof("T1111222281122334455667788EA5F\r") + 1)