From patchwork Tue Jul 26 21:02:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2252 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 828B23F0D5 for ; Tue, 26 Jul 2022 23:03:26 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id v9-20020a056402348900b0043bcd680e50sf8019724edc.18 for ; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869406; cv=pass; d=google.com; s=arc-20160816; b=dojEO6roLQlTZZ0IU45QMFZ0qaokmp0Ee8GoMeK66aUinMXCBMreaElT+l9fC/1n8e rUsAlP8S+g+XTgysvdo4Db6h/J+ZZ1pXcoCe03j+Ro8oIeWPWZRMqXA5NWRGg2f+yOF+ Vpsaq5EDwkyTq8XB2r3BLbj16lcsD2HzhXOtqMFH5XRqxzs1wNPxnnXhV2s7UcGJeBxc KFcgPDN/zbwtBw9L2ua251BaknHJ6WP9qzwT+4RhqAHxarOI4jTQS819XoMcchNYfmV4 PR6NBGtLkcNs8r3sxGOrSSrAeTyy6gdZfNipFbzcBjozTsi/PCRnwUNR6s8iLthKMaIl uC2Q== 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=HXLVvazcsDzquk3hy6c+bDxVue5h3OkAbn7lCPOPdmSJbade1TPwBLP21jACz6j9DJ 5kToTc/t3FCjMOcxFVmIdXVoSJdomf835VQIex5mdf9KRq5V5il5wIcdFkVIck8ILE8y 1o4SiHcoH7XesgNUT6pXhfzBsfdw0Pz/Wi9UD2bMu11FbgWZG46zR6dAZkt941arInH9 lHf0LntbzKJyi/XHqd+8eUDnpxIKa2WxtkaSW3x8hKq7JoCoM3dYttjLJFl61a3mrCnA 3m4wG8w0t8DPYqPk/ngcj3ZJatIizqKbp8IpVCGkSVK/JZlXq1Z/qftVnTdmvv9JTOBB fkUw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=VlEPTxUO; 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=qEEb1ZT2UVCmjD7QT0dl+t/V3wXZH36i4H8k2ffYNQY10mmp1XcJQmYR8lzbQdCjRi oPA0b/QsGjDptcTs5vGEad7nhyAXvzR3hMbU729aM4LZxu/6AWmuyNUnMrXzJ/euWOmA YqOUGWDguGgY+7rFjF1FQDPZIZD+vjptqcCrY= 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=gzM1E1rdWidjKO8jrOlkXzu4P4Hnd/ZGhnJY5pr+vIVmFASma0rJsVgj4qHJpAu4KM V0WIcKogfB7vPw7osITtDK6j2hipSMB45t51QLTHHb4/vXbWoW3TJvqKUoxPqUQdYBW/ vXxn7/Ob5LPu8OAbN3RMQXQSnQZRPxtN46UDEWZkqqgT+7nqAnzridSP8kraqPthmTPm O7Nu0dxDFdYOjDtYa7W3SsNW3D8f68bpFAJONBlYg4RaMvMUDpFbA9R8nx/SSdR6j0C9 XFLGHWjtVM7qcvV+1MoZea3Im2HfSfdALlli/4VqccZNGL8Sf8ZQSQR/7k+523AGvTj6 o1Ew== X-Gm-Message-State: AJIora/qTm1aQFkkQZYcvi5RWlfvij6MTQMOgAqLoY9v4bADnYbvoN7K jE3xbTPhdgbCEKJadrwgbfxGPro7 X-Google-Smtp-Source: AGRyM1vP0YajOIrjqgYJt4WWC/1WbLwgaIVX19U7lcyfol8UdSc/ZYf9PNIXgX4Og3Jc70e94BlHfQ== X-Received: by 2002:a05:6402:414b:b0:43b:6b1a:c230 with SMTP id x11-20020a056402414b00b0043b6b1ac230mr20274062eda.42.1658869406341; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4248:b0:43a:77a6:b0d with SMTP id g8-20020a056402424800b0043a77a60b0dls1338675edb.3.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:25 -0700 (PDT) X-Received: by 2002:aa7:cd99:0:b0:43c:4f9c:4977 with SMTP id x25-20020aa7cd99000000b0043c4f9c4977mr5026101edv.303.1658869405262; Tue, 26 Jul 2022 14:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869405; cv=none; d=google.com; s=arc-20160816; b=JvdnDWCrpTRNeRNUaTdGXLXOrD4IbadwRhJzhc0A8ZsOQyRLqnIlIK0xfw8JnAvmEa G2nl8MuH9pi4puV+FQsHGmHTeIulaByKDXrvi0eA1rb6adHRAWaObPXVHDMSdY/1lfU2 +ibiqM8LVwYRTGmHMvLMdlehXR4sHkcUTfQCSKk7inJbgXLC0mv5dXmrsx9ptDshBr4t HlieRTKdfskKNGZbbTTKfhorNaY81nNb0/B7o4R7g1fxuyNHwOc+Ic/hKp1/r+lrZ/P4 DX2iSwSMEItoELN5/JYEh3oLA7+OgdQ+bWCAwcvKiT62u926pgU3eo3PO4E84d7NJxeK vcoA== 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=ybZVgjQHaJaapJOkJ2r+lBZn6hMpWHAx5ye3ATVuSgKc2qPQ+42NbKwa6Ok1JZBALV RDX3DByu1jAjpxTbWgCT3znwGcdU8YWkFpZ/fVhIjQUEekvu/eXtsIC9EuDlYDC2z1Qd hUetH4HAoe7WT/CygYNBHaAlD/Zc17rJaJbqCUVogj9InRYu/YiKaXQX8JcklqRcVRzL vDb4xO4CGGcWAUHlaL0BZC7/VIPzAQyVeB0Mat3LxfVzzfUmilloDNPK8AX3S01eZ3k/ H4VuxvCwcu0AUoL5kY1QpOYTHAAsQ+f4KC+1kgtObFlAD5elQ/m0S2GsaoWgFejUtfTP Ky+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=VlEPTxUO; 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 wj3-20020a170907050300b0072aa38d1537sor6128358ejb.34.2022.07.26.14.03.25 for (Google Transport Security); Tue, 26 Jul 2022 14:03:25 -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:2722:b0:72b:735a:d3b4 with SMTP id d2-20020a170907272200b0072b735ad3b4mr15381214ejl.363.1658869404930; Tue, 26 Jul 2022 14:03:24 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:24 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Vincent Mailhol , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 1/9] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names Date: Tue, 26 Jul 2022 23:02:09 +0200 Message-Id: <20220726210217.3368497-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=VlEPTxUO; 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 Tue Jul 26 21:02:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2253 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 011293F081 for ; Tue, 26 Jul 2022 23:03:28 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id x20-20020a05640226d400b0043c37fa024esf2773794edd.12 for ; Tue, 26 Jul 2022 14:03:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869407; cv=pass; d=google.com; s=arc-20160816; b=fqz+7f3yaH3pZ8L+99HdR+Z1XX4A/JOC3oM/WrFoFrDiQ71KrrRy8/PSepO6Lcf6fE twf8rJ/8SgPfXU3tRH+xmr4dgdo49AIj1SZGlSxMp8yZpqqbV6sUeIpVr4C/+J7XDG5J Zv0Tl6daeNmv4iooukfTYPr3z/bMeZbTM4YEBBOIlj9hY9OJJOU0EG9fyep0YJAbQp7d 07om1tzFItCA2X9NcPsQVdda9np4Z7TovWTkGfGiQ3GNcUp/elPIi45MisHkRzjvLDn3 U3qkVhajDmARfZwjXca20xi0NjR8sv7bgCdv8ICNBeD13RkELc+f7adg8Fp7yDqAYOp8 hzgA== 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=sWj5AMlkIFm1EQIr2qj7UBuc4pjP7DLsL7hDuHVOzuo22G8Ty1FwgUDpnhwlfZtJw6 5sllsFIezwUyXiobr5Un2LvHxth2cAexpv5qO6oBJ6GXTQ54YQFn96yJo3juEA+m3YXB hUEtmJQF7XvqunSljQ7WVuinBXLSLyTOHd9079Y9rZEy7a+AVEtSahmfiPa9kU+7I7ca TCTDF7Squ/k47xKt42Pk+/X7zFwmmI1zv4Flgc4VZs3ALc6HSSBKJJ+CU2H0jO60fKKc +0xp5yydx73VMEnzKbEpUATY//mwl6Q1gLjVDvlNaYvSdAEw24RX3d/fTvYlLROjRXSQ nerA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AJArippn; 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=aw0jJBSpgxMwPY2+p5Q2I/tu2DaIVs0JkXD8gZMBih5W+I3Gz0rd9UHtbzb3YRFm74 gMMItqdqDtnvBzM4tXYvCOtiEyNVkjFr9cAoHzZAvpPSBciyq7gK5lnmlpLLg1OiRH4Z s5iANBaeb0SLF03rMDoQlbtXM0ZAlY8qjAz8M= 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=Rhi5heHzFMO0Oy3BbdtTN5w5mvE8lv/C3z9GysJJl53rmIjwZzJwzwUYAf4+0XdU2n fXb4jyTAy9nKpMaMQjAuYdQU9PXSanIKL9wCtr/nncSXiBGrEsPc+Xevf3XxKEcBq87x voIdl4LDY85D5t06vFmOuoY8rVe9e1rf7Q6ywS+9nbsyTQIER96lj37n5rcbjNy8J+7t MSk8qOqQIYNoHeVl5Dt7iwjyz26XldEP9jIXFzhIacOLXVIa+hMg4yPbAwtfWhNu/6/l Xs1vZ53ohQVFi9aXZiIsnBFrSSkkzwG6sd8BR0XbWej8IJzMZAhbKipyrXWlJg5PTfcI dUpA== X-Gm-Message-State: AJIora8HF41V5bZ/ruhr1stmTKJbaJkhuvmRwBiJvFA1XyS27tpkOx+9 YLBY91rM4zrxQ97fVlMNzkmFTVoO X-Google-Smtp-Source: AGRyM1tZSTlIIWYQTr2V3VGnwrWASewT3lKzDpWTcv12hqa1QuhPV+FGAXQCNcScEWA1MjBiXAuDsQ== X-Received: by 2002:a17:907:2d2b:b0:72b:546a:bd03 with SMTP id gs43-20020a1709072d2b00b0072b546abd03mr15911596ejc.149.1658869407623; Tue, 26 Jul 2022 14:03:27 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:7256:b0:72f:6ce5:d858 with SMTP id n22-20020a170906725600b0072f6ce5d858ls1352330ejk.4.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) X-Received: by 2002:a17:907:b08:b0:72b:1bc8:19e4 with SMTP id h8-20020a1709070b0800b0072b1bc819e4mr15916769ejl.106.1658869406530; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869406; cv=none; d=google.com; s=arc-20160816; b=aUmMjG5JsK68AlJIV4Gk8lkhx6E/QHoQxpom1NQkyfcd21t9rLcELhHZIyOiWdmuy5 w+PWRNXRmPgK4T55kz5hFf/G3Dkcc/RGsogCcXWhDxbYoAWuxQaNf+ZD+0iIAiEq0E7i +9/FhuocBylSbLjXuitbZesFvqNJLtJknUOuKQR1NqKo27PIoBBwfNYpoYORd2HIPzj3 xH52J3HvKD0tQjAq1je0ykPBu1eVv3SgcQC1uIN6tV+QBPIp6Y+pSjPyNnkfOYPbW160 nQdgvSOfdm3jjtM6tfLq9BCHZZvJtCLHZFPUBkPe/GHh0kl6emTRdgG26d0P2B+RwgvW Xafw== 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=Eue4kd5gjCxJt+orslQ5FeDgeV4ys7lu1SWjUvqGsz/8p7N/3trRyNOmd2n0mIQCFi wwluNAq4R05ZaomZbTxgQMGL1iIJ+eU0hhdiwWigPdOH1Cc+vdI7FkUg2h2OQtfri2ug azoqOdOZEK3noZZm292gVCXGFVZv9ki2vZYM+LTt9XbtU11Io0NmYBgjY1rE90IMhe6L Y+YFNpl7Q1CgHV5J1iabcCu0CCE+P1OMTKjbGaoin71xpd9k12Pq/wtGWOz5xkfkVRVx sqQeHdedTEdIvq1xGWRhUUExsrolrfqmqJXsPnT5+ByPrYS0s6YhRF64+4QqgvySYdDA /QRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AJArippn; 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 i6-20020a1709061cc600b0071579acb86esor5941719ejh.72.2022.07.26.14.03.26 for (Google Transport Security); Tue, 26 Jul 2022 14:03:26 -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:1dde:b0:72b:11ae:700b with SMTP id og30-20020a1709071dde00b0072b11ae700bmr15003401ejc.520.1658869406249; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:25 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 2/9] can: slcan: remove useless header inclusions Date: Tue, 26 Jul 2022 23:02:10 +0200 Message-Id: <20220726210217.3368497-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=AJArippn; 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 Tue Jul 26 21:02:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2254 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 576BC3F081 for ; Tue, 26 Jul 2022 23:03:29 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id s17-20020a056402521100b0043ade613038sf9479267edd.17 for ; Tue, 26 Jul 2022 14:03:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869409; cv=pass; d=google.com; s=arc-20160816; b=UnaM2SqgZq6SoWhyoLtpAlKqaggFFxAi4KsBJ710WCvZnam53Jg14uJh8Jje16oMLq +5rIhjYVKMdjqwJLZLRgyNXSLfem09TspTrp8blUT0QxPOqovBqejiwwSutQp3kavyWB dTg14Jq+t57MkReGHel9SDo4t+2Xmrk9v58q+Co5yaozyayWYD/rUioHlz6cqz26VwtJ dyFAvFS51d4q9TgGxxbIcZUFXmRA4IK9iIsKCHtF7SV3s/fnoICIMPVQ8yzfCFTe5Y6g 6pX1FZPcTxYoizoSudKxHUPyUXXUWjppVIvcRwjkhEIE94JSMjDFyxEBPqmXgw7IrfCH k7zQ== 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=6S52/SMjAbIq3iYjJTQiqyd0f1ocIoSjDJF0tpOLhxw=; b=cCN82entV4iLo63V8MQPVnzyyTStlq80TeTTxnlC7YPvwc6Bze8uR0VwItv3E+jCYo HG+GSO5kS33v/sdx4bGvGb086x+nN5cLyFwnwNin5LvqcTymMEFIOaGchbi1AAMT/eW5 nbzolKgb1arIeaGBNeeygJIkeH/d/giQmxnZznNZ5hszKX8NPblXXrXkFM5pjTGCpVMc Pgf8GpFu3FJKycE9QHAAZ6R/TU6Bgn9n885Viyx5HHI277buJEXwu8UzbsbuZkopEanP fKncek9iUGbICZ38DtvSvlZ0rg9RA6arq6KHirXxT2k2UX0cHIk4rwhI+wiuiHlJF5N1 /Yhw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FN2PORv3; 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=6S52/SMjAbIq3iYjJTQiqyd0f1ocIoSjDJF0tpOLhxw=; b=kFp048+FCMrwCXhJxDN2sl4LHhL2fPmIihGmvmm2uhpVH0pPac+n9Jf7J15FuD2oFm gemuwce6Dyp2+EeM3a6Br4p0NPTOEFPR4ZcjXaiuL4LwJNu6OGTaoTphBfN8AdVtXfiU i7YJnrX7idmIFpxauL4SYmSZ9sItJlylwRr3Q= 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=6S52/SMjAbIq3iYjJTQiqyd0f1ocIoSjDJF0tpOLhxw=; b=e6oQo/Qr8JZM97AFDm6gACBY1TkLRdiQWDBK9MYBJ58Dz7IKwQcSmr0jV0NTVY/xND MuOVvPE7FfnXBli3KfXXUta0wQ7z8a59ImrcK5qAdeF+ESzfIzohyPCRQjjhlts2TiBT hJNMtNLMaICHQ7+hcV509aa3A8RUHLEY2r+xhs6lizFUgeIirruLFBXs4dMVk03lRDQ4 9ufwWjxAF45g8Pb0r8p96woBGCWEUwGUibSBSSVoH5sT+B6Hgh3cwmlT+Y8bgTafd8Lt DFCzz7J+b2GVAUGVrqpLs1MG7tPh4dMdMa4KZ0PlW7xMf8qjWaSJ7jTUsIaqMSVEUyZ9 GbWA== X-Gm-Message-State: AJIora+okrjmv/zpWxhYwlu86/NXHFHrE+5rASnSYGlQeiZV/8M6+2qK yI6UJy7rT9ikSktl1Z+QV0CMP2cs X-Google-Smtp-Source: AGRyM1vgarONjyr8XkDxQyb0vh3u0ZVJDbD1g77qc2OA5WdU5hGIdJ/MN7XuzlwJHbszn6/MEd/KDA== X-Received: by 2002:a17:907:7ba9:b0:72f:2994:74aa with SMTP id ne41-20020a1709077ba900b0072f299474aamr15419675ejc.85.1658869409159; Tue, 26 Jul 2022 14:03:29 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:40c6:b0:43a:7c1c:8981 with SMTP id z6-20020a05640240c600b0043a7c1c8981ls1337421edb.0.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:28 -0700 (PDT) X-Received: by 2002:a05:6402:90a:b0:439:c144:24cd with SMTP id g10-20020a056402090a00b00439c14424cdmr19749194edz.209.1658869407999; Tue, 26 Jul 2022 14:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869407; cv=none; d=google.com; s=arc-20160816; b=TGK0B6epCXYt1FSwRsYozwSWIjpxN3x8t3idMANCxWl975TR0IXRHAKZZH3iiRENnW MLc9IDtlxTB0sydUvsDb6OB4Uo2YSbkQFzXPpwRSLqjULxds7wtn/x004tzW2pcGrbeH fLNHZ+ri9OoitdFG23jINLTooDR7WcDEvOXaHgolnKFGUDRQCUcduLAPb62qqU/m7MDX LN+Llez3QCLUFiGrf5+LUEReRLDVxMCkvqblPBuY0dKnJds8JYoBVP2yz4NpbXSpEt8I YB92vJ73jJDjfnWujbU/x5QLqzjrU5Nu5uf24Aj/BmwozOx4I1OLPfUJkpOrCc7oP1uG feNQ== 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=/ac0Q7GMzAEMsQwLaT1dVDiOWbMoyTjs+XySi2clUug=; b=KCkoL0A3kYO+Rm+3zRTb2tE9LK5Oh2krqW4aq0NW6aoGfnadl6hcqS0/OMU9TpZWux B8n6MF/2Qs9jwpcrhCQq5/vm/GwqJg/w0hDaOGL/0jSGdxGVHDlJ+xiJhT+N0qI44TuH zlvp6eCVieAsXO/27ivTOCNM5BnaRaEoHyWMA59EzS98mZBNneDKUcwDQIaW3ag+CHkp krCpVGv7cVJiUsORiHMCxdW+LQ31d/G3ZvO1x9yNB/3kkechnR5zHjGjcgW4JbSwxtXX KnikCbkQbVvj+79yy2DQj9Ex9Z2Z/ITzUcq1VYK9i60IY41crsPzauh/dgmk1jMejZ+v fTwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FN2PORv3; 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 mm23-20020a170906cc5700b0072b4c50a9c0sor5919072ejb.66.2022.07.26.14.03.27 for (Google Transport Security); Tue, 26 Jul 2022 14:03:27 -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:6d01:b0:72f:53f:7a25 with SMTP id sa1-20020a1709076d0100b0072f053f7a25mr15070081ejc.126.1658869407603; Tue, 26 Jul 2022 14:03:27 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:27 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , Max Staudt , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 3/9] can: slcan: remove legacy infrastructure Date: Tue, 26 Jul 2022 23:02:11 +0200 Message-Id: <20220726210217.3368497-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=FN2PORv3; 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 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 Tue Jul 26 21:02:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2255 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 A11183F081 for ; Tue, 26 Jul 2022 23:03:30 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id w5-20020a05640234c500b0043be08bb082sf5611619edc.9 for ; Tue, 26 Jul 2022 14:03:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869410; cv=pass; d=google.com; s=arc-20160816; b=MTNdHUNRf6Aesd/zuT7LqcGzuddoIANp3L7X8vCLyjMSj/GTAUBuJXokQt0/Y3Zj5p DXX32LWuwslQcsV0G8GFB5kCJSI2FKDWE5ckdlJ6feSCnJR46XaJCvNWEd1iAF/wVF7K yQaTjRQkgGgqpKG8K+GB6VhfpNx0qqqmCNhJ6EC9Y8azYlccpylrZr10dTV9xot/LU6o uItXB1ptysvc27d4G2KHi9twChtPC237uRyRaghKiVbaaRNYhVwHSvHA4PO41eXR2TBL R3r59R2JNrhbYkgpjw8DDyb0k/rFv2n2BWXk5GnXbVzL6dDHkOxk+stU6GsfyYUbnsY/ 3BZg== 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=xpe8JpDftO0Od4BHRTdEd/AeCSDsMUcPLoIbHe4LSvpbCaCYw5G42IJoMn9kz+NlXH zRsC7bx6XjT+EcIiVabUz0clE+ts1jDoD95XHGkHHJmMa+3G1jKAjxtula/EtIGyi89O mgSmpbhonbtyJuQtRHrjR22eN+9BcKfxlcIBQviK1FcjV53Hdifg0j0AyuP7wUTUh4Cf +743Tq45Qz2iLIDx90TJg9v+ujgSpzhjcbuEEqlBiMpinAHKG0CtDg+emKuf6xIszOBF 8ZUwTJQuxOOk20QdgV0XA7Mba8F5N3pTA3RB7oQUe7EsrpD/6VJSQJnrdFyKSB8nbqUR vSow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JjIRB3L+; 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=cW9ahzCm7WUZ+HcXm0wYgUZxIDhPuVkYHrRzSHFUAHWaWWB1rlWXs2RopbRWFGiVVo FR7kQVgg6PfAiIq6X56V237pinNczqxeGgJY8JjntnQzkjlZREE9vNKoxCmvXkMKqf/h Y9257fNX+P2q4x/grfs8ANcoxSL8107CE3SLA= 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=IBx541xAiWojCLxElW6BWEHLiLOT4ojR95q1bUPRmLtvuCBbI+COP1LfkcFQr9nc/S BehkDxpPP0bnqu0qo8YN/gCpD1yFLMdSUKMiOk6P1J7eCubiH/e/Nf6fi4goYb7+OusS zoP6WtcsvlhJxmh70prbvupURDKlo+gayR0GQUTaoZGd018xaeaFTI+esBr0EPD7X9F5 H/ycexGM9Okgx88eeEBZNNg1yOwfm7j+KRsO1DpCrx+smpBkOh+a03T3rSkQs8+haF/9 wuze2Ae2fR9VpkUvLbQCkn8YcdgSO7/mtGQPmB39EdH+dpFwfr8AhSlydxZUY+ushD+t vIlQ== X-Gm-Message-State: AJIora+JcUTX87/xjWr3tBAru6t+mGp8FSVnGAmeEed8QHUkJSyIXtYi uDf2OjrdZe7oCG5bgus27mXGhQHa X-Google-Smtp-Source: AGRyM1sojHnNu5d2e1mxAvPUaNrm87g2V8R7e5xKC21WHIQ1ASs4zChm1LwhFYSh7yxaJKQAP8mwJw== X-Received: by 2002:aa7:c052:0:b0:43b:74ab:aebd with SMTP id k18-20020aa7c052000000b0043b74abaebdmr19872088edo.164.1658869410431; Tue, 26 Jul 2022 14:03:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5253:b0:425:ff69:1a2d with SMTP id t19-20020a056402525300b00425ff691a2dls1337126edd.1.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:29 -0700 (PDT) X-Received: by 2002:aa7:dd4b:0:b0:43a:d508:7cb9 with SMTP id o11-20020aa7dd4b000000b0043ad5087cb9mr20354105edw.218.1658869409313; Tue, 26 Jul 2022 14:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869409; cv=none; d=google.com; s=arc-20160816; b=EfCx6sTLMqc4ZaikP+/KRsxn16uSUiRTmW5kldY3iWixzPzJCfYe1wQ+viKrD5qaHr eieR6K9OuAl4K3eAF9qZxMsZhL1WLJ2Viq+50+iJys+eUCVK0XFawIY/CnYacnQCzP8t OpD8GvgL7QfIOAHORQmXWTP3wsMVng5ya7Qt48ra3lEe0NUlHn/IHp2WzNwEKUQ8F3Tw TLPmgAru1zxJcYoantEY4a6ZBGdSjZtHqVoUdlS4LXsh9lxN//mfuemW5QZuHni/wPMP mNG0j4q2TZavr2OQ4iMZZeRAhi70w7TOzj6MY1SkDU+lmua5lHWUlxrzCUjkK0dvAvwX QjOQ== 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=M/aVlMzQR5ZzlpDyA4i655bgV0vuaHf+nG8nx+tvmTNpR7udQQx8jHTYNxcZvTelLP CLque697/tLQvhRj1uo+W5ojxlZTFA1U3wlQU98GcKhHjfErDBRMU7kMJajbYc5T+NnD CCIs5vr8WsNNusb7tUPl9yRuCauc+c4RDxC8Df4J6k2/VbRu+unSucqCfPElWFqASaDw +kA4mtL1Zhv19RQ3h8MRiu5z5+aSm68o7eKep4UJ8tnSZpXX6hqciQislXYLR4UaklqN TOhGRLs47TsKGxWEuPPvVuuAolj+dS22owkZHzxJmQnZ4ljiMbuLH6HEdBbw22/tt6Le Bf4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JjIRB3L+; 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 o26-20020a509b1a000000b0043c8e077932sor854108edi.22.2022.07.26.14.03.29 for (Google Transport Security); Tue, 26 Jul 2022 14:03:29 -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:5508:b0:43a:896e:8edd with SMTP id fi8-20020a056402550800b0043a896e8eddmr20002251edb.203.1658869408977; Tue, 26 Jul 2022 14:03:28 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:28 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 4/9] can: slcan: change every `slc' occurrence in `slcan' Date: Tue, 26 Jul 2022 23:02:12 +0200 Message-Id: <20220726210217.3368497-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=JjIRB3L+; 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 Tue Jul 26 21:02:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2256 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 BAD6C3F081 for ; Tue, 26 Jul 2022 23:03:31 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id v9-20020a056402348900b0043bcd680e50sf8019817edc.18 for ; Tue, 26 Jul 2022 14:03:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869411; cv=pass; d=google.com; s=arc-20160816; b=mCvvJucOefd7VpQYFFIngRS6I+AKeDnpOwwBvsk7/ozybMt7RbcWP4pglekv45tcaw pTbg/k1HhY3GUFgaRtjsD1WobJfEzsULb3g6q/xLKuFogSCy/2taBJzwk/fBexfetHxC xweW+HHt/Z44JVeyelFVlQdjpO8ipgG8jOpcmUNTgfrrUHBJMc+Okv95AJ61ZP8GPTG5 0PzmfP3DZFCSIEOZsd0W1vyUfUYocRrM4vNUzaH30YXPZScjztPYAwRE4uY94OVrwItj se+VrryqzRitcALHkXIdKCpTbOwFj5/MKQuv4mwFWCmDPfmwbA/u0hrJEyP3pC4UBvlG N4qw== 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=VfPQW+yQ4kJe9PzBaTpUZyYVZ5WufKyhpf2vMx7YJ7/3vSxU74gH0zhk9i6AxbgiW6 Q3NKcD7Kcqj6EHZaNa/SYqZfX2gEURlwJaAD+SCl2zdG7aqUxsG1pIVeMZIVfC9DaaoX jMUUHUS4vVK/J2g5P3TB2OR90AbvrJllMnkp2d9epL3/0DzrFOZDtJcxgelwu+js/sY7 LJywWyWgUNuu4P0sfJeKGzcDbTLFR6cHwm9uskJ7QSeFjQcaEnUh36iIxgdNoaBobVwk CAdcrdS9xfR6KSi54NZmys5r9E0rkcdQTeE18NIM5Jczqr//nyGGDkxHPCLdD71lk/Z6 YlSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KECnBmgq; 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=O9tBf7veIjjq/mrPMIhlM+d3D5z5ckgDlVz/179r25kfWidTyToBGpzQgS75S25qgx Z85IFDefvI20kuSOuZUAA4R8gbv+EVReoNfWX7+bKOLQttiHnjFYJn5+cXByo+jGxXDm GFSBrXw5iIlbfiOBdTNNvFjxQ3DcCXcoUWp7E= 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=VX97a0beT/ntF8sPAoQ0mvzTwE4sd5mKHRkodGZVgz0fvo+aHpY7h2KimlMoI7qZ41 d0dPEYFKMVGLFCnfEFUJnoFoUWM7RvljP1bM7mEtxXNan01S1GYN0JrDkJaQq0vFiNgZ FAPMRyPdoRh/5geFXq1yCv7TIivK69AMOzWPHCt0uWrorv+wRcwN85OeI2Y2FyurQXIb 4fW5bvvPRdN99IR5A/wNm65aUpiR+nOyQrFE6CAE0dRVnkMRKkNKnL/GaeYjAFo4CYz7 koFOoCPMpFQZpGNK51ZeP9vkYNKcs13zgxFsY89NTUzllHClC0nW/8tKazui9c+WWTu6 ou9A== X-Gm-Message-State: AJIora+3y8P8QKc9tXZ5KiGJDSHIqPkx3x1WF1GMgo8IyRt4dNvkOuLX RFyzsN8GAFVspS9D7z6345YSaYn0 X-Google-Smtp-Source: AGRyM1shmR51hgUSzkYjrzXpo50RTXKBMHo2LfaPYP5d0aD8f1upKIpNIDN7artT8/mFizM7P/heSw== X-Received: by 2002:a17:907:2e0d:b0:72b:5cf4:464a with SMTP id ig13-20020a1709072e0d00b0072b5cf4464amr15017422ejc.87.1658869411635; Tue, 26 Jul 2022 14:03:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:1115:b0:726:d068:52af with SMTP id h21-20020a170906111500b00726d06852afls1352349eja.1.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:30 -0700 (PDT) X-Received: by 2002:a17:907:a413:b0:72f:1959:f35f with SMTP id sg19-20020a170907a41300b0072f1959f35fmr15632210ejc.112.1658869410481; Tue, 26 Jul 2022 14:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869410; cv=none; d=google.com; s=arc-20160816; b=CivMQQc5uCSr9l1zuOK0460yMB014EBPvOm0sBMIwI2siLTvS6Kz77QUgQ8DRyLoa+ apJtFFRZRjnLsQgBIzH/laP/ZE8vqAWyXhvj8d1wa4kTcnQu8+n5Mtzz+Ejt0vK70m2V tG5TiWYf3NbvdawUhzLY3J8EHsVHRgJNKNaJbGyr0YgqIsNAZOv69Sep2sKn1zfmqCRU PtA2u9Qf6ZrVsu0LTa36s6NofuWrDzEsxj6BuionIKKl3189vLQ6c1bPMM2+235OtPIJ 0x/GXKA9Ekx32Z4Gp5pId28X14Nlt4Ss7p0F3SqELXbkzdeOefF0SzmBr7oDrXLTAwDI 0ZTg== 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=DoORM3Y+oaaJi30LDo0RPiQNV5GspqwWgGNacbLRCZE0lw2VKS4sQh/DagxEXnrRmu SrV78tlHt1zRlnB/frlwXkM+wPAnjDiNiN8JxNw2o0R1hmBCr2LK0gX9o+RdMhRCH0iQ E33xRpp6jPJFo6YfJ2EOpRDuxm8iqKVmanWu3B2djMMDyzVhOy6mnY+Gc48X0mHyA/wW i5IGF5FXwAJJyji/VLKCncav0jyB0zjw/5fDvvE8HKbAM0OoZt5mfAHAx+TJZkWg5wbc tOBsniAZZCinBf3LDEYn13ol8ym5f7oBz2hhAJHsM6Aqcwb2Hm/qf5STHyZJz6m+wZWC Y7zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KECnBmgq; 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 p19-20020a17090653d300b006fe9e596ab5sor5801835ejo.121.2022.07.26.14.03.30 for (Google Transport Security); Tue, 26 Jul 2022 14:03:30 -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:ef8b:b0:72b:4a67:8ae5 with SMTP id ze11-20020a170906ef8b00b0072b4a678ae5mr15506155ejb.763.1658869410261; Tue, 26 Jul 2022 14:03:30 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:29 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 5/9] can: slcan: use the generic can_change_mtu() Date: Tue, 26 Jul 2022 23:02:13 +0200 Message-Id: <20220726210217.3368497-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=KECnBmgq; 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 Tue Jul 26 21:02:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2257 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 9E3703F081 for ; Tue, 26 Jul 2022 23:03:33 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id dz20-20020a0564021d5400b0043be2c5cd32sf5349862edb.2 for ; Tue, 26 Jul 2022 14:03:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869413; cv=pass; d=google.com; s=arc-20160816; b=To0rp46GPry7AOotnS2NAGY9R/X/1/ntMOMcbeuXpC/uHyZX8we16OP1jw7Y6uQgRV qKNrXxHVSIljkUnnGzSgsPcqlNnTmSosXdMVoMHDH7NibRwhXOuGL98VBBBigWzu0/iJ pTw8ROO/x+4fqv4wFR66g/YNsDbGM9pB4x0qAB55Dzxs40JWflKh5sPZmCXqJ5g20653 FHseugoxZ5bCW9gMizgdY4eD78Ya4aypVS8DdDXS6iGfLWHi/EMmav61YntvDRAabHyg Bn8fgklpQUzbiZJZTbpQb9FHS5Wz3EYPmcLOdvSN6h6y4sKlyayzTBSZtkpHUbv1ntZk F0yQ== 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=q3pRWfaP0/KubnAnulazSI1/hNGY5fON8Xdndy/vziNdx03306DoHLV0qACLR+Dou3 pzRm2bveA+i3QsQY4X+lVVMQ7Yaf54j+4I304YhGfcM2xayVD/Yc0ypRsSTvqsEcFUB7 DpmZ9mqePkoXAWoqwahqM8O1/yyISf8uAqLSSL5WLZ8JUrPgnh5xk/F34Ib9uR3ns/HG u0z4Nxq3vrZh7SFUnKrCCDDSR4Nw7HMM87rvjFETd756vBaID88buP3gLtf51uHl7hl4 VnTxtpwIibZxCGSntetRHGUjesTdEK3U/eTrSQrspuMQtz8nJ/TJxNioxoRbTA2JJ/Zg yXTw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="GloOwx/m"; 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=o+IgdSlM6GRrusBpsAc0V8JVSYnbrZ5sm65Qq4DNzq2oJTyvbhP14P7lYOtJc4PhU3 p9g31pZy/nS+G0AdGDhl+fAH22Lb/ngUMoqW4uQ/s78WZepGmKHlDMLAbo2ktkzRUyGx nLKVqqEGS3NdtTWETyzM1Yl0Zk4gu6JMZlXoI= 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=xzjrr4agMIv7dZ3UKm+lO2iCxftgnIR9lXTju4fmUCEhxCvvNnl4NsWPf1tyUqVlFz SaSB9KVrI0aslXPdLyOBKUtJ6cIXH109MSf3JY1EnrfS9ZA7Cc/RvTgkByL8UatBsAjM hJfRwTsMig5Msaez8R2h+iYgChH2h+B58BNdUAE0Wb6H+D8vzUtmPVSnwfIRTISGRglj oJIR7OKeqcSUqOJMHUCV3oIXKwJyl14rRLDYi/GqdWtc+OOeB2h0eKfNYW4jcrqoyb9m z2AMsiVt/WS35sMuoQ5u/YDJJoAdB7XIwuuiD60U3AJp63tiDk5DV/dsYcY09Kru4ghY pg0Q== X-Gm-Message-State: AJIora9lXO7mSamOIiH9CJ/q9/CvVLd1vG/MNlo6rqWRvfcbeECXm+7l kwues0fVUimZStAZoRlVaHg1FDJV X-Google-Smtp-Source: AGRyM1vjJ3IqqInLz4zvL877fxaV2ncKmHsfvebD6U8vs6E7nE9vn5KU2JTUWko9AZCzzUvJF4ZpTg== X-Received: by 2002:a17:906:98c8:b0:72b:3a31:6cc3 with SMTP id zd8-20020a17090698c800b0072b3a316cc3mr15449182ejb.597.1658869413474; Tue, 26 Jul 2022 14:03:33 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:af86:b0:72b:41fa:b554 with SMTP id mj6-20020a170906af8600b0072b41fab554ls1355497ejb.10.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:32 -0700 (PDT) X-Received: by 2002:a17:907:a218:b0:72b:8aae:3f84 with SMTP id qp24-20020a170907a21800b0072b8aae3f84mr15200441ejc.367.1658869412509; Tue, 26 Jul 2022 14:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869412; cv=none; d=google.com; s=arc-20160816; b=freYmc6xCUfIpHsKPCnQekBAEje1B55YbqwTmOuykZd6LDSXCE/y2bexlw2W7/SCYq F7Nvj08u/wmif6R1kpde6Zzp4RQRLBX9W4oO0U2FE4SqJyD1azPODgglovzmE9AI4Uf8 ZqnnC71rlOLQIRgkVQh93ztkcDopqVJmAwumqLAILDRCa719xwoPcWtWCu2zPKgH5eQO KCy2vHF4noHWNqlmlVEveh7bSWQ5ofnTq3HxgF6dZ+qAqC3lttBlnTCkkFoUbdWUjOBj OGI9mMuEOoAwj4ZbZ7PtPet4yEVeYrqZcTmqWHAGhJb1iZE1qsD+tSta0qJm+oZVpIvu WpUA== 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=zf7EnrCHSfrbjeG6ug0gyWn7gq+NlDpUZoJAnxR9rDrfXx+M4e3u7pC4dT6RsmbI3E Jo5ih0h2TR8K7QJYZ7Ws7j4UuVe7vHHuozRXHuTuJtgoC8zvcEJt7hg0lP3tMmYBfGye SD11gYzQYTmT6WR90TXVX8XiH5mCCjs6ptaMlIDIPCkq2bb52APLZwi0dlay6yzvVZ+5 T7A3Pen/rJyPdNXjnF4lQSdlueNf8JeIS2rVA6QMz4h+/dT4CuejqLjBcSxJjNRzxWkl JYLx/LcHHQ2xLOQ/yElTpwSsZa7UUJc+Mq/86nTGizojQ+v3GV9LGlBV9vzR0BLYgDb0 fz2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="GloOwx/m"; 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 s1-20020a170906bc4100b007262f75c699sor6191628ejv.116.2022.07.26.14.03.32 for (Google Transport Security); Tue, 26 Jul 2022 14:03:32 -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:3f1a:b0:72b:394b:ad32 with SMTP id hq26-20020a1709073f1a00b0072b394bad32mr15286276ejc.445.1658869412188; Tue, 26 Jul 2022 14:03:32 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:31 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 6/9] can: slcan: add support for listen-only mode Date: Tue, 26 Jul 2022 23:02:14 +0200 Message-Id: <20220726210217.3368497-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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="GloOwx/m"; 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 Tue Jul 26 21:02:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2258 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 69E133F081 for ; Tue, 26 Jul 2022 23:03:35 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id n8-20020a05640205c800b00434fb0c150csf9398632edx.19 for ; Tue, 26 Jul 2022 14:03:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869415; cv=pass; d=google.com; s=arc-20160816; b=mODyh27bS3jdfcPXlrpXdX1Kx368jF6eWKabI0hzUtFppL5AMEgwZa/sMhk4HDD8/F c0wC/Km431Nmt6mh9Xuaom5Ohram5LrOssfHXcmWCuxFdv+6ghF+usvT7rDynvhOqm3A r9SqCV9BlgbUQFxa9EdjJcBXINdvbHxKszBdvkCgwZeFCvYnlJUSLXvjsTyaWHVSVAoL z67xpf9vbqt/BaBni+q02DtGMRyFWHFLvdJP6sJTpN8uyILNQzxrYEt3OHpWWbgFl6i7 KhrLI/PFNYtnNSYV/YoagxrSsN2eP3GYpka1OlBFlECUvhD5bPqEteIgHj0xQsdlA1sb 5XTA== 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=mBKyys4b6w44AvpK6T48B0Qz/qx8MXjyEE8E6P4BKWE=; b=Htjs6sgsbjU5AiTsGpkD7jP/eec1aP2LQqzRsG4cz6SFoTEkluM56WzPaPHmof1MeX NT2+0UUcmQxiXIOgj9lDhKX46+raaHNF6bRB9KrHAIpiZqcmyWvBBVpD4JZb8Q7bCb+V 9wvkqOqtpyHkxO2bC6IdV8nnRmBEd7I+NTfJPVzn8rHATw65IqCTqgTMGX8new2aS66C ssMmBZbe/o4q20eUO53lgIkCNsaSHwMjA1W9QixJ84EFWBeCcmnEW7KFDL6d21lJGf5G +Zk1fcfx3fwfLR99gT26n1gzdDO3KyiPAKZuh3RAOxKmHx11RJgfLah663PokprlK45H WKlg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=I6feiYwm; 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=mBKyys4b6w44AvpK6T48B0Qz/qx8MXjyEE8E6P4BKWE=; b=B+m62Kuhbiq7DUC9d3DBtbq5L5dNu1lh1dRJd1pde09OGzTu7YS6MdQFiVmxm758KN 3esUEz6oR9UZusditM7bX31I/yR2cGn1jNq33izgMRTdrC5FWg1p1zhumhTAVSNsqJxO //sasmEtxzFbPvKjW1wwahl+rtpTk+CHg6t70= 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=mBKyys4b6w44AvpK6T48B0Qz/qx8MXjyEE8E6P4BKWE=; b=AFsTsMYm86ffvkY5j0UeC0U5nb+y4by4Pupr6qjs4Fd9KwoS/naIkdCebQPJOIzBSr lWVqG9T20K1OlMu0ply/gGxbf4E3Ec2m1LC8gatfnbcBBzkCwKt8GrFCwh2ivBZcSybI oF/evMvEBZY62mURC1gzlPLPblpWQ55K/XDU9d5KyP0OOqPS8FkkK5lPlTXUBv1EjCRc 1h77tw6/ALNDNjqdjEo9SNAG36T039nHbjavJ/gCBLwCqEebNEqW/4iGEHyHHPbPuEf8 JYfwGefS+55htiL8BkNVlvPRJx1cybQJJgCXAjtw7cTt5ettCxoVempeEQ+lITK4bdyH nzEA== X-Gm-Message-State: AJIora+Ga3k+CSRWuaTr7DyJqotYctshR0aFrUq66v3n5XgaCaVF3YNO C4j/wcvYcpcwRbY5QfUSOSFneX+o X-Google-Smtp-Source: AGRyM1uMNcQ80ZzXOoYBzaqCm+eUZjPHEKIdVZsU5rc32pzgts7XWGDJearPnFL65tlK1hKr3DEK8w== X-Received: by 2002:aa7:ccc8:0:b0:43b:e3b4:bc0a with SMTP id y8-20020aa7ccc8000000b0043be3b4bc0amr16355298edt.289.1658869415278; Tue, 26 Jul 2022 14:03:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:7c8:b0:72f:9dcf:5699 with SMTP id m8-20020a17090607c800b0072f9dcf5699ls1356466ejc.3.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:34 -0700 (PDT) X-Received: by 2002:a17:907:28c9:b0:72b:6912:5453 with SMTP id en9-20020a17090728c900b0072b69125453mr14840700ejc.419.1658869414181; Tue, 26 Jul 2022 14:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869414; cv=none; d=google.com; s=arc-20160816; b=suANCzKncg6wgZT7HfBifKlACDHwG7DeQahWg/YehLpK6B32rMqY1IR5f0BoPAJoMd HHV18/rZgggWt5NQZ+SljWVvA+zKYneHhzw38UbVU8Fkg5vR9IY20a9ZCFoEiNRytHu8 CiSy1PBkEJvR1T88T05/GsZ+OKR/Qz9G93hq52c+CjtykTbHVehmfCpNMJdv1HGYejSw uS34xfGFSgyljnlPesVFiyTxgWQjOPP0viC6j94f8aKEfFqvVGP4N9V9WYAiRaa6pdut 3uK1+KCz1Ae7lryF7Yu1Iw/zYjg5n2mkiXQNayGDRFXBKo8WIKyeC9NV+4B1XtUk6g9b 2uJg== 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=qy2wWA6vClyZGhjx9DWjei+yWAv7tqnCtNEo36hW/K4=; b=Bvk6+nRORtEWvKGCFuLh75WRVP8g9PgjCSVPls7JpGy7XZKKOke6kp9oxps65Ws9P8 QnMznXdPI3oAYYxH+v3aZC8xN3ZXDxjv3Qe+SIHhftkIvCdtFlITz9A4FllH5DHW5U7N WsrhUs37rQKeTPPmiOsrQZZ4H7N7HsxI+U+tGVXs2pyPaZVQsMXNzrKA8nuSztyb7wOj wBeAH/d4UV5Ip7WfQX/PZ5wyptMjyXDfORue+3eyz96JyyLHt8QDZr7l4QFOMBzHGeBm eF0ZBgaHmcYpxj0iMp2WrwUvs9XI51C1JTO5mq3yYuSRgFDFL/c34dq7JEdYQ8ifb+G6 pQkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=I6feiYwm; 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 bq23-20020a056402215700b0043bc5ed5e61sor7367732edb.44.2022.07.26.14.03.34 for (Google Transport Security); Tue, 26 Jul 2022 14:03:34 -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:371a:b0:43a:ece9:ab8e with SMTP id ek26-20020a056402371a00b0043aece9ab8emr19781113edb.126.1658869413951; Tue, 26 Jul 2022 14:03:33 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:33 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , Alexandru Tachici , Andrew Lunn , Arnd Bergmann , "David S. Miller" , Eric Dumazet , Guangbin Huang , "Gustavo A. R. Silva" , Hao Chen , Heiner Kallweit , Ido Schimmel , Jakub Kicinski , Leon Romanovsky , Oleksij Rempel , Paolo Abeni , Sean Anderson , Tom Rix , Yufeng Mo , netdev@vger.kernel.org Subject: [RFC PATCH v3 7/9] ethtool: add support to get/set CAN bit time register Date: Tue, 26 Jul 2022 23:02:15 +0200 Message-Id: <20220726210217.3368497-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=I6feiYwm; 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: , Add ethtool support to get/set tunable values from/to the CAN bit time register (btr). CC: Marc Kleine-Budde CC: linux-can@vger.kernel.org Suggested-by: Marc Kleine-Budde Signed-off-by: Dario Binacchi --- (no changes since v1) include/uapi/linux/ethtool.h | 1 + net/ethtool/common.c | 1 + net/ethtool/ioctl.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index e0f0ee9bc89e..a2d24f689124 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -232,6 +232,7 @@ enum tunable_id { ETHTOOL_TX_COPYBREAK, ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ ETHTOOL_TX_COPYBREAK_BUF_SIZE, + ETHTOOL_CAN_BTR, /* * Add your fresh new tunable attribute above and remember to update * tunable_strings[] in net/ethtool/common.c diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 566adf85e658..78f23b898243 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -90,6 +90,7 @@ tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = { [ETHTOOL_TX_COPYBREAK] = "tx-copybreak", [ETHTOOL_PFC_PREVENTION_TOUT] = "pfc-prevention-tout", [ETHTOOL_TX_COPYBREAK_BUF_SIZE] = "tx-copybreak-buf-size", + [ETHTOOL_CAN_BTR] = "can-btr", }; const char diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 326e14ee05db..17b69d6fcab4 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2403,6 +2403,7 @@ static int ethtool_get_module_eeprom(struct net_device *dev, static int ethtool_tunable_valid(const struct ethtool_tunable *tuna) { switch (tuna->id) { + case ETHTOOL_CAN_BTR: case ETHTOOL_RX_COPYBREAK: case ETHTOOL_TX_COPYBREAK: case ETHTOOL_TX_COPYBREAK_BUF_SIZE: From patchwork Tue Jul 26 21:02:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2259 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 B24343F081 for ; Tue, 26 Jul 2022 23:03:36 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id w15-20020a056402268f00b0043be4012ea9sf5205055edd.4 for ; Tue, 26 Jul 2022 14:03:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869416; cv=pass; d=google.com; s=arc-20160816; b=QP9j20uSgewj5yAxMsDp2yD190UmnqUKcyj6Mqc8pQ4wxpIh3H+m/KGTSdp9oLiYta njVRpcfI/WWMgpHbGUr50gD3zyFTHYWzjK3rkqFFwQ/5Y60HyOuorAr6Bi97KGFDE6al x4zR9HtB6oAMwrCz40Yx9MmdibKhrQCdoXkRQRPe0FLm43t0DEfh7oNGWarSM7v6Iv5h 6YFMaGytQla2rJWBbFlxHrItkjROpPEWYkhk6TFQLY6EaoDsSwqGSY/7C942S4GRdDoL xdsIVq0ome7FBaYbf0WAYEHTMKtMJ70kHGNOQ5mouc2SD0K9S7kMmEDmRko1rnp5Rh4k gZVw== 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=tbhBm4/YjxjWLoWLq+GTpb3Kl8rYi7D38+dhw+2hI4I=; b=xtUcMLuhuaIWgg7RWmMrpHK8Tm6/yh08i0gNns0p5tEncPLqtl2T3NNFsiHzNkK8ik Wn+ea3kj2F+Qxt8GubqHY3bVDI//jzEcf/OO82KgobtChbDvthNdc6AvYNyMIUS/omwX PJtyjn3N/lQRdyoLRON6JuwRRQL4k+QNY2/SFkAsCfpC1Q6Q6mL6BE53FK8KVZeHRG7Y gvCtwjhnjNjNnMtsKLtLknycWsAPpK4hVeMx0+0L4BpLdU/8DJzGaAcjT+71/uwZgVSp biJZPhaebui5WTzvAxWLkPOMecBd5w4f/et6MyiX3BnA0VPMCkj3BUE3BsUZDvmsZPNg 9xqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fFao0muv; 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=tbhBm4/YjxjWLoWLq+GTpb3Kl8rYi7D38+dhw+2hI4I=; b=f+8jBaNkb/tYfYaX15z2vsyH+mLVvA59feYuU2AtSarkBkPPK0prB5KbYFeZSw0ar3 P68Axp/giaJe1G8i4VzlzLAPN8viGBcemrmzl3ghLkF+b/ubVePvk92bENGVbTaGzaQo k8uU9RGXJ1KV3cLjfYIA3HzetUmbl8/AoAIzk= 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=tbhBm4/YjxjWLoWLq+GTpb3Kl8rYi7D38+dhw+2hI4I=; b=Ph1xcN42+hcPuqa0WFZD3GnqO45sAWWp4Yn1Q3X5qZWABUag5pJ3/Bixc/n9Rs2CG/ pHZ+VNVhfg+0M85UrxjG0n3+Vc86f/sERgrNzipqyPVhhlS5VEyyuz5zbHY9dG3dwJze Va5IMBEaMmDSVHTsKtqYOHRe4fIBG7lwubV4BV3fAX3Feo18IicWjj3umZby4/ykzm0N tYT/mLvXb0rnpLMzf1leCNoE69lpC24V6Q16irbNqRFkgnkHM9YKOKzrn/7Y5YamaHfz T2OWsJe+xqKT4vZkpHliPUIn5WCBeZI70qXzVim+2c/ezstNsiONydimTrnndAzJnqnL QEbQ== X-Gm-Message-State: AJIora+lu3B1gYf1X1vMWnSpjeJTSjCZXN44ueQWFxQCtaqTwmILz7EO fi5Jy0rkTkUMJnIG5JzG6mzQjntW X-Google-Smtp-Source: AGRyM1vzBvCBvaTYf3mVnXYGBUfpb1tNj/ZyAETr+uSaHSqH7oo1AcGJO7M9NHS/gxkzH4ZjvbARpw== X-Received: by 2002:a17:907:1dc4:b0:72b:4d85:c7c4 with SMTP id og4-20020a1709071dc400b0072b4d85c7c4mr15334103ejc.258.1658869416568; Tue, 26 Jul 2022 14:03:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:22d0:b0:72b:cf5:145f with SMTP id q16-20020a17090622d000b0072b0cf5145fls1350162eja.5.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:35 -0700 (PDT) X-Received: by 2002:a17:907:7b87:b0:72e:d45a:17af with SMTP id ne7-20020a1709077b8700b0072ed45a17afmr15519293ejc.73.1658869415457; Tue, 26 Jul 2022 14:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869415; cv=none; d=google.com; s=arc-20160816; b=qjdhYoj2OG+2M1DoEpDkhTSA+KH1Lhi1QE8s7xDXDEEHFGxY6r/kl1Ols60wEl72DY EzymgFqV5qOL59sA4E5FQU2Kt+dYFQK8fVaq2nBAtlLClFgC+MyKcjYnQ+dGbF6tbQ9C f2fdeUkjcpdWr5xZCLtFjhsziAQusIgZZPw1bBIfQjbWC+NTDFGz86lgB6NiJRn3dGas PYUBlouwqIC3HsHQ+5Tg4CWB4YJu2QH58iMPrnfm++nh5NURUZjEg4oKpA2M6Rpeugy8 5hVdrlcQC8Ux1JTTVwKju1ohoiGO9GkAh8NRWiXcxw6I5/Ma3cQUnXoPjokyEnRKvmjm +zTA== 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=jASsf99AUDo012UYQLBftY2iklAzdZ3iQKBsZI8nWRw=; b=S/+NLb0xVww7w+O/m/w4g7Hr/jNSB8LwvKp5I4+pE3kfM/YJ12W32IgjU0EiAoV0VM OdkCHqZNGU7jFD2S7fwRWTyOEnaAW9iBQE68fwWri71qsQ78IGKPo5JCST+j/fJeVBn7 rWQJ3AGyrtTE12vLgLtwaBUMwDT0kPVPFCNQpmtZTotvgjrVcp5dgw/AHccTU+3+3Wr8 U0ls12IbE13xcYe9Qd8n3rFppnTlH71qHLMHW/xXtygLIjAtGHxsuhbx89klb2Sofu9R HYGw+V2JKqbo7kLe3eCjMzbeVMg8bixinTQPn+iUAEHz9/mB/tDM3N5Bl1jqdt22Iuul peIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fFao0muv; 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 d3-20020a1709063ec300b0072695cb151fsor6072432ejj.0.2022.07.26.14.03.35 for (Google Transport Security); Tue, 26 Jul 2022 14:03:35 -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:4fc4:b0:6da:b4c6:fadb with SMTP id i4-20020a1709064fc400b006dab4c6fadbmr15668908ejw.282.1658869415190; Tue, 26 Jul 2022 14:03:35 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:34 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 8/9] can: slcan: add support to set bit time register (btr) Date: Tue, 26 Jul 2022 23:02:16 +0200 Message-Id: <20220726210217.3368497-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=fFao0muv; 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 allows to set the bit time register with tunable values. The setting can only be changed if the interface is down: ip link set dev can0 down ethtool --set-tunable can0 can-btr 0x31c ip link set dev can0 up Suggested-by: Marc Kleine-Budde Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/net/can/slcan/slcan-core.c | 58 ++++++++++++++++++++------- drivers/net/can/slcan/slcan-ethtool.c | 13 ++++++ drivers/net/can/slcan/slcan.h | 1 + 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 45e521910236..3905f21e7788 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -99,6 +99,7 @@ struct slcan { #define CF_ERR_RST 0 /* Reset errors on open */ wait_queue_head_t xcmd_wait; /* Wait queue for commands */ /* transmission */ + u32 btr; /* bit timing register */ }; static const u32 slcan_bitrate_const[] = { @@ -128,6 +129,17 @@ int slcan_enable_err_rst_on_open(struct net_device *ndev, bool on) return 0; } +int slcan_set_btr(struct net_device *ndev, u32 btr) +{ + struct slcan *sl = netdev_priv(ndev); + + if (netif_running(ndev)) + return -EBUSY; + + sl->btr = btr; + return 0; +} + /************************************************************************* * SLCAN ENCAPSULATION FORMAT * *************************************************************************/ @@ -699,22 +711,40 @@ static int slcan_netdev_open(struct net_device *dev) return err; } - 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]) - break; + if (sl->can.bittiming.bitrate != CAN_BITRATE_UNKNOWN || sl->btr) { + 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]) + break; + } + + /* The CAN framework has already validate the bitrate + * value, so we can avoid to check if `s' has been + * properly set. + */ + snprintf(cmd, sizeof(cmd), "C\rS%d\r", s); + err = slcan_transmit_cmd(sl, cmd); + if (err) { + netdev_err(dev, + "failed to send bitrate command 'C\\rS%d\\r'\n", + s); + goto cmd_transmit_failed; + } } - /* The CAN framework has already validate the bitrate value, - * so we can avoid to check if `s' has been properly set. - */ - snprintf(cmd, sizeof(cmd), "C\rS%d\r", s); - err = slcan_transmit_cmd(sl, cmd); - if (err) { - netdev_err(dev, - "failed to send bitrate command 'C\\rS%d\\r'\n", - s); - goto cmd_transmit_failed; + if (sl->btr) { + u32 btr = sl->btr & GENMASK(15, 0); + + snprintf(cmd, sizeof(cmd), "C\rs%04x\r", btr); + err = slcan_transmit_cmd(sl, cmd); + if (err) { + netdev_err(dev, + "failed to send bit timing command 'C\\rs%04x\\r'\n", + btr); + goto cmd_transmit_failed; + } + } if (test_bit(CF_ERR_RST, &sl->cmd_flags)) { diff --git a/drivers/net/can/slcan/slcan-ethtool.c b/drivers/net/can/slcan/slcan-ethtool.c index bf0afdc4e49d..8e2e77bbffda 100644 --- a/drivers/net/can/slcan/slcan-ethtool.c +++ b/drivers/net/can/slcan/slcan-ethtool.c @@ -52,11 +52,24 @@ static int slcan_get_sset_count(struct net_device *netdev, int sset) } } +static int slcan_set_tunable(struct net_device *netdev, + const struct ethtool_tunable *tuna, + const void *data) +{ + switch (tuna->id) { + case ETHTOOL_CAN_BTR: + return slcan_set_btr(netdev, *(u32 *)data); + default: + return -EINVAL; + } +} + static const struct ethtool_ops slcan_ethtool_ops = { .get_strings = slcan_get_strings, .get_priv_flags = slcan_get_priv_flags, .set_priv_flags = slcan_set_priv_flags, .get_sset_count = slcan_get_sset_count, + .set_tunable = slcan_set_tunable, }; void slcan_set_ethtool_ops(struct net_device *netdev) diff --git a/drivers/net/can/slcan/slcan.h b/drivers/net/can/slcan/slcan.h index d463c8d99e22..1ac412fe8c95 100644 --- a/drivers/net/can/slcan/slcan.h +++ b/drivers/net/can/slcan/slcan.h @@ -13,6 +13,7 @@ bool slcan_err_rst_on_open(struct net_device *ndev); int slcan_enable_err_rst_on_open(struct net_device *ndev, bool on); +int slcan_set_btr(struct net_device *ndev, u32 btr); void slcan_set_ethtool_ops(struct net_device *ndev); #endif /* _SLCAN_H */ From patchwork Tue Jul 26 21:02:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2260 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 037FE3F081 for ; Tue, 26 Jul 2022 23:03:38 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id z14-20020a05640240ce00b0043c25c21e94sf3333964edb.14 for ; Tue, 26 Jul 2022 14:03:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658869417; cv=pass; d=google.com; s=arc-20160816; b=GonW0xYwibhzS6RW6h2CUXpnBMGwNhHDv8NW9+CK0zUytmyJJBVcpAPoOjNQabzCSa Gm6qG9bQ8q1zkzj5SIOHI9w8eG+xb0u8zgVUp7RBUSWzjJJR5f3GfVjyt5bo2aW4XWNw 2qvkPSiKDlKE4B5NaoqMhkLdPTfVTbrrhpTQr8XF0PbHaJE/SD6Ko6obJQFPgZyJSE8Z kCe9LkHzlcKlSmg7GEHN5h9h3W8YQt/AUcuVgyWtM4ADeWi7hrFW+slA8OD1GLiPbp5s y4cxYJRVaRn/qD10r4i9emLWvGA4klogSvzn19BpKUqnZoCQ6hHiMY0cDuN/BcKXVB8A YNFQ== 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=B01d3VsQYgvRyP1YLZrmZwfto6t49pS8vxj0WeMCXzE=; b=mAgbewJ9GOvgn4zJXB7xCTTtkUlrd1x0yXmMyL+K1RimV/7UL9EeaC5yQHuFO6Yxlt xzE7vfhzB1i10vNyI0GE2hY0Y1WaZO+IafQ270E4Qxd/tBqCrQoCJTiOdu7qyYXHWD+d zqD60iIIPIfDhubVzxcfIZo8f7EM5qrhrjsgDaAnZsQf2YOnvO2jvDQjZ3JP04ecifKa Zxmqznm5vLgT+dIBoWV6j7P/XvgPEPcP/IOGokAHa54FeLngoeGdN12Kfk0p6RIHLuLv k1mXuHrJdp+9WA7OD5DXyCik0fXLYrTDcfhWKJ4DxsYbeKvuNBIeVWNsf4JPpdo+ANFn edKw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evXGwLvc; 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=B01d3VsQYgvRyP1YLZrmZwfto6t49pS8vxj0WeMCXzE=; b=nm0glRP7HsOdreJjTJTedwWo5QqefEujqc1lsQk1QHHwQTMuaMr/p5We56LSS8ZDaY LjVw8svyBqMpY+QKq15+XUxqqsbeoTA7nLMgxhBOWKerGOXCDoqNH0TTZDiKYXO6yb4r dDe576uZbxjhMDLSIvFzRtVZCGpzvA/EWMA8M= 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=B01d3VsQYgvRyP1YLZrmZwfto6t49pS8vxj0WeMCXzE=; b=179Kmgaqwljm66YAZDuoj7wOB6Ljb9izHejDMMr3BlJbHxEq514pRzS4isDD/HHmjO EOgGaz0R52PcjAWIpJ7FO87/cbjmhRDsTqPl3C3L59xjz5qE4viUmW78mIag+h+VCql4 KHqsdMfSM07QeWjk3H0h7cYPNIvuX+QF1P9Ek/I8RjaNSJ3BmwRY43LzlwW5hjaMrcKm 6Y/TiDSOMpMF1t+bdLpv2jYbmaa2/R0myzE7OXzJ3AbD0C/2JBVjAkK0wozdLPNT/XgQ iQMB07YG+oh4wgzYMtI3LMfC/klihLXdKe5A7aPI92yVCA9AGKLBO3Auze97y3UJAy8/ LrTg== X-Gm-Message-State: AJIora+K9Cz8uo5xdo2UCMPvsDCm0LosC/1JPSe9o5ixR6Zeb/C4sYjf psgbHGIZuI2DLJDNlXY6GgJCZZzf X-Google-Smtp-Source: AGRyM1uW0xHNzaLKfAAV0xjWQxZDRekIAChA7rfB8aD4w8CYV5or6+pHqD9o9cLhgfnU7Nhqjycijg== X-Received: by 2002:a17:907:72d2:b0:72b:d238:4e81 with SMTP id du18-20020a17090772d200b0072bd2384e81mr15834810ejc.104.1658869417837; Tue, 26 Jul 2022 14:03:37 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:1115:b0:726:d068:52af with SMTP id h21-20020a170906111500b00726d06852afls1352403eja.1.-pod-prod-gmail; Tue, 26 Jul 2022 14:03:37 -0700 (PDT) X-Received: by 2002:a17:907:3e29:b0:72f:84c2:fafc with SMTP id hp41-20020a1709073e2900b0072f84c2fafcmr14954549ejc.93.1658869416817; Tue, 26 Jul 2022 14:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869416; cv=none; d=google.com; s=arc-20160816; b=wNZ/Bdo9yrIyIuSWSBYnDczEoU7eNnJRj4L3NWvg9cIrrAgmcz3DYoJGPZUoiXF60H 1Mp5nn/eENBLdsUaOprP6slrgdM1inxwCD24Sradij8NdKAPIWv2rASUzhCSlekNEXWa Fgiuvt3T1E3lDyOXXBQtkTZbzEhouTnDPyT5hsIFLApNk/dtKVDMCFlkiHi8rEH5V+2I XK4LgiCH3FC+Lgqy1J+gvzziiPIUsbdrutcGvv9RyHyt3l6qwYr4mpLzMZDDbynvT4pl /YictPDcvtvoiC3y5qc/N96ipqDPvAX8v8rUMdvAtPb+Ncjyr9dnmrxvv95GkoW73S/d a/vw== 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=AiQ0HcOvDIah4fMpuXqHSwjgHcHZ/tpuZ/vuW2o2BXw=; b=AoZ1y+2j6beEOVkg7/+lFBuqI1jjJjpapU4VxxDvRvOXl9oUf2Pbgcjwmi37c92m9W qcqVZTs+LhP1gQsCPVjTJEY9vrqOfgYZH7eREu1qPdD/ed2Ux4bh0pAvcdtM1UyLQS77 OnvPmw4Y/w5757gzzRAqjFv4oN/lFrm5/6b6Yy5nFotu8oOW74U3o4UpksHVXZP6VC4s G60FpWFTivy/SKX3x4RvEv0ligdmaJ64NoquWX/F2JWH4fLRjwmzg3cJe5F+aieVAfZE 4KR8Wg/g/4/57NhxhjMyFInwq/lTNxp+kTXUga5uXds8Y9cJt0B0QydyEMTPgRptj8kg K9Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evXGwLvc; 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 du1-20020a17090772c100b0072fac4531fdsor4538620ejc.98.2022.07.26.14.03.36 for (Google Transport Security); Tue, 26 Jul 2022 14:03:36 -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:8a79:b0:72b:871a:57b7 with SMTP id hy25-20020a1709068a7900b0072b871a57b7mr15018909ejc.602.1658869416578; Tue, 26 Jul 2022 14:03:36 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:36 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 9/9] MAINTAINERS: Add maintainer for the slcan driver Date: Tue, 26 Jul 2022 23:02:17 +0200 Message-Id: <20220726210217.3368497-10-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-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=evXGwLvc; 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 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 fc7d75c5cdb9..74e42f78e7cb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18448,6 +18448,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 3905f21e7788..6a0f12cfbb4e 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)