From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>
Subject: [PATCH v1 3/4] leds: trigger: gpio: Use sysfs_emit() to instead of s*printf()
Date: Fri, 3 Nov 2023 21:53:09 +0200 [thread overview]
Message-ID: <20231103195310.948327-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20231103195310.948327-1-andriy.shevchenko@linux.intel.com>
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(-)
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,
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-11-03 20:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 19:53 [PATCH v1 1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() Andy Shevchenko
2023-11-03 19:53 ` [PATCH v1 2/4] leds: trigger: gpio: Convert to use kstrtox() Andy Shevchenko
2023-11-04 22:26 ` Linus Walleij
2023-11-23 11:05 ` Lee Jones
2023-11-23 14:11 ` Andy Shevchenko
2023-11-23 14:47 ` Lee Jones
2023-11-03 19:53 ` Andy Shevchenko [this message]
2023-11-04 22:24 ` [PATCH v1 3/4] leds: trigger: gpio: Use sysfs_emit() to instead of s*printf() Linus Walleij
2023-11-03 19:53 ` [PATCH v1 4/4] leds: trigger: gpio: Convert to DEVICE_ATTR_RW() Andy Shevchenko
2023-11-04 22:26 ` Linus Walleij
2023-11-04 22:26 ` [PATCH v1 1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() Linus Walleij
2023-11-23 14:48 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103195310.948327-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.