[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250121-google-config-fs-v3-10-8154a6945142@bootlin.com>
Date: Tue, 21 Jan 2025 15:34:54 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Melissa Wen <melissa.srw@...il.com>,
MaĆra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>,
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>,
Simona Vetter <simona.vetter@...ll.ch>
Cc: jose.exposito89@...il.com, dri-devel@...ts.freedesktop.org,
arthurgrillo@...eup.net, linux-kernel@...r.kernel.org,
jeremie.dautheribes@...tlin.com, miquel.raynal@...tlin.com,
thomas.petazzoni@...tlin.com, seanpaul@...gle.com, nicolejadeyee@...gle.com,
Louis Chauvet <louis.chauvet@...tlin.com>
Subject: [PATCH RFC v3 10/14] drm/vkms: Introduce configfs for device name
To allows the userspace to identify the device once it is enabled, create
a file to fetch it.
This file can only be read once the device is enabled, and will return the
device name, which can later be used to use it.
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_configfs.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c
index eeb0c1e1b225f2a1a35ac6deb9457b90ba6542e5..d0bc6adfdae85b82ca043d318f84fca70840526c 100644
--- a/drivers/gpu/drm/vkms/vkms_configfs.c
+++ b/drivers/gpu/drm/vkms/vkms_configfs.c
@@ -927,10 +927,26 @@ static ssize_t device_enable_store(struct config_item *item,
return (ssize_t)count;
}
+static ssize_t device_device_name_show(struct config_item *item, char *page)
+{
+ struct vkms_configfs_device *configfs_device = config_item_to_vkms_configfs_device(item);
+
+ scoped_guard(mutex, &configfs_device->lock)
+ {
+ if (configfs_device->enabled)
+ return sprintf(page, "%s\n",
+ dev_name(configfs_device->vkms_config->dev->drm.dev));
+ return -EINVAL;
+ }
+ return -EINVAL;
+}
+
CONFIGFS_ATTR(device_, enable);
+CONFIGFS_ATTR_RO(device_, device_name);
static struct configfs_attribute *device_attrs[] = {
&device_attr_enable,
+ &device_attr_device_name,
NULL,
};
--
2.47.1
Powered by blists - more mailing lists