Re: [PATCH V3] net: phy: Add sysfs attribute for PHY c45 identifiers.

From: Russell King (Oracle)
Date: Fri Jun 16 2023 - 03:50:04 EST


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!