From: Akshat Rawat <akshatrawat095@gmail.com>
To: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>
Cc: Griffin Kroah-Hartman <griffin@kroah.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
Akshat Rawat <akshatrawat095@gmail.com>
Subject: [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf()
Date: Sun, 1 Nov 2026 03:34:27 +0000 [thread overview]
Message-ID: <20261101033427.442-1-akshatrawat095@gmail.com> (raw)
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.
Signed-off-by: Akshat Rawat <akshatrawat095@gmail.com>
---
drivers/leds/led-class-flash.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
index 181dfd49c6ad..a1bf70d6e47c 100644
--- a/drivers/leds/led-class-flash.c
+++ b/drivers/leds/led-class-flash.c
@@ -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);
--
2.56.0.windows.4
next reply other threads:[~2026-11-01 3:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 3:34 Akshat Rawat [this message]
2026-11-01 3:38 ` [PATCH] leds: class-flash: use sysfs_emit() instead of sprintf() sashiko-bot
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=20261101033427.442-1-akshatrawat095@gmail.com \
--to=akshatrawat095@gmail.com \
--cc=griffin@kroah.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox