[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200417195003.GG785713@lunn.ch>
Date: Fri, 17 Apr 2020 21:50:03 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Michael Walle <michael@...le.cc>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next 3/3] net: phy: bcm54140: add hwmon support
> +/* Check if one PHY has already done the init of the parts common to all PHYs
> + * in the Quad PHY package.
> + */
> +static bool bcm54140_is_pkg_init(struct phy_device *phydev)
> +{
> + struct mdio_device **map = phydev->mdio.bus->mdio_map;
> + struct bcm54140_phy_priv *priv;
> + struct phy_device *phy;
> + int i, addr;
> +
> + /* Quad PHY */
> + for (i = 0; i < 4; i++) {
> + priv = phydev->priv;
> + addr = priv->base_addr + i;
> +
> + if (!map[addr])
> + continue;
> +
> + phy = container_of(map[addr], struct phy_device, mdio);
I don't particularly like a PHY driver having knowledge of the mdio
bus core. Please add a helper in the core to get you the phydev for a
particular address.
There is also the question of locking. What happens if the PHY devices
is unbound while you have an instance of its phydev? What happens if
the base PHY is unbound? Are the three others then unusable?
I think we need to take a step back and look at how we handle quad
PHYs in general. The VSC8584 has many of the same issues.
Andrew
Powered by blists - more mailing lists