[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <310bf56a-f2dc-4c2d-a7fe-f90b419cdccd@lunn.ch>
Date: Sun, 11 Jun 2023 17:40:20 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jianhui Zhao <zhaojh329@...il.com>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: phy: Add sysfs attribute for PHY c45 identifiers.
On Sun, Jun 11, 2023 at 11:27:43PM +0800, Jianhui Zhao wrote:
> If a phydevice use c45, its phy_id property is always 0, so
> this adds a phy_c45_ids sysfs attribute to MDIO devices. This
> attribute can be useful when debugging problems related to
> phy drivers.
> + for (i = 1; i < num_ids; i++) {
> + if (phydev->c45_ids.device_ids[i] == 0xffffffff)
> + continue;
> +
> + ret += sprintf(buf + ret, "%d: 0x%.8lx\n", i,
> + (unsigned long)phydev->c45_ids.device_ids[i]);
> + }
https://www.kernel.org/doc/html/next/filesystems/sysfs.html says:
Attributes should be ASCII text files, preferably with only one
value per file. It is noted that it may not be efficient to contain
only one value per file, so it is socially acceptable to express an
array of values of the same type.
How about putting all 32 values in a subdirectory, one file per MMD?
Please also remember to document the attributes in
Documentation/ABI/testing/sysfs-class-net-phydev.
Andrew
Powered by blists - more mailing lists