mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/vkms: Set device name from vkms_config
In order to be able to create multiple devices, the device name needs to be unique. Allow to set it in the VKMS configuration. Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250218101214.5790-7-jose.exposito89@gmail.com Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
committed by
Maxime Ripard
parent
8b059b0c3f
commit
969a3a4e2b
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "vkms_config.h"
|
||||
|
||||
struct vkms_config *vkms_config_create(void)
|
||||
struct vkms_config *vkms_config_create(const char *dev_name)
|
||||
{
|
||||
struct vkms_config *config;
|
||||
|
||||
@@ -16,6 +16,12 @@ struct vkms_config *vkms_config_create(void)
|
||||
if (!config)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
config->dev_name = kstrdup_const(dev_name, GFP_KERNEL);
|
||||
if (!config->dev_name) {
|
||||
kfree(config);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
EXPORT_SYMBOL_IF_KUNIT(vkms_config_create);
|
||||
@@ -26,7 +32,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
|
||||
{
|
||||
struct vkms_config *config;
|
||||
|
||||
config = vkms_config_create();
|
||||
config = vkms_config_create(DEFAULT_DEVICE_NAME);
|
||||
if (IS_ERR(config))
|
||||
return config;
|
||||
|
||||
@@ -40,6 +46,7 @@ EXPORT_SYMBOL_IF_KUNIT(vkms_config_default_create);
|
||||
|
||||
void vkms_config_destroy(struct vkms_config *config)
|
||||
{
|
||||
kfree_const(config->dev_name);
|
||||
kfree(config);
|
||||
}
|
||||
EXPORT_SYMBOL_IF_KUNIT(vkms_config_destroy);
|
||||
@@ -49,7 +56,10 @@ static int vkms_config_show(struct seq_file *m, void *data)
|
||||
struct drm_debugfs_entry *entry = m->private;
|
||||
struct drm_device *dev = entry->dev;
|
||||
struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
|
||||
const char *dev_name;
|
||||
|
||||
dev_name = vkms_config_get_device_name((struct vkms_config *)vkmsdev->config);
|
||||
seq_printf(m, "dev_name=%s\n", dev_name);
|
||||
seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback);
|
||||
seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor);
|
||||
seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay);
|
||||
|
||||
Reference in New Issue
Block a user