* [PATCH V2] drm/vkms: Remove useless call to drm_connector_register/unregister()
@ 2019-03-15 16:11 Rodrigo Siqueira
2019-05-20 0:58 ` Rodrigo Siqueira
0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Siqueira @ 2019-03-15 16:11 UTC (permalink / raw)
To: Daniel Vetter, David Airlie, Haneen Mohammed; +Cc: dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]
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; the same
issue exists with drm_connector_unregister(). Therefore, this commit
removes the unnecessary call to drm_connector_register() and
drm_connector_unregister().
Changes since v2:
* Remove unnecessary call to drm_connector_unregister()
* Remove unused label
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
---
drivers/gpu/drm/vkms/vkms_output.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 3b162b25312e..56fb5c2a2315 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -6,7 +6,6 @@
static void vkms_connector_destroy(struct drm_connector *connector)
{
- drm_connector_unregister(connector);
drm_connector_cleanup(connector);
}
@@ -71,12 +70,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) {
@@ -99,9 +92,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
drm_encoder_cleanup(encoder);
err_encoder:
- drm_connector_unregister(connector);
-
-err_connector_register:
drm_connector_cleanup(connector);
err_connector:
--
2.21.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH V2] drm/vkms: Remove useless call to drm_connector_register/unregister()
2019-03-15 16:11 [PATCH V2] drm/vkms: Remove useless call to drm_connector_register/unregister() Rodrigo Siqueira
@ 2019-05-20 0:58 ` Rodrigo Siqueira
0 siblings, 0 replies; 2+ messages in thread
From: Rodrigo Siqueira @ 2019-05-20 0:58 UTC (permalink / raw)
To: Daniel Vetter, David Airlie, Haneen Mohammed
Cc: dri-devel, Linux Kernel Mailing List
Hi Daniel,
I forgot to apply this patch. Is it ok for you if I apply it?
On Fri, Mar 15, 2019 at 1:11 PM Rodrigo Siqueira
<rodrigosiqueiramelo@gmail.com> wrote:
>
> 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; the same
> issue exists with drm_connector_unregister(). Therefore, this commit
> removes the unnecessary call to drm_connector_register() and
> drm_connector_unregister().
>
> Changes since v2:
> * Remove unnecessary call to drm_connector_unregister()
> * Remove unused label
>
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
> ---
> drivers/gpu/drm/vkms/vkms_output.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 3b162b25312e..56fb5c2a2315 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -6,7 +6,6 @@
>
> static void vkms_connector_destroy(struct drm_connector *connector)
> {
> - drm_connector_unregister(connector);
> drm_connector_cleanup(connector);
> }
>
> @@ -71,12 +70,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) {
> @@ -99,9 +92,6 @@ int vkms_output_init(struct vkms_device *vkmsdev)
> drm_encoder_cleanup(encoder);
>
> err_encoder:
> - drm_connector_unregister(connector);
> -
> -err_connector_register:
> drm_connector_cleanup(connector);
>
> err_connector:
> --
> 2.21.0
--
Rodrigo Siqueira
https://siqueira.tech
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-20 0:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 16:11 [PATCH V2] drm/vkms: Remove useless call to drm_connector_register/unregister() Rodrigo Siqueira
2019-05-20 0:58 ` Rodrigo Siqueira
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®