Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH] leds: trigger: pattern: use sysfs_emit_at() instead of   scnprintf()
@ 2025-03-17  7:04 tang.dongxing
  2025-03-17  8:17 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: tang.dongxing @ 2025-03-17  7:04 UTC (permalink / raw)
  To: lee
  Cc: pavel, zack.rusin, namcao, tang.dongxing, tglx, mmkurbanov,
	linux-leds, linux-kernel, ye.xingchen, yang.guang5, yang.yang29,
	xu.xin16

From: TangDongxing <tang.dongxing@zte.com.cn>

Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: TangDongxing <tang.dongxing@zte.com.cn>
---
 drivers/leds/trigger/ledtrig-pattern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/trigger/ledtrig-pattern.c b/drivers/leds/trigger/ledtrig-pattern.c
index a594bd5e2233..861122c3e97b 100644
--- a/drivers/leds/trigger/ledtrig-pattern.c
+++ b/drivers/leds/trigger/ledtrig-pattern.c
@@ -256,7 +256,7 @@ static ssize_t pattern_trig_show_patterns(struct pattern_trig_data *data,
 		goto out;

 	for (i = 0; i < data->npatterns; i++) {
-		count += scnprintf(buf + count, PAGE_SIZE - count,
+		count += sysfs_emit_at(buf, count,
 				   "%d %u ",
 				   data->patterns[i].brightness,
 				   data->patterns[i].delta_t);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-17  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  7:04 [PATCH] leds: trigger: pattern: use sysfs_emit_at() instead of scnprintf() tang.dongxing
2025-03-17  8:17 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox