leds: trigger: gpio: Use sysfs_emit() to instead of s*printf()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 3 Nov 2023 19:53:09 +0000 (21:53 +0200)
committerLee Jones <lee@kernel.org>
Wed, 13 Dec 2023 11:28:38 +0000 (11:28 +0000)
Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231103195310.948327-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/trigger/ledtrig-gpio.c

index 8a30f9228186992aad22cc50dfc7c13565e3a776..8824be19881f1d37fc1e9828094b072fb68fbc18 100644 (file)
@@ -46,7 +46,7 @@ static ssize_t gpio_trig_brightness_show(struct device *dev,
 {
        struct gpio_trig_data *gpio_data = led_trigger_get_drvdata(dev);
 
-       return sprintf(buf, "%u\n", gpio_data->desired_brightness);
+       return sysfs_emit(buf, "%u\n", gpio_data->desired_brightness);
 }
 
 static ssize_t gpio_trig_brightness_store(struct device *dev,