Hello Marc, On Mon, Jul 25, 2022 at 2:38 PM Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > > 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. I have not found documentation of the SIOCGIFNAME ioctl for the line discipline, but only for netdev (i. e. https://man7.org/linux/man-pages/man7/netdevice.7.html), Thanks and regards, Dario > > > The `maxdev' module parameter has also been removed. > > > > CC: Max Staudt <max@xxxxxxxxx> > > Signed-off-by: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx> > > > > --- > > > > Changes in v2: > > Nitpick: > Changes since RFC: https://lore.kernel.org/all/20220716170007.2020037-1-dario.binacchi@xxxxxxxxxxxxxxxxxxxx > > > - 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 | -- Dario Binacchi Embedded Linux Developer dario.binacchi@xxxxxxxxxxxxxxxxxxxx __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@xxxxxxxxxxxxxxxxxxxx www.amarulasolutions.com