leds: class-flash: use sysfs_emit() instead of sprintf()
PATCH 1/1 leds: class-flash: use sysfs_emit() instead of sprintf()
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.
--- drivers/leds/led-class-flash.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/leds/led-class-flash.c +5 -5
@@ -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);
Signature · 1 line
2.56.0.windows.4
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 7 lines
Use
sysfs_emit()instead ofsprintf()in sysfs show callbacks (flash_brightness_show,max_flash_brightness_show,flash_strobe_show,flash_timeout_show, andmax_flash_timeout_show) to conform to the recommended sysfs attribute formatting guidelines inDocumentation/filesystems/sysfs.rst.Signed-off-by Akshat Rawat <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: (subset) [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf()
In reply to Akshat RawatQuoted 8 lines · Akshat Rawat
Use
sysfs_emit()instead ofsprintf()in sysfs show callbacks (flash_brightness_show,max_flash_brightness_show,flash_strobe_show,flash_timeout_show, andmax_flash_timeout_show) to conform to the recommended sysfs attribute formatting guidelines inDocumentation/filesystems/sysfs.rst.[...]
Applied, thanks!
[1/1] leds: class-flash: use sysfs_emit() instead of sprintf()
commit: 5290f1b863aff2659f53f0e81712c9bde70dbf9c
--
Lee Jones [李琼斯]