mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks
PATCH v2 1/1 mips: sgi-ip22: Replace "s[n]?printf" with sysfs_emit in sysfs callbacks
Replace open-coded pieces with sysfs_emit() helper in sysfs .show() callbacks.
Signed-off-by Paulo Miguel Almeida <[email protected]>
---
Changelog:
- v2: amend commit message (Req: Maciej W. Rozycki)
- v1: https://lore.kernel.org/lkml/[email protected]/
--- arch/mips/sgi-ip22/ip22-gio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/mips/sgi-ip22/ip22-gio.c +3 -4
@@ -165,9 +165,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, char *buf) {struct gio_device *gio_dev =to_gio_device (dev); -int len =snprintf (buf,PAGE_SIZE ,"gio:%x\n" , gio_dev->id.id); -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +return sysfs_emit (buf,"gio:%x\n" , gio_dev->id.id); }static DEVICE_ATTR_RO (modalias);
@@ -177,7 +176,7 @@ static ssize_t name_show(struct device *dev,struct gio_device *giodev; giodev =to_gio_device (dev); -return sprintf (buf,"%s" , giodev->name); +return sysfs_emit (buf,"%s\n" , giodev->name); }static DEVICE_ATTR_RO (name);
@@ -187,7 +186,7 @@ static ssize_t id_show(struct device *dev,struct gio_device *giodev; giodev =to_gio_device (dev); -return sprintf (buf,"%x" , giodev->id.id); +return sysfs_emit (buf,"%x\n" , giodev->id.id); }static DEVICE_ATTR_RO (id);
Signature · 1 line
2.47.0
Quoted 9 lines · Paulo Miguel Almeida
Replace open-coded pieces with
sysfs_emit()helper in sysfs .show() callbacks.Signed-off-by Paulo Miguel Almeida <[email protected]>---
Changelog:
- v2: amend commit message (Req: Maciej W. Rozycki)
- v1: https://lore.kernel.org/lkml/[email protected]/
---
Reviewed-by Maciej W. Rozycki <[email protected]>
Thank you for this update.
Maciej
Quoted 11 lines · Paulo Miguel Almeida
Replace open-coded pieces with
sysfs_emit()helper in sysfs .show() callbacks.Signed-off-by Paulo Miguel Almeida <[email protected]>---
Changelog:
- v2: amend commit message (Req: Maciej W. Rozycki)
- v1: https://lore.kernel.org/lkml/[email protected]/--- arch/mips/sgi-ip22/ip22-gio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]