* [net-next] net: phy: Convert to use sysfs_emit() APIs
@ 2022-09-28 11:34 Wang Yufen
2022-09-28 12:29 ` Andrew Lunn
2022-09-30 2:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Wang Yufen @ 2022-09-28 11:34 UTC (permalink / raw)
To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni; +Cc: netdev
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.
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
drivers/net/phy/mdio_bus.c | 4 ++--
drivers/net/phy/phy_device.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 8a2dbe8..f82090b 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -232,7 +232,7 @@ static ssize_t mdio_bus_stat_field_show(struct device *dev,
val = mdio_bus_get_stat(&bus->stats[sattr->addr],
sattr->field_offset);
- return sprintf(buf, "%llu\n", val);
+ return sysfs_emit(buf, "%llu\n", val);
}
static ssize_t mdio_bus_device_stat_field_show(struct device *dev,
@@ -251,7 +251,7 @@ static ssize_t mdio_bus_device_stat_field_show(struct device *dev,
val = mdio_bus_get_stat(&bus->stats[addr], sattr->field_offset);
- return sprintf(buf, "%llu\n", val);
+ return sysfs_emit(buf, "%llu\n", val);
}
#define MDIO_BUS_STATS_ATTR_DECL(field, file) \
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2198f13..7c9d871 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -520,7 +520,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)
{
struct phy_device *phydev = to_phy_device(dev);
- return sprintf(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id);
+ return sysfs_emit(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id);
}
static DEVICE_ATTR_RO(phy_id);
@@ -535,7 +535,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)
else
mode = phy_modes(phydev->interface);
- return sprintf(buf, "%s\n", mode);
+ return sysfs_emit(buf, "%s\n", mode);
}
static DEVICE_ATTR_RO(phy_interface);
@@ -545,7 +545,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)
{
struct phy_device *phydev = to_phy_device(dev);
- return sprintf(buf, "%d\n", phydev->has_fixups);
+ return sysfs_emit(buf, "%d\n", phydev->has_fixups);
}
static DEVICE_ATTR_RO(phy_has_fixups);
@@ -555,7 +555,7 @@ static ssize_t phy_dev_flags_show(struct device *dev,
{
struct phy_device *phydev = to_phy_device(dev);
- return sprintf(buf, "0x%08x\n", phydev->dev_flags);
+ return sysfs_emit(buf, "0x%08x\n", phydev->dev_flags);
}
static DEVICE_ATTR_RO(phy_dev_flags);
@@ -1310,7 +1310,7 @@ static void phy_sysfs_create_links(struct phy_device *phydev)
{
struct phy_device *phydev = to_phy_device(dev);
- return sprintf(buf, "%d\n", !phydev->attached_dev);
+ return sysfs_emit(buf, "%d\n", !phydev->attached_dev);
}
static DEVICE_ATTR_RO(phy_standalone);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [net-next] net: phy: Convert to use sysfs_emit() APIs
2022-09-28 11:34 [net-next] net: phy: Convert to use sysfs_emit() APIs Wang Yufen
@ 2022-09-28 12:29 ` Andrew Lunn
2022-09-30 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-09-28 12:29 UTC (permalink / raw)
To: Wang Yufen; +Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev
On Wed, Sep 28, 2022 at 07:34:20PM +0800, Wang Yufen wrote:
> 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.
>
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net-next] net: phy: Convert to use sysfs_emit() APIs
2022-09-28 11:34 [net-next] net: phy: Convert to use sysfs_emit() APIs Wang Yufen
2022-09-28 12:29 ` Andrew Lunn
@ 2022-09-30 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-30 2:40 UTC (permalink / raw)
To: wangyufen
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 28 Sep 2022 19:34:20 +0800 you wrote:
> 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.
>
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
> ---
> drivers/net/phy/mdio_bus.c | 4 ++--
> drivers/net/phy/phy_device.c | 10 +++++-----
> 2 files changed, 7 insertions(+), 7 deletions(-)
Here is the summary with links:
- [net-next] net: phy: Convert to use sysfs_emit() APIs
https://git.kernel.org/netdev/net-next/c/b5155ddd22bc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-30 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 11:34 [net-next] net: phy: Convert to use sysfs_emit() APIs Wang Yufen
2022-09-28 12:29 ` Andrew Lunn
2022-09-30 2:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).