[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190523212756.4b25giji4vkxdl5q@shell.armlinux.org.uk>
Date: Thu, 23 May 2019 22:27:56 +0100
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Ioana Ciornei <ioana.ciornei@....com>
Cc: "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>,
"olteanv@...il.com" <olteanv@...il.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 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
Powered by blists - more mailing lists