Re: [RFC PATCH net-next 1/3] net: phy: add concept of shared storage for PHYs

From: Russell King - ARM Linux admin
Date: Tue Apr 21 2020 - 10:43:23 EST


On Tue, Apr 21, 2020 at 04:34:55PM +0200, Andrew Lunn wrote:
> > +static inline bool phy_package_init_once(struct phy_device *phydev)
> > +{
> > + struct phy_package_shared *shared = phydev->shared;
> > +
> > + if (!shared)
> > + return false;
> > +
> > + return !test_and_set_bit(PHY_SHARED_F_INIT_DONE, &shared->flags);
> > +}
>
> I need to look at how you actually use this, but i wonder if this is
> sufficient. Can two PHYs probe at the same time? Could we have one PHY
> be busy setting up the global init, and the other thinks the global
> setup is complete? Do we want a comment like: 'Returns true when the
> global package initialization is either under way or complete'?

IIRC, probe locking in the driver model is by per-driver locks, so
any particular driver won't probe more than one device at a time.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up