[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+h21hpYWHrVu7t49dSPM7O7SoVwM+svcm+hO+Ox2fWwkDonkQ@mail.gmail.com>
Date: Fri, 24 May 2019 00:37:21 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc: Ioana Ciornei <ioana.ciornei@....com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"andrew@...n.ch" <andrew@...n.ch>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
"maxime.chevallier@...tlin.com" <maxime.chevallier@...tlin.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [RFC PATCH net-next 5/9] net: phylink: Add phylink_create_raw
On Fri, 24 May 2019 at 00:28, Russell King - ARM Linux admin
<linux@...linux.org.uk> wrote:
>
> On Thu, May 23, 2019 at 01:20:40AM +0000, Ioana Ciornei wrote:
> > @@ -111,7 +114,16 @@ static const char *phylink_an_mode_str(unsigned int mode)
> > static int phylink_validate(struct phylink *pl, unsigned long *supported,
> > struct phylink_link_state *state)
> > {
> > - pl->ops->validate(pl->netdev, supported, state);
> > + struct phylink_notifier_info info = {
> > + .supported = supported,
> > + .state = state,
> > + };
> > +
> > + if (pl->ops)
> > + pl->ops->validate(pl->netdev, supported, state);
> > + else
> > + blocking_notifier_call_chain(&pl->notifier_chain,
> > + PHYLINK_VALIDATE, &info);
>
> I don't like this use of notifiers for several reasons:
>
> 1. It becomes harder to grep for users of this.
> 2. We lose documentation about what is passed for each method.
> 3. We lose const-ness for parameters, which then allows users to
> modify phylink-internal data structures inappropriately from
> these notifier calls.
>
> Please find another way.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
> According to speedtest.net: 11.9Mbps down 500kbps up
Hi Russell,
Items 2 and 3 can be addressed by creating an union of structures in
struct phylink_notifier_info, just like switchdev does.
For 1 (grep), you mean that the notifiers are upper-case and the
regular callbacks are lower-case?
-Vladimir
Powered by blists - more mailing lists