* [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf()
@ 2026-11-01 3:34 Akshat Rawat
2026-11-01 3:38 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Akshat Rawat @ 2026-11-01 3:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek
Cc: Griffin Kroah-Hartman, linux-leds, linux-kernel, Akshat Rawat
Use sysfs_emit() instead of sprintf() in sysfs show callbacks
(flash_brightness_show, max_flash_brightness_show, flash_strobe_show,
flash_timeout_show, and max_flash_timeout_show) to conform to the
recommended sysfs attribute formatting guidelines in
Documentation/filesystems/sysfs.rst.
Signed-off-by: Akshat Rawat <akshatrawat095@gmail.com>
---
drivers/leds/led-class-flash.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
index 181dfd49c6ad..a1bf70d6e47c 100644
--- a/drivers/leds/led-class-flash.c
+++ b/drivers/leds/led-class-flash.c
@@ -71,7 +71,7 @@ static ssize_t flash_brightness_show(struct device *dev,
/* no lock needed for this */
led_update_flash_brightness(fled_cdev);
- return sprintf(buf, "%u\n", fled_cdev->brightness.val);
+ return sysfs_emit(buf, "%u\n", fled_cdev->brightness.val);
}
static DEVICE_ATTR_RW(flash_brightness);
@@ -81,7 +81,7 @@ static ssize_t max_flash_brightness_show(struct device *dev,
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
- return sprintf(buf, "%u\n", fled_cdev->brightness.max);
+ return sysfs_emit(buf, "%u\n", fled_cdev->brightness.max);
}
static DEVICE_ATTR_RO(max_flash_brightness);
@@ -129,7 +129,7 @@ static ssize_t flash_strobe_show(struct device *dev,
if (ret < 0)
return ret;
- return sprintf(buf, "%u\n", state);
+ return sysfs_emit(buf, "%u\n", state);
}
static DEVICE_ATTR_RW(flash_strobe);
@@ -168,7 +168,7 @@ static ssize_t flash_timeout_show(struct device *dev,
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
- return sprintf(buf, "%u\n", fled_cdev->timeout.val);
+ return sysfs_emit(buf, "%u\n", fled_cdev->timeout.val);
}
static DEVICE_ATTR_RW(flash_timeout);
@@ -178,7 +178,7 @@ static ssize_t max_flash_timeout_show(struct device *dev,
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
- return sprintf(buf, "%u\n", fled_cdev->timeout.max);
+ return sysfs_emit(buf, "%u\n", fled_cdev->timeout.max);
}
static DEVICE_ATTR_RO(max_flash_timeout);
--
2.56.0.windows.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf()
2026-11-01 3:34 [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf() Akshat Rawat
@ 2026-11-01 3:38 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-01 3:38 UTC (permalink / raw)
To: Akshat Rawat; +Cc: linux-leds, lee
> Use sysfs_emit() instead of sprintf() in sysfs show callbacks
> (flash_brightness_show, max_flash_brightness_show, flash_strobe_show,
> flash_timeout_show, and max_flash_timeout_show) to conform to the
> recommended sysfs attribute formatting guidelines in
> Documentation/filesystems/sysfs.rst.
>
> Signed-off-by: Akshat Rawat <akshatrawat095@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101033427.442-1-akshatrawat095@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-01 3:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 3:34 [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf() Akshat Rawat
2026-11-01 3:38 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.