[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220725123804.ofqpq4j467qkbtzn@pengutronix.de>
Date: Mon, 25 Jul 2022 14:38:04 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Dario Binacchi <dario.binacchi@...rulasolutions.com>
Cc: linux-kernel@...r.kernel.org, michael@...rulasolutions.com,
Amarula patchwork <linux-amarula@...rulasolutions.com>,
Jeroen Hofstee <jhofstee@...tronenergy.com>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Max Staudt <max@...as.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 2/6] can: slcan: remove legacy infrastructure
On 25.07.2022 08:54:15, Dario Binacchi wrote:
> 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. It has been assumed that this change does not break
> the user space as the slcan driver provides an ioctl to resolve from tty
> fd to netdev name.
Is there a man page that documents this iotcl? Please add it and/or the
IOCTL name.
> The `maxdev' module parameter has also been removed.
>
> CC: Max Staudt <max@...as.org>
> Signed-off-by: Dario Binacchi <dario.binacchi@...rulasolutions.com>
>
> ---
>
> Changes in v2:
Nitpick:
Changes since RFC: https://lore.kernel.org/all/20220716170007.2020037-1-dario.binacchi@amarulasolutions.com
> - 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 c3dd7468a066..2c546f4a7981 100644
> --- a/drivers/net/can/slcan/slcan-core.c
> +++ b/drivers/net/can/slcan/slcan-core.c
[...]
> @@ -898,72 +799,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;
Nitpick: Please use 1 space in front of the =.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists