[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250624062728.4424-1-me@brighamcampbell.com>
Date: Tue, 24 Jun 2025 00:27:27 -0600
From: Brigham Campbell <me@...ghamcampbell.com>
To: skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
dri-devel@...ts.freedesktop.org (open list:DRM DRIVERS),
linux-kernel@...r.kernel.org (open list)
Cc: Brigham Campbell <me@...ghamcampbell.com>
Subject: [PATCH] gpu: drm: Replace scnprintf() with sysfs_emit_at()
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@...ghamcampbell.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
Powered by blists - more mailing lists