From: Paulo Miguel Almeida Date: Sat, 19 Oct 2024 02:13:49 +0000 (+1300) Subject: powerpc/ps3: replace open-coded sysfs_emit function X-Git-Tag: v6.13-rc1~98^2~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2866949ec889cf383c481119c617b9cead733070;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://github.com/KSPP/linux/issues/105 Signed-off-by: Paulo Miguel Almeida Reviewed-by: Geert Uytterhoeven Acked-by: Geoff Levand Signed-off-by: Michael Ellerman Link: https://patch.msgid.link/ZxMV3YvSulJFZ8rk@mail.google.com --- diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index b9a7d9bae687e..afbaabf182d01 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -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);