Skip to content

Commit

Permalink
net: ipa: use sysfs_emit() to instead of scnprintf()
Browse files Browse the repository at this point in the history
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: ye xingchen <ye.xingchen@zte.com.cn>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
ye xingchen authored and David S. Miller committed Dec 5, 2022
1 parent 27e521c commit 38db82e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ipa/ipa_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ version_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct ipa *ipa = dev_get_drvdata(dev);

return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_version_string(ipa));
return sysfs_emit(buf, "%s\n", ipa_version_string(ipa));
}

static DEVICE_ATTR_RO(version);
Expand All @@ -70,7 +70,7 @@ static ssize_t rx_offload_show(struct device *dev,
{
struct ipa *ipa = dev_get_drvdata(dev);

return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa));
return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
}

static DEVICE_ATTR_RO(rx_offload);
Expand All @@ -80,7 +80,7 @@ static ssize_t tx_offload_show(struct device *dev,
{
struct ipa *ipa = dev_get_drvdata(dev);

return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa));
return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
}

static DEVICE_ATTR_RO(tx_offload);
Expand Down

0 comments on commit 38db82e

Please sign in to comment.