Skip to contentSkip to conversation

leds: class-flash: use sysfs_emit() instead of sprintf()

PATCH Applied Akshat Rawat 3 participants 3 messages Nov 1 – Nov 13 LED

lore
Share & tools
lore
#0 lore raw

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
index 181dfd49c6ad..a1bf70d6e47c 100644
@@ -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
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 7 lines

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.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw

Re: (subset) [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf()

In reply to Akshat Rawat
Quoted 8 lines · 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.

[...]

Applied, thanks!

[1/1] leds: class-flash: use sysfs_emit() instead of sprintf()

      commit: 5290f1b863aff2659f53f0e81712c9bde70dbf9c

--
Lee Jones [李琼斯]