diff mbox series

[v1,3/4] leds: trigger: gpio: Use sysfs_emit() to instead of s*printf()

Message ID 20231103195310.948327-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() | expand

Commit Message

Andy Shevchenko Nov. 3, 2023, 7:53 p.m. UTC
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>
---
 drivers/leds/trigger/ledtrig-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Nov. 4, 2023, 10:24 p.m. UTC | #1
On Fri, Nov 3, 2023 at 8:53 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> 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>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c
index 8a30f9228186..8824be19881f 100644
--- a/drivers/leds/trigger/ledtrig-gpio.c
+++ b/drivers/leds/trigger/ledtrig-gpio.c
@@ -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,