Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net 01/15] docs: net: dsa: update probing documentation
Date: Sun, 17 Jul 2022 23:39:41 +0000	[thread overview]
Message-ID: <20220717233940.dsiskh6etvr23ivl@skbuf> (raw)
In-Reply-To: <YtQnWsz/X6yGBo3g@lunn.ch>

On Sun, Jul 17, 2022 at 05:14:34PM +0200, Andrew Lunn wrote:
> Hi Vladimir
> 
> > +Switch registration from the perspective of a driver means passing a valid
> > +``struct dsa_switch`` pointer to ``dsa_register_switch()``, usually from the
> > +switch driver's probing function. The following members must be valid in the
> > +provided structure:
> 
> > +
> > +- ``ds->priv``: backpointer to a driver-private data structure which can be
> > +  retrieved in all further DSA method callbacks.
> 
> I'm not sure this is strictly true. The DSA core itself should not use
> ds->priv. And the driver could use other means, like
> dev_get_platdata(ds->dev->pdev) to get at is private data. But in

dev_get_platdata or dev_get_drvdata? I think platform_data is usually
for read-only information and thus not really appropriate as the
stateful private structure.

Also, "struct device" (ds->dev) doesn't have a "pdev" member.

> practice it is true.
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
>     Andrew

While it isn't strictly true technically speaking, I'd probably still
tell someone during review to do what everybody else does, if it comes
to it. It's also shorter to write "priv = ds->priv" than
"priv = dev_get_drvdata(ds->dev)", plus it goes through fewer pointers.

Worth changing or not worth changing all drivers from ds->priv to
dev_get_drvdata? If not worth changing, I guess it's not worth
mentioning either.

  parent reply	other threads:[~2022-07-17 23:43 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16 18:53 [PATCH net 00/15] Update DSA documentation Vladimir Oltean
2022-07-16 18:53 ` [PATCH net 01/15] docs: net: dsa: update probing documentation Vladimir Oltean
2022-07-17 15:14   ` Andrew Lunn
2022-07-17 16:56     ` Florian Fainelli
2022-07-17 23:39     ` Vladimir Oltean [this message]
2022-07-17 16:56   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 02/15] docs: net: dsa: document the shutdown behavior Vladimir Oltean
2022-07-17 15:16   ` Andrew Lunn
2022-07-17 16:57   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 03/15] docs: net: dsa: rename tag_protocol to get_tag_protocol Vladimir Oltean
2022-07-17 15:22   ` Andrew Lunn
2022-07-17 16:57   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 04/15] docs: net: dsa: add more info about the other arguments " Vladimir Oltean
2022-07-17 16:58   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 05/15] docs: net: dsa: document change_tag_protocol Vladimir Oltean
2022-07-17 15:25   ` Andrew Lunn
2022-07-17 16:58   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 06/15] docs: net: dsa: document the teardown method Vladimir Oltean
2022-07-17 15:26   ` Andrew Lunn
2022-07-17 16:58   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 07/15] docs: net: dsa: document port_setup and port_teardown Vladimir Oltean
2022-07-17 15:28   ` Andrew Lunn
2022-07-17 16:59   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 08/15] docs: net: dsa: document port_fast_age Vladimir Oltean
2022-07-17 15:29   ` Andrew Lunn
2022-07-17 16:59   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 09/15] docs: net: dsa: remove port_bridge_tx_fwd_offload Vladimir Oltean
2022-07-17 15:36   ` Andrew Lunn
2022-07-17 19:30   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 10/15] docs: net: dsa: remove port_vlan_dump Vladimir Oltean
2022-07-17 15:36   ` Andrew Lunn
2022-07-17 19:22   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 11/15] docs: net: dsa: delete port_mdb_dump Vladimir Oltean
2022-07-17 15:37   ` Andrew Lunn
2022-07-17 19:22   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 12/15] docs: net: dsa: add a section for address databases Vladimir Oltean
2022-07-17 15:46   ` Andrew Lunn
2022-07-17 19:26   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 13/15] docs: net: dsa: re-explain what port_fdb_dump actually does Vladimir Oltean
2022-07-17 15:47   ` Andrew Lunn
2022-07-17 19:26   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 14/15] docs: net: dsa: delete misinformation about -EOPNOTSUPP for FDB/MDB/VLAN Vladimir Oltean
2022-07-17 15:50   ` Andrew Lunn
2022-07-17 19:27   ` Florian Fainelli
2022-07-16 18:53 ` [PATCH net 15/15] docs: net: dsa: mention that VLANs are now refcounted on shared ports Vladimir Oltean
2022-07-17 15:51   ` Andrew Lunn
2022-07-17 19:27   ` Florian Fainelli
2022-07-17 19:28 ` [PATCH net 00/15] Update DSA documentation Florian Fainelli
2022-07-18 11:50 ` patchwork-bot+netdevbpf

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=20220717233940.dsiskh6etvr23ivl@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.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