@@ -19,6 +19,23 @@ struct vkms_config *vkms_config_create(void)
return config;
}
+struct vkms_config *vkms_config_default_create(bool enable_cursor,
+ bool enable_writeback,
+ bool enable_overlay)
+{
+ struct vkms_config *config;
+
+ config = vkms_config_create();
+ if (IS_ERR(config))
+ return config;
+
+ config->cursor = enable_cursor;
+ config->writeback = enable_writeback;
+ config->overlay = enable_overlay;
+
+ return config;
+}
+
void vkms_config_destroy(struct vkms_config *config)
{
kfree(config);
@@ -17,6 +17,9 @@ struct vkms_config {
/* VKMS Config */
struct vkms_config *vkms_config_create(void);
+struct vkms_config *vkms_config_default_create(bool enable_cursor,
+ bool enable_writeback,
+ bool enable_overlay);
void vkms_config_destroy(struct vkms_config *config);
/* DebugFS */
@@ -219,16 +219,12 @@ static int __init vkms_init(void)
int ret;
struct vkms_config *config;
- config = vkms_config_create();
+ config = vkms_config_default_create(enable_cursor, enable_writeback, enable_overlay);
if (IS_ERR(config))
return PTR_ERR(config);
default_config = config;
- config->cursor = enable_cursor;
- config->writeback = enable_writeback;
- config->overlay = enable_overlay;
-
ret = vkms_create(config);
if (ret)
vkms_config_destroy(config);
Extract the initialization of the default configuration to a function. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com> --- drivers/gpu/drm/vkms/vkms_config.c | 17 +++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.h | 3 +++ drivers/gpu/drm/vkms/vkms_drv.c | 6 +----- 3 files changed, 21 insertions(+), 5 deletions(-)