All of lore.kernel.org
 help / color / mirror / Atom feed
* drm_connector_register_all() stragglers
@ 2016-06-21  9:28 Chris Wilson
  2016-06-21  9:28 ` [PATCH 1/3] drm/atmel-hlcdc: Remove redundant call to drm_connector_unregister_all() Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Chris Wilson @ 2016-06-21  9:28 UTC (permalink / raw)
  To: dri-devel

A couple of drivers open-coded drm_connector_register_all() and so were
missed in my last pass. Also Emil pointed out that atmel-hlcdc also had
a redundant drm_connector_unregister_all() we could remove.
-Chris

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

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

* [PATCH 1/3] drm/atmel-hlcdc: Remove redundant call to drm_connector_unregister_all()
  2016-06-21  9:28 drm_connector_register_all() stragglers Chris Wilson
@ 2016-06-21  9:28 ` Chris Wilson
  2016-06-21  9:28 ` [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all() Chris Wilson
  2016-06-21  9:28   ` Chris Wilson
  2 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2016-06-21  9:28 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

drm_connector_unregister_all() is not automatically called by
drm_dev_unregister() so we can drop the local call.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 99c4af697c8a..d4a3d61b7b06 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -691,13 +691,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	destroy_workqueue(dc->wq);
 }
 
-static void atmel_hlcdc_dc_connector_unplug_all(struct drm_device *dev)
-{
-	mutex_lock(&dev->mode_config.mutex);
-	drm_connector_unregister_all(dev);
-	mutex_unlock(&dev->mode_config.mutex);
-}
-
 static void atmel_hlcdc_dc_lastclose(struct drm_device *dev)
 {
 	struct atmel_hlcdc_dc *dc = dev->dev_private;
@@ -830,7 +823,6 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev)
 {
 	struct drm_device *ddev = platform_get_drvdata(pdev);
 
-	atmel_hlcdc_dc_connector_unplug_all(ddev);
 	drm_dev_unregister(ddev);
 	atmel_hlcdc_dc_unload(ddev);
 	drm_dev_unref(ddev);
-- 
2.8.1

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

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

* [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all()
  2016-06-21  9:28 drm_connector_register_all() stragglers Chris Wilson
  2016-06-21  9:28 ` [PATCH 1/3] drm/atmel-hlcdc: Remove redundant call to drm_connector_unregister_all() Chris Wilson
@ 2016-06-21  9:28 ` Chris Wilson
  2016-06-21  9:48   ` Daniel Vetter
  2016-06-21  9:28   ` Chris Wilson
  2 siblings, 1 reply; 8+ messages in thread
From: Chris Wilson @ 2016-06-21  9:28 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter

drm_dev_register() will now register all known connectors, so we no
longer have to do so manually.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/vc4/vc4_drv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 98cf2c4d622e..1cd6b7b36241 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -211,22 +211,10 @@ static int vc4_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto unbind_all;
 
-	/* Connector registration has to occur after DRM device
-	 * registration, because it creates sysfs entries based on the
-	 * DRM device.
-	 */
-	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
-		ret = drm_connector_register(connector);
-		if (ret)
-			goto unregister;
-	}
-
 	vc4_kms_load(drm);
 
 	return 0;
 
-unregister:
-	drm_dev_unregister(drm);
 unbind_all:
 	component_unbind_all(dev, drm);
 gem_destroy:
-- 
2.8.1

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

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

* [PATCH 3/3] drm/sun4i: Remove open-coded drm_connector_register_all()
  2016-06-21  9:28 drm_connector_register_all() stragglers Chris Wilson
@ 2016-06-21  9:28   ` Chris Wilson
  2016-06-21  9:28 ` [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all() Chris Wilson
  2016-06-21  9:28   ` Chris Wilson
  2 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2016-06-21  9:28 UTC (permalink / raw)
  To: linux-arm-kernel

drm_dev_register() will now register all known connectors, so we no
longer have to do so manually.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel at lists.freedesktop.org
Cc: linux-arm-kernel at lists.infradead.org
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 68e9d85085fb..59cd8b27ee02 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -24,34 +24,6 @@
 #include "sun4i_layer.h"
 #include "sun4i_tcon.h"
 
-static int sun4i_drv_connector_plug_all(struct drm_device *drm)
-{
-	struct drm_connector *connector, *failed;
-	int ret;
-
-	mutex_lock(&drm->mode_config.mutex);
-	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
-		ret = drm_connector_register(connector);
-		if (ret) {
-			failed = connector;
-			goto err;
-		}
-	}
-	mutex_unlock(&drm->mode_config.mutex);
-	return 0;
-
-err:
-	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
-		if (failed == connector)
-			break;
-
-		drm_connector_unregister(connector);
-	}
-	mutex_unlock(&drm->mode_config.mutex);
-
-	return ret;
-}
-
 static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe)
 {
 	struct sun4i_drv *drv = drm->dev_private;
@@ -187,14 +159,8 @@ static int sun4i_drv_bind(struct device *dev)
 	if (ret)
 		goto free_drm;
 
-	ret = sun4i_drv_connector_plug_all(drm);
-	if (ret)
-		goto unregister_drm;
-
 	return 0;
 
-unregister_drm:
-	drm_dev_unregister(drm);
 free_drm:
 	drm_dev_unref(drm);
 	return ret;
-- 
2.8.1

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

* [PATCH 3/3] drm/sun4i: Remove open-coded drm_connector_register_all()
@ 2016-06-21  9:28   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2016-06-21  9:28 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel

drm_dev_register() will now register all known connectors, so we no
longer have to do so manually.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 68e9d85085fb..59cd8b27ee02 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -24,34 +24,6 @@
 #include "sun4i_layer.h"
 #include "sun4i_tcon.h"
 
-static int sun4i_drv_connector_plug_all(struct drm_device *drm)
-{
-	struct drm_connector *connector, *failed;
-	int ret;
-
-	mutex_lock(&drm->mode_config.mutex);
-	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
-		ret = drm_connector_register(connector);
-		if (ret) {
-			failed = connector;
-			goto err;
-		}
-	}
-	mutex_unlock(&drm->mode_config.mutex);
-	return 0;
-
-err:
-	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
-		if (failed == connector)
-			break;
-
-		drm_connector_unregister(connector);
-	}
-	mutex_unlock(&drm->mode_config.mutex);
-
-	return ret;
-}
-
 static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe)
 {
 	struct sun4i_drv *drv = drm->dev_private;
@@ -187,14 +159,8 @@ static int sun4i_drv_bind(struct device *dev)
 	if (ret)
 		goto free_drm;
 
-	ret = sun4i_drv_connector_plug_all(drm);
-	if (ret)
-		goto unregister_drm;
-
 	return 0;
 
-unregister_drm:
-	drm_dev_unregister(drm);
 free_drm:
 	drm_dev_unref(drm);
 	return ret;
-- 
2.8.1

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

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

* Re: [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all()
  2016-06-21  9:28 ` [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all() Chris Wilson
@ 2016-06-21  9:48   ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2016-06-21  9:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: dri-devel, Daniel Vetter

On Tue, Jun 21, 2016 at 10:28:02AM +0100, Chris Wilson wrote:
> drm_dev_register() will now register all known connectors, so we no
> longer have to do so manually.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/vc4/vc4_drv.c | 12 ------------
>  1 file changed, 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 98cf2c4d622e..1cd6b7b36241 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -211,22 +211,10 @@ static int vc4_drm_bind(struct device *dev)
>  	if (ret < 0)
>  		goto unbind_all;
>  
> -	/* Connector registration has to occur after DRM device
> -	 * registration, because it creates sysfs entries based on the
> -	 * DRM device.
> -	 */
> -	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
> -		ret = drm_connector_register(connector);
> -		if (ret)
> -			goto unregister;
> -	}
> -
>  	vc4_kms_load(drm);

Semi-related: This should be called before drm_dev_register, with this
ordering userspace might be able to peak at a not-yet set up drm device.
-Daniel

>  
>  	return 0;
>  
> -unregister:
> -	drm_dev_unregister(drm);
>  unbind_all:
>  	component_unbind_all(dev, drm);
>  gem_destroy:
> -- 
> 2.8.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 3/3] drm/sun4i: Remove open-coded drm_connector_register_all()
  2016-06-21  9:28   ` Chris Wilson
@ 2016-06-22  8:03     ` Daniel Vetter
  -1 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2016-06-22  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2016 at 10:28:03AM +0100, Chris Wilson wrote:
> drm_dev_register() will now register all known connectors, so we no
> longer have to do so manually.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: dri-devel at lists.freedesktop.org
> Cc: linux-arm-kernel at lists.infradead.org

Merged all 3 to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 68e9d85085fb..59cd8b27ee02 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -24,34 +24,6 @@
>  #include "sun4i_layer.h"
>  #include "sun4i_tcon.h"
>  
> -static int sun4i_drv_connector_plug_all(struct drm_device *drm)
> -{
> -	struct drm_connector *connector, *failed;
> -	int ret;
> -
> -	mutex_lock(&drm->mode_config.mutex);
> -	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
> -		ret = drm_connector_register(connector);
> -		if (ret) {
> -			failed = connector;
> -			goto err;
> -		}
> -	}
> -	mutex_unlock(&drm->mode_config.mutex);
> -	return 0;
> -
> -err:
> -	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
> -		if (failed == connector)
> -			break;
> -
> -		drm_connector_unregister(connector);
> -	}
> -	mutex_unlock(&drm->mode_config.mutex);
> -
> -	return ret;
> -}
> -
>  static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe)
>  {
>  	struct sun4i_drv *drv = drm->dev_private;
> @@ -187,14 +159,8 @@ static int sun4i_drv_bind(struct device *dev)
>  	if (ret)
>  		goto free_drm;
>  
> -	ret = sun4i_drv_connector_plug_all(drm);
> -	if (ret)
> -		goto unregister_drm;
> -
>  	return 0;
>  
> -unregister_drm:
> -	drm_dev_unregister(drm);
>  free_drm:
>  	drm_dev_unref(drm);
>  	return ret;
> -- 
> 2.8.1
> 

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

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

* Re: [PATCH 3/3] drm/sun4i: Remove open-coded drm_connector_register_all()
@ 2016-06-22  8:03     ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2016-06-22  8:03 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Daniel Vetter, dri-devel, Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel

On Tue, Jun 21, 2016 at 10:28:03AM +0100, Chris Wilson wrote:
> drm_dev_register() will now register all known connectors, so we no
> longer have to do so manually.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-arm-kernel@lists.infradead.org

Merged all 3 to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 68e9d85085fb..59cd8b27ee02 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -24,34 +24,6 @@
>  #include "sun4i_layer.h"
>  #include "sun4i_tcon.h"
>  
> -static int sun4i_drv_connector_plug_all(struct drm_device *drm)
> -{
> -	struct drm_connector *connector, *failed;
> -	int ret;
> -
> -	mutex_lock(&drm->mode_config.mutex);
> -	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
> -		ret = drm_connector_register(connector);
> -		if (ret) {
> -			failed = connector;
> -			goto err;
> -		}
> -	}
> -	mutex_unlock(&drm->mode_config.mutex);
> -	return 0;
> -
> -err:
> -	list_for_each_entry(connector, &drm->mode_config.connector_list, head) {
> -		if (failed == connector)
> -			break;
> -
> -		drm_connector_unregister(connector);
> -	}
> -	mutex_unlock(&drm->mode_config.mutex);
> -
> -	return ret;
> -}
> -
>  static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe)
>  {
>  	struct sun4i_drv *drv = drm->dev_private;
> @@ -187,14 +159,8 @@ static int sun4i_drv_bind(struct device *dev)
>  	if (ret)
>  		goto free_drm;
>  
> -	ret = sun4i_drv_connector_plug_all(drm);
> -	if (ret)
> -		goto unregister_drm;
> -
>  	return 0;
>  
> -unregister_drm:
> -	drm_dev_unregister(drm);
>  free_drm:
>  	drm_dev_unref(drm);
>  	return ret;
> -- 
> 2.8.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-06-22  8:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21  9:28 drm_connector_register_all() stragglers Chris Wilson
2016-06-21  9:28 ` [PATCH 1/3] drm/atmel-hlcdc: Remove redundant call to drm_connector_unregister_all() Chris Wilson
2016-06-21  9:28 ` [PATCH 2/3] drm/vc4: Remove open-coded drm_connector_register_all() Chris Wilson
2016-06-21  9:48   ` Daniel Vetter
2016-06-21  9:28 ` [PATCH 3/3] drm/sun4i: " Chris Wilson
2016-06-21  9:28   ` Chris Wilson
2016-06-22  8:03   ` Daniel Vetter
2016-06-22  8:03     ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.