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

From: Russell King (Oracle)
Date: Fri Jun 16 2023 - 09:33:56 EST


On Fri, Jun 16, 2023 at 09:12:46PM +0800, Jianhui Zhao wrote:
> +static umode_t phy_dev_c45_visible(struct kobject *kobj, struct attribute *attr, int foo)
> +{
> + struct phy_c45_devid_attribute *devattr =
> + (struct phy_c45_devid_attribute *)container_of(attr, struct device_attribute, attr);

1. (struct phy_c45_devid_attribute *) cast is not required.
2. we now have two places that we convert the attribute to a
phy_c45_devid_attribute, it's time for a macro to do that.

> + struct phy_device *phydev = to_phy_device(kobj_to_dev(kobj));
> +
> + if (!phydev->is_c45 || phydev->c45_ids.device_ids[devattr->index] == 0xffffffff)

if (!phydev->is_c45 ||
phydev->c45_ids.device_ids[devattr->index] == 0xffffffff)

And lastly... please don't be so quick to post a new version.

https://www.kernel.org/doc/html/v6.1/process/maintainer-netdev.html#i-have-received-review-feedback-when-should-i-post-a-revised-version-of-the-patches

Particularly the bit about "Do not post a new version of the code if the
discussion about the previous version is still ongoing, unless directly
instructed by a reviewer." is relevent.

You have not given enough time for Andrew to respond to my suggestion
which I invited him to (by "Andrew, any opinions?"), instead rushing
out v4 that implements my suggestion without first waiting to see if
Andrew agrees with it.

This seems to be becoming common place, so I think it's about time I
created a vim macro to insert a boilerplate explaining this process in
every review. :(

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!