Linux CAN drivers development
 help / color / mirror / Atom feed
From: Max Staudt <max@enpas.org>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	linux-kernel@vger.kernel.org,
	Amarula patchwork <linux-amarula@amarulasolutions.com>,
	michael@amarulasolutions.com,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Paolo Abeni <pabeni@redhat.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2 05/13] can: slcan: simplify the device de-allocation
Date: Sun, 12 Jun 2022 18:23:02 +0200	[thread overview]
Message-ID: <20220612182302.36bdd9b9.max@enpas.org> (raw)
In-Reply-To: <CABGWkvroJG16AOu8BODhVu068jacjHWbkkY9TCF4PQ7rgANVXA@mail.gmail.com>

On Sat, 11 Jun 2022 12:46:04 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> > As written before I would like to discuss this change out of your
> > patch series "can: slcan: extend supported features" as it is no
> > slcan feature extension AND has to be synchronized with the
> > drivers/net/slip/slip.c implementation.  
> 
> Why do you need to synchronize it with  drivers/net/slip/slip.c
> implementation ?

Because slcan.c is a derivative of slip.c and the code still looks
*very* similar, so improvements in one file should be ported to the
other and vice versa. This has happened several times now.


> > When it has not real benefit and introduces more code and may create
> > side effects, this beautification should probably be omitted at all.
> >  
> 
> I totally agree with you. I would have already dropped it if this
> patch didn't make sense. But since I seem to have understood that
> this is not the case, I do not understand why it cannot be improved
> in this series.

This series is mostly about adding netlink support. If there is a point
of contention about a beautification, it may be easier to discuss that
separately, so the netlink code can be merged while the beautification
is still being discussed.


On another note, the global array of slcan_devs is really unnecessary
and maintaining it is a mess - as seen in some of your patches, that
have to account for it in tons of places and get complicated because of
it.

slcan_devs is probably grandfathered from a very old kernel, since
slip.c is about 30 years old, so I suggest to remove it entirely. In
fact, it may be easier to patch slcan_devs away first, and that will
simplify your open/close patches - your decision :)


If you wish to implement the slcan_devs removal, here are some hints:

The private struct can just be allocated as part of struct can_priv in
slcan_open(), like so:

  struct net_device *dev;
  dev = alloc_candev(sizeof(struct slcan), 0);

And then accessed like so:

  struct slcan *sl = netdev_priv(dev);

Make sure to add struct can_priv as the first member of struct slcan:

  /* This must be the first member when using alloc_candev() */
  struct can_priv can;


> The cover letter highlighted positive reactions to the series because
> the module had been requiring these kinds of changes for quite
> some time. So, why not take the opportunity to finalize this patch in
> this series even if it doesn't extend the supported features ?

Because... I can only speak for myself, but I'd merge all the
unambiguous stuff first and discuss the difficult stuff later, if there
are no interdependencies :)



Max

  reply	other threads:[~2022-06-12 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 16:51 [PATCH v2 00/13] can: slcan: extend supported features Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 01/13] can: slcan: use the BIT() helper Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 02/13] can: slcan: use netdev helpers to print out messages Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 03/13] can: slcan: use the alloc_can_skb() helper Dario Binacchi
2022-06-09  8:07   ` Marc Kleine-Budde
2022-06-08 16:51 ` [PATCH v2 04/13] can: slcan: use CAN network device driver API Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 05/13] can: slcan: simplify the device de-allocation Dario Binacchi
2022-06-08 20:38   ` Oliver Hartkopp
2022-06-11 10:46     ` Dario Binacchi
2022-06-12 16:23       ` Max Staudt [this message]
2022-06-12 17:13         ` Oliver Hartkopp
2022-06-12 21:20           ` Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 06/13] can: slcan: allow to send commands to the adapter Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 07/13] can: slcan: set bitrate by CAN device driver API Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 08/13] can: slcan: send the open command to the adapter Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 09/13] can: slcan: send the close " Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 10/13] can: slcan: move driver into separate sub directory Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 11/13] can: slcan: add ethtool support to reset adapter errors Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 12/13] can: slcan: extend the protocol with error info Dario Binacchi
2022-06-08 16:51 ` [PATCH v2 13/13] can: slcan: extend the protocol with CAN state info Dario Binacchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220612182302.36bdd9b9.max@enpas.org \
    --to=max@enpas.org \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox