[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35d00dfe1ad24b580dc247d882aa2e39@walle.cc>
Date: Fri, 17 Apr 2020 21:53:11 +0200
From: Michael Walle <michael@...le.cc>
To: Andrew Lunn <andrew@...n.ch>
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
Am 2020-04-17 21:50, schrieb Andrew Lunn:
>> +/* 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.
Correct, and this function was actually stolen from there ;) This was
actually stolen from the mscc PHY ;)
-michael
Powered by blists - more mailing lists