Skip to contentSkip to conversation

drm/vkms: Remove useless call to drm_connector_register()

PATCH Superseded Rodrigo Siqueira 2 participants 4 messages Mar 10, 2019 – Mar 11, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vkms: Remove useless call to drm_connector_register()

The function vkms_output_init() is invoked during the module initialization, and it handles the creation/configuration of the vkms essential elements (e.g., connectors, encoder, etc). Among the initializations, this function tries to initialize a connector and register it by calling drm_connector_register(). However, inside the drm_connector_register(), at the beginning of this function there is the following validation:

if (!connector->dev->registered)
return 0;

In this sense, invoke drm_connector_register() after initializing the connector has no effect because the register field is false. The connector register happens when drm_dev_register() is invoked. Therefore, this commit removes the drm_connector_register() from vkms_output_init().

---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +0 -6
index 3b162b25312e..a6cee4c279c2 100644
@@ -71,12 +71,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_connector_register(connector);
-	if (ret) {
-		DRM_ERROR("Failed to register connector\n");
-		goto err_connector_register;
-	}
-
 	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret) {
Signature · 5 lines
2.21.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Rodrigo Siqueira

The function vkms_output_init() is invoked during the module initialization, and it handles the creation/configuration of the vkms essential elements (e.g., connectors, encoder, etc). Among the initializations, this function tries to initialize a connector and register it by calling drm_connector_register(). However, inside the drm_connector_register(), at the beginning of this function there is the following validation:

if (!connector->dev->registered)
return 0;

In this sense, invoke drm_connector_register() after initializing the connector has no effect because the register field is false. The connector register happens when drm_dev_register() is invoked. Therefore, this commit removes the drm_connector_register() from vkms_output_init().

---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +0 -0
index 3b162b25312e..a6cee4c279c2 100644

drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev) · line 74

Quoted 4 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -1
@@ -71,12 +71,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_connector_register(connector);

Yeah that's only needed for connectors added when hotplugging at runtime, not for connectors which are created at driver load time.

btw same issue exists with the drm_connector_unregister, that's also not needed.
-Daniel

Quoted 10 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -5
-	if (ret) {
-		DRM_ERROR("Failed to register connector\n");
-		goto err_connector_register;
-	}
-
 	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret) {
Signature · 1 line
2.21.0
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
Quoted 36 lines · Daniel Vetter
Quoted 27 lines · Rodrigo Siqueira

The function vkms_output_init() is invoked during the module initialization, and it handles the creation/configuration of the vkms essential elements (e.g., connectors, encoder, etc). Among the initializations, this function tries to initialize a connector and register it by calling drm_connector_register(). However, inside the drm_connector_register(), at the beginning of this function there is the following validation:

if (!connector->dev->registered)
return 0;

In this sense, invoke drm_connector_register() after initializing the connector has no effect because the register field is false. The connector register happens when drm_dev_register() is invoked. Therefore, this commit removes the drm_connector_register() from vkms_output_init().

---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +0 -0
index 3b162b25312e..a6cee4c279c2 100644

drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev) · line 74

Quoted 4 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -1
@@ -71,12 +71,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_connector_register(connector);

Yeah that's only needed for connectors added when hotplugging at runtime, not for connectors which are created at driver load time.

Quoted 4 lines

btw same issue exists with the drm_connector_unregister, that's also not needed.

Thanks for your review :)

Should I send a V2 that also removes the drm_connector_unregister()? Or should I send it in a separated patch?

Best Regards

Quoted 17 lines

-Daniel

Quoted 10 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -5
-	if (ret) {
-		DRM_ERROR("Failed to register connector\n");
-		goto err_connector_register;
-	}
-
 	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret) {
Signature · 1 line
2.21.0
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 5 lines
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
#3 lore raw
Quoted 39 lines · Rodrigo Siqueira
Quoted 38 lines · Daniel Vetter
Quoted 27 lines · Rodrigo Siqueira

The function vkms_output_init() is invoked during the module initialization, and it handles the creation/configuration of the vkms essential elements (e.g., connectors, encoder, etc). Among the initializations, this function tries to initialize a connector and register it by calling drm_connector_register(). However, inside the drm_connector_register(), at the beginning of this function there is the following validation:

if (!connector->dev->registered)
return 0;

In this sense, invoke drm_connector_register() after initializing the connector has no effect because the register field is false. The connector register happens when drm_dev_register() is invoked. Therefore, this commit removes the drm_connector_register() from vkms_output_init().

---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +0 -0
index 3b162b25312e..a6cee4c279c2 100644

drivers/gpu/drm/vkms/vkms_output.c int vkms_output_init(struct vkms_device *vkmsdev) · line 74

Quoted 4 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -1
@@ -71,12 +71,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_connector_register(connector);

Yeah that's only needed for connectors added when hotplugging at runtime, not for connectors which are created at driver load time.

Quoted 7 lines
Quoted 2 lines

btw same issue exists with the drm_connector_unregister, that's also not needed.

Thanks for your review :)

Should I send a V2 that also removes the drm_connector_unregister()? Or should I send it in a separated patch?

Either is fine with me. Either has my r-b.
-Daniel

Quoted 34 lines

Best Regards

Quoted 17 lines

-Daniel

Quoted 10 lines
drivers/gpu/drm/vkms/vkms_output.c +0 -5
-	if (ret) {
-		DRM_ERROR("Failed to register connector\n");
-		goto err_connector_register;
-	}
-
 	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret) {
Signature · 1 line
2.21.0
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 12 lines
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch