powerpc/ps3: replace open-coded sysfs_emit function
Subsystems (2)
PATCH 1/1 powerpc/ps3: replace open-coded sysfs_emit function
sysfs_emit() helper function should be used when formatting the value to be returned to user space.
This patch replaces open-coded sysfs_emit() in sysfs .show() callbacks
--- arch/powerpc/platforms/ps3/system-bus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/platforms/ps3/system-bus.c +2 -3
@@ -453,10 +453,9 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a, char *buf) {struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev); -int len =snprintf (buf,PAGE_SIZE ,"ps3:%d:%d\n" , dev->match_id, - dev->match_sub_id); -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +return sysfs_emit (buf,"ps3:%d:%d\n" , dev->match_id, + dev->match_sub_id); }static DEVICE_ATTR_RO (modalias);
Signature · 1 line
2.47.0
Quoted 7 lines · Paulo Miguel Almeida
sysfs_emit()helper function should be used when formatting the value to be returned to user space.This patch replaces open-coded
sysfs_emit()in sysfs .show() callbacks
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Paulo,
Quoted 17 lines · Paulo Miguel Almeida
sysfs_emit()helper function should be used when formatting the value to be returned to user space.This patch replaces open-coded
sysfs_emit()in sysfs .show() callbacks--- arch/powerpc/platforms/ps3/system-bus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)arch/powerpc/platforms/ps3/system-bus.c +0
-0@@ -453,10 +453,9 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a, char *buf)
arch/powerpc/platforms/ps3/system-bus.c static ssize_t modalias_show(struct device *_dev, struct device_attribute *a, · line 460
Quoted 10 lines
arch/powerpc/platforms/ps3/system-bus.c +2
-3{struct ps3_system_bus_device *dev =ps3_dev_to_system_bus_dev (_dev); -int len =snprintf (buf,PAGE_SIZE ,"ps3:%d:%d\n" , dev->match_id, - dev->match_sub_id); -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +return sysfs_emit (buf,"ps3:%d:%d\n" , dev->match_id, + dev->match_sub_id); }static DEVICE_ATTR_RO (modalias);
I tested this on PS3 and it seems to work OK.
Thanks for your contribution.
Michael Ellerman
AppliedQuoted 6 lines · Paulo Miguel Almeida
sysfs_emit()helper function should be used when formatting the value to be returned to user space.This patch replaces open-coded
sysfs_emit()in sysfs .show() callbacks
Applied to powerpc/next.
[1/1] powerpc/ps3: replace open-coded sysfs_emit function
https://git.kernel.org/powerpc/c/2866949ec889cf383c481119c617b9cead733070
cheers