* [PATCH] gpu: drm: Replace scnprintf() with sysfs_emit_at()
@ 2025-06-24 6:27 Brigham Campbell
0 siblings, 0 replies; only message in thread
From: Brigham Campbell @ 2025-06-24 6:27 UTC (permalink / raw)
To: skhan, linux-kernel-mentees, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter,
open list:DRM DRIVERS, open list
Cc: Brigham Campbell
Replace scnprintf() with sysfs_emit_at() in drivers/gpu/drm/drm_sysfs.c.
Per kernel documentation, show() should only use sysfs_emit() or
sysfs_emit_at() when formatting the value to be returned to user space.
Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
---
I tested this patch with a device that outputs one specific resolution,
or "mode" and with a dummy device which has no output modes. I'd
appreciate Tested-by tags from anyone who can confirm that multi-mode
graphics adapters work as expected too.
drivers/gpu/drm/drm_sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 60c1f26edb6f..66d1fc804c84 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -283,8 +283,7 @@ static ssize_t modes_show(struct device *device,
mutex_lock(&connector->dev->mode_config.mutex);
list_for_each_entry(mode, &connector->modes, head) {
- written += scnprintf(buf + written, PAGE_SIZE - written, "%s\n",
- mode->name);
+ written += sysfs_emit_at(buf, written, "%s\n", mode->name);
}
mutex_unlock(&connector->dev->mode_config.mutex);
--
2.50.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-24 6:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 6:27 [PATCH] gpu: drm: Replace scnprintf() with sysfs_emit_at() Brigham Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox