[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIwUFXOCCKZYSUBi@shell.armlinux.org.uk>
Date: Fri, 16 Jun 2023 08:49:41 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Jianhui Zhao <zhaojh329@...il.com>
Cc: andrew@...n.ch, hkallweit1@...il.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3] net: phy: Add sysfs attribute for PHY c45 identifiers.
On Wed, Jun 14, 2023 at 09:45:22PM +0800, Jianhui Zhao wrote:
> +static const struct attribute_group phy_dev_c45_ids_group = {
> + .name = "c45_ids",
> + .attrs = phy_c45_id_attrs
> +};
One last thing - is there any point to creating these attributes if
the PHY isn't c45?
We could add here:
.is_visible = phy_dev_c45_visible,
with:
static umode_t phy_dev_c45_visible(struct kobject *kobj,
struct attribute *attr, int foo)
{
struct phy_device *phydev = to_phy_device(kobj_to_dev(kobj));
return phydev->is_c45 ? attr->mode : 0;
}
which will only show the c45 attributes if the PHY is a c45 PHY.
Andrew, any opinions?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists