linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/vkms: Remove useless call to drm_connector_register()
@ 2019-03-10 21:22 Rodrigo Siqueira
  2019-03-11 13:29 ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Rodrigo Siqueira @ 2019-03-10 21:22 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Haneen Mohammed; +Cc: dri-devel, linux-kernel

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().

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 drivers/gpu/drm/vkms/vkms_output.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 3b162b25312e..a6cee4c279c2 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -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) {
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vkms: Remove useless call to drm_connector_register()
  2019-03-10 21:22 [PATCH] drm/vkms: Remove useless call to drm_connector_register() Rodrigo Siqueira
@ 2019-03-11 13:29 ` Daniel Vetter
  2019-03-11 18:00   ` Rodrigo Siqueira
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2019-03-11 13:29 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: Daniel Vetter, David Airlie, Haneen Mohammed, dri-devel, linux-kernel

On Sun, Mar 10, 2019 at 06:22:41PM -0300, Rodrigo Siqueira 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.
> Therefore, this commit removes the drm_connector_register() from
> vkms_output_init().
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  drivers/gpu/drm/vkms/vkms_output.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 3b162b25312e..a6cee4c279c2 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -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.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

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

> -	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) {
> -- 
> 2.21.0

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vkms: Remove useless call to drm_connector_register()
  2019-03-11 13:29 ` Daniel Vetter
@ 2019-03-11 18:00   ` Rodrigo Siqueira
  2019-03-11 18:50     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Rodrigo Siqueira @ 2019-03-11 18:00 UTC (permalink / raw)
  To: David Airlie, Haneen Mohammed, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

On 03/11, Daniel Vetter wrote:
> On Sun, Mar 10, 2019 at 06:22:41PM -0300, Rodrigo Siqueira 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.
> > Therefore, this commit removes the drm_connector_register() from
> > vkms_output_init().
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  drivers/gpu/drm/vkms/vkms_output.c | 6 ------
> >  1 file changed, 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > index 3b162b25312e..a6cee4c279c2 100644
> > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > @@ -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.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> 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

> -Daniel
> 
> > -	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) {
> > -- 
> > 2.21.0
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vkms: Remove useless call to drm_connector_register()
  2019-03-11 18:00   ` Rodrigo Siqueira
@ 2019-03-11 18:50     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2019-03-11 18:50 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: David Airlie, Haneen Mohammed, dri-devel, linux-kernel

On Mon, Mar 11, 2019 at 03:00:04PM -0300, Rodrigo Siqueira wrote:
> On 03/11, Daniel Vetter wrote:
> > On Sun, Mar 10, 2019 at 06:22:41PM -0300, Rodrigo Siqueira 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.
> > > Therefore, this commit removes the drm_connector_register() from
> > > vkms_output_init().
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > ---
> > >  drivers/gpu/drm/vkms/vkms_output.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > > index 3b162b25312e..a6cee4c279c2 100644
> > > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > > @@ -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.
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > 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

> 
> Best Regards
> 
> > -Daniel
> > 
> > > -	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) {
> > > -- 
> > > 2.21.0
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Rodrigo Siqueira
> https://siqueira.tech
> Graduate Student
> Department of Computer Science
> University of São Paulo



> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-11 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-10 21:22 [PATCH] drm/vkms: Remove useless call to drm_connector_register() Rodrigo Siqueira
2019-03-11 13:29 ` Daniel Vetter
2019-03-11 18:00   ` Rodrigo Siqueira
2019-03-11 18:50     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).