mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
net: phy: Convert to use sysfs_emit_at() API
Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.
Fixes: ea074eb627 ("net: phy: add sysfs node for reading PHY's registers")
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I642da13c8e4b9351b13592a817c9bf9a9b5c34a7
This commit is contained in:
@@ -568,12 +568,13 @@ phy_registers_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct phy_device *phydev = to_phy_device(dev);
|
||||
int index;
|
||||
int len = 0;
|
||||
|
||||
for (index = 0; index < 32; index++)
|
||||
sprintf(buf, "%s%2d: 0x%x\n", buf, index,
|
||||
phy_read(phydev, index));
|
||||
len += sysfs_emit_at(buf, len, "%2d: 0x%x\n", index,
|
||||
phy_read(phydev, index));
|
||||
|
||||
return strlen(buf);
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
|
||||
Reference in New Issue
Block a user