Skip to content

Commit 16d22ba

Browse files
committed
drm/vkms: Switch to managed for encoder
The current VKMS driver uses non-managed function to create encoders. It is not an issue yet, but in order to support multiple devices easily, convert this code to use drm and device managed helpers. Reviewed-by: Maxime Ripard <[email protected]> Reviewed-by: Maíra Canal <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: José Expósito <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Louis Chauvet <[email protected]>
1 parent 0a3f3f7 commit 16d22ba

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/gpu/drm/vkms/vkms_output.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
1313
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
1414
};
1515

16-
static const struct drm_encoder_funcs vkms_encoder_funcs = {
17-
.destroy = drm_encoder_cleanup,
18-
};
19-
2016
static int vkms_conn_get_modes(struct drm_connector *connector)
2117
{
2218
int count;
@@ -84,8 +80,8 @@ int vkms_output_init(struct vkms_device *vkmsdev)
8480

8581
drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
8682

87-
ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
88-
DRM_MODE_ENCODER_VIRTUAL, NULL);
83+
ret = drmm_encoder_init(dev, encoder, NULL,
84+
DRM_MODE_ENCODER_VIRTUAL, NULL);
8985
if (ret) {
9086
DRM_ERROR("Failed to init encoder\n");
9187
return ret;
@@ -95,7 +91,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
9591
ret = drm_connector_attach_encoder(connector, encoder);
9692
if (ret) {
9793
DRM_ERROR("Failed to attach connector to encoder\n");
98-
goto err_attach;
94+
return ret;
9995
}
10096

10197
if (vkmsdev->config->writeback) {
@@ -108,7 +104,5 @@ int vkms_output_init(struct vkms_device *vkmsdev)
108104

109105
return 0;
110106

111-
err_attach:
112-
drm_encoder_cleanup(encoder);
113107
return ret;
114108
}

0 commit comments

Comments
 (0)