dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Make connector registration automatic
@ 2016-06-17  8:25 Chris Wilson
  2016-06-17  8:25 ` [PATCH 1/7] drm: Automatically register/unregister all connectors Chris Wilson
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

The current recommendation is for new drivers to call:
	drm_dev_register();
	drm_connector_register_all();
because of a limitation in the API for old drivers using driver->load()
and being unable to call drm_connector_register() multiple times. Now
that drm_connector_register() is safe for multiple uses, we can combine
the two steps into one (drm_dev_register()).
-Chris

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 1/7] drm: Automatically register/unregister all connectors
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
@ 2016-06-17  8:25 ` Chris Wilson
  2016-06-17 12:43   ` Daniel Vetter
  2016-06-17  8:25 ` [PATCH 2/7] drm/arc: Remove redundant calls to drm_connector_register_all() Chris Wilson
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

As the drm_connector is now safe for multiple calls to
register/unregister, automatically perform a registration on all known
connectors drm drv_register (and unregister from drm_drv_unregister).
Drivers can still call drm_connector_register() and
drm_connector_unregister() individually, or defer as required.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_crtc.c |  6 +++---
 drivers/gpu/drm/drm_drv.c  | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 316dea9bea08..e7c862bd2f19 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1047,9 +1047,9 @@ EXPORT_SYMBOL(drm_connector_unregister);
  * @dev: drm device
  *
  * This function registers all connectors in sysfs and other places so that
- * userspace can start to access them. Drivers can call it after calling
- * drm_dev_register() to complete the device registration, if they don't call
- * drm_connector_register() on each connector individually.
+ * userspace can start to access them. drm_connector_register_all() is called
+ * automatically from drm_dev_register() to complete the device registration,
+ * if they don't call drm_connector_register() on each connector individually.
  *
  * When a device is unplugged and should be removed from userspace access,
  * call drm_connector_unregister_all(), which is the inverse of this
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 40fb4352432c..2067ff089380 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -650,11 +650,7 @@ EXPORT_SYMBOL(drm_dev_unref);
  *
  * Register the DRM device @dev with the system, advertise device to user-space
  * and start normal device operation. @dev must be allocated via drm_dev_alloc()
- * previously. Right after drm_dev_register() the driver should call
- * drm_connector_register_all() to register all connectors in sysfs. This is
- * a separate call for backward compatibility with drivers still using
- * the deprecated ->load() callback, where connectors are registered from within
- * the ->load() callback.
+ * previously.
  *
  * Never call this twice on any device!
  *
@@ -691,6 +687,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 			goto err_minors;
 	}
 
+	drm_connector_register_all(dev);
+
 	ret = 0;
 	goto out_unlock;
 
@@ -721,6 +719,8 @@ void drm_dev_unregister(struct drm_device *dev)
 
 	drm_lastclose(dev);
 
+	drm_connector_unregister_all(dev);
+
 	if (dev->driver->unload)
 		dev->driver->unload(dev);
 
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 2/7] drm/arc: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
  2016-06-17  8:25 ` [PATCH 1/7] drm: Automatically register/unregister all connectors Chris Wilson
@ 2016-06-17  8:25 ` Chris Wilson
  2016-06-17  8:25 ` [PATCH 3/7] drm/atmel-hlcdc: " Chris Wilson
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Daniel Vetter, intel-gfx, Alexey Brodkin

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 381c5fcbf903..ccbdadb108dc 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -211,15 +211,8 @@ static int arcpgu_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	ret = drm_connector_register_all(drm);
-	if (ret)
-		goto err_unregister;
-
 	return 0;
 
-err_unregister:
-	drm_dev_unregister(drm);
-
 err_unload:
 	arcpgu_unload(drm);
 
@@ -233,7 +226,6 @@ static int arcpgu_remove(struct platform_device *pdev)
 {
 	struct drm_device *drm = platform_get_drvdata(pdev);
 
-	drm_connector_unregister_all(drm);
 	drm_dev_unregister(drm);
 	arcpgu_unload(drm);
 	drm_dev_unref(drm);
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 3/7] drm/atmel-hlcdc: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
  2016-06-17  8:25 ` [PATCH 1/7] drm: Automatically register/unregister all connectors Chris Wilson
  2016-06-17  8:25 ` [PATCH 2/7] drm/arc: Remove redundant calls to drm_connector_register_all() Chris Wilson
@ 2016-06-17  8:25 ` Chris Wilson
  2016-06-18  0:41   ` Emil Velikov
  2016-06-17  8:25 ` [PATCH 4/7] drm/hisilicon: " Chris Wilson
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel; +Cc: David Airlie, Daniel Vetter, intel-gfx, Boris Brezillon

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

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 | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 9ecf16c7911d..99c4af697c8a 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -815,15 +815,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	ret = drm_connector_register_all(ddev);
-	if (ret)
-		goto err_unregister;
-
 	return 0;
 
-err_unregister:
-	drm_dev_unregister(ddev);
-
 err_unload:
 	atmel_hlcdc_dc_unload(ddev);
 
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 4/7] drm/hisilicon: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
                   ` (2 preceding siblings ...)
  2016-06-17  8:25 ` [PATCH 3/7] drm/atmel-hlcdc: " Chris Wilson
@ 2016-06-17  8:25 ` Chris Wilson
  2016-06-20  3:36   ` Xinliang Liu
  2016-06-17  8:25 ` [PATCH 5/7] drm/mediatek: " Chris Wilson
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, Daniel Vetter, intel-gfx, Xinliang Liu, Xinwei Kong,
	Chen Feng

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 193657259ee9..ef2c32ec1616 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -221,19 +221,12 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	/* connectors should be registered after drm device register */
-	ret = drm_connector_register_all(drm_dev);
-	if (ret)
-		goto err_drm_dev_unregister;
-
 	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
 		 driver->name, driver->major, driver->minor, driver->patchlevel,
 		 driver->date, drm_dev->primary->index);
 
 	return 0;
 
-err_drm_dev_unregister:
-	drm_dev_unregister(drm_dev);
 err_kms_cleanup:
 	kirin_drm_kms_cleanup(drm_dev);
 err_drm_dev_unref:
@@ -246,7 +239,6 @@ static void kirin_drm_unbind(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
 
-	drm_connector_unregister_all(drm_dev);
 	drm_dev_unregister(drm_dev);
 	kirin_drm_kms_cleanup(drm_dev);
 	drm_dev_unref(drm_dev);
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 5/7] drm/mediatek: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
                   ` (3 preceding siblings ...)
  2016-06-17  8:25 ` [PATCH 4/7] drm/hisilicon: " Chris Wilson
@ 2016-06-17  8:25 ` Chris Wilson
       [not found] ` <1466151923-1572-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
  2016-06-17  8:25 ` [PATCH 7/7] drm/rcar-du: " Chris Wilson
  6 siblings, 0 replies; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel
  Cc: Daniel Vetter, intel-gfx, linux-mediatek, Matthias Brugger,
	linux-arm-kernel

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index c33bf98c5d5e..7ab91f4a200f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -293,14 +293,8 @@ static int mtk_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto err_deinit;
 
-	ret = drm_connector_register_all(drm);
-	if (ret < 0)
-		goto err_unregister;
-
 	return 0;
 
-err_unregister:
-	drm_dev_unregister(drm);
 err_deinit:
 	mtk_drm_kms_deinit(drm);
 err_free:
@@ -455,7 +449,6 @@ static int mtk_drm_remove(struct platform_device *pdev)
 	struct drm_device *drm = private->drm;
 	int i;
 
-	drm_connector_unregister_all(drm);
 	drm_dev_unregister(drm);
 	mtk_drm_kms_deinit(drm);
 	drm_dev_unref(drm);
-- 
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] 14+ messages in thread

* [PATCH 6/7] drm/msm: Remove redundant calls to drm_connector_register_all()
       [not found] ` <1466151923-1572-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
@ 2016-06-17  8:25   ` Chris Wilson
  2016-06-17  9:14     ` Archit Taneja
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: David Airlie, Daniel Vetter,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Chris Wilson,
	Rob Clark, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robdclark@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
---
 drivers/gpu/drm/msm/msm_drv.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 9c654092ef78..568fcc328f27 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -197,8 +197,6 @@ static int msm_drm_uninit(struct device *dev)
 
 	drm_kms_helper_poll_fini(ddev);
 
-	drm_connector_unregister_all(ddev);
-
 	drm_dev_unregister(ddev);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
@@ -431,12 +429,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
 	if (ret)
 		goto fail;
 
-	ret = drm_connector_register_all(ddev);
-	if (ret) {
-		dev_err(dev, "failed to register connectors\n");
-		goto fail;
-	}
-
 	drm_mode_config_reset(ddev);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-- 
2.8.1

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* [PATCH 7/7] drm/rcar-du: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 Make connector registration automatic Chris Wilson
                   ` (5 preceding siblings ...)
       [not found] ` <1466151923-1572-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
@ 2016-06-17  8:25 ` Chris Wilson
  2016-06-21  8:56   ` Daniel Vetter
  2016-06-21  9:15   ` Laurent Pinchart
  6 siblings, 2 replies; 14+ messages in thread
From: Chris Wilson @ 2016-06-17  8:25 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, linux-renesas-soc, Laurent Pinchart

Up to now, the recommendation was for drivers to call drm_dev_register()
followed by drm_connector_register_all(). Now that
drm_connector_register() is safe against multiple invocations, we can
move drm_connector_register_all() to drm_dev_register() and not suffer
from any backwards compatibility issues with drivers not following the
more rigorous init ordering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 48ec4b6e8b26..36d390093c92 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -278,7 +278,6 @@ static int rcar_du_remove(struct platform_device *pdev)
 	struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
 	struct drm_device *ddev = rcdu->ddev;
 
-	drm_connector_unregister_all(ddev);
 	drm_dev_unregister(ddev);
 
 	if (rcdu->fbdev)
@@ -360,10 +359,6 @@ static int rcar_du_probe(struct platform_device *pdev)
 	if (ret)
 		goto error;
 
-	ret = drm_connector_register_all(ddev);
-	if (ret < 0)
-		goto error;
-
 	DRM_INFO("Device %s probed\n", dev_name(&pdev->dev));
 
 	return 0;
-- 
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] 14+ messages in thread

* Re: [PATCH 6/7] drm/msm: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25   ` [PATCH 6/7] drm/msm: " Chris Wilson
@ 2016-06-17  9:14     ` Archit Taneja
  0 siblings, 0 replies; 14+ messages in thread
From: Archit Taneja @ 2016-06-17  9:14 UTC (permalink / raw)
  To: Chris Wilson, dri-devel
  Cc: Daniel Vetter, intel-gfx, linux-arm-msm, freedreno



On 06/17/2016 01:55 PM, Chris Wilson wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
>

Tested-by: Archit Taneja <architt@codeaurora.org>

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> ---
>   drivers/gpu/drm/msm/msm_drv.c | 8 --------
>   1 file changed, 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 9c654092ef78..568fcc328f27 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -197,8 +197,6 @@ static int msm_drm_uninit(struct device *dev)
>
>   	drm_kms_helper_poll_fini(ddev);
>
> -	drm_connector_unregister_all(ddev);
> -
>   	drm_dev_unregister(ddev);
>
>   #ifdef CONFIG_DRM_FBDEV_EMULATION
> @@ -431,12 +429,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
>   	if (ret)
>   		goto fail;
>
> -	ret = drm_connector_register_all(ddev);
> -	if (ret) {
> -		dev_err(dev, "failed to register connectors\n");
> -		goto fail;
> -	}
> -
>   	drm_mode_config_reset(ddev);
>
>   #ifdef CONFIG_DRM_FBDEV_EMULATION
>

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation

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

* Re: [PATCH 1/7] drm: Automatically register/unregister all connectors
  2016-06-17  8:25 ` [PATCH 1/7] drm: Automatically register/unregister all connectors Chris Wilson
@ 2016-06-17 12:43   ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2016-06-17 12:43 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Fri, Jun 17, 2016 at 09:25:17AM +0100, Chris Wilson wrote:
> As the drm_connector is now safe for multiple calls to
> register/unregister, automatically perform a registration on all known
> connectors drm drv_register (and unregister from drm_drv_unregister).
> Drivers can still call drm_connector_register() and
> drm_connector_unregister() individually, or defer as required.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org

Applied to drm-misc. I'll let driver maintainers have a little bit more
time to ack or test the patches before I vacuum them up.

Thanks, Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c |  6 +++---
>  drivers/gpu/drm/drm_drv.c  | 10 +++++-----
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 316dea9bea08..e7c862bd2f19 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1047,9 +1047,9 @@ EXPORT_SYMBOL(drm_connector_unregister);
>   * @dev: drm device
>   *
>   * This function registers all connectors in sysfs and other places so that
> - * userspace can start to access them. Drivers can call it after calling
> - * drm_dev_register() to complete the device registration, if they don't call
> - * drm_connector_register() on each connector individually.
> + * userspace can start to access them. drm_connector_register_all() is called
> + * automatically from drm_dev_register() to complete the device registration,
> + * if they don't call drm_connector_register() on each connector individually.
>   *
>   * When a device is unplugged and should be removed from userspace access,
>   * call drm_connector_unregister_all(), which is the inverse of this
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 40fb4352432c..2067ff089380 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -650,11 +650,7 @@ EXPORT_SYMBOL(drm_dev_unref);
>   *
>   * Register the DRM device @dev with the system, advertise device to user-space
>   * and start normal device operation. @dev must be allocated via drm_dev_alloc()
> - * previously. Right after drm_dev_register() the driver should call
> - * drm_connector_register_all() to register all connectors in sysfs. This is
> - * a separate call for backward compatibility with drivers still using
> - * the deprecated ->load() callback, where connectors are registered from within
> - * the ->load() callback.
> + * previously.
>   *
>   * Never call this twice on any device!
>   *
> @@ -691,6 +687,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>  			goto err_minors;
>  	}
>  
> +	drm_connector_register_all(dev);
> +
>  	ret = 0;
>  	goto out_unlock;
>  
> @@ -721,6 +719,8 @@ void drm_dev_unregister(struct drm_device *dev)
>  
>  	drm_lastclose(dev);
>  
> +	drm_connector_unregister_all(dev);
> +
>  	if (dev->driver->unload)
>  		dev->driver->unload(dev);
>  
> -- 
> 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] 14+ messages in thread

* Re: [PATCH 3/7] drm/atmel-hlcdc: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 ` [PATCH 3/7] drm/atmel-hlcdc: " Chris Wilson
@ 2016-06-18  0:41   ` Emil Velikov
  0 siblings, 0 replies; 14+ messages in thread
From: Emil Velikov @ 2016-06-18  0:41 UTC (permalink / raw)
  To: Chris Wilson
  Cc: David Airlie, Daniel Vetter, intel-gfx@lists.freedesktop.org,
	ML dri-devel, Boris Brezillon

On 17 June 2016 at 09:25, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
>
> 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 | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 9ecf16c7911d..99c4af697c8a 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -815,15 +815,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
>         if (ret)
>                 goto err_unload;
>
> -       ret = drm_connector_register_all(ddev);
> -       if (ret)
> -               goto err_unregister;
> -
>         return 0;
>
> -err_unregister:
> -       drm_dev_unregister(ddev);
> -
>  err_unload:
>         atmel_hlcdc_dc_unload(ddev);
>
This should also kill off atmel_hlcdc_dc_connector_unplug_all() ? The
later of which has calls drm_connector_unregister_all() guarded by
mode_config.mutex :-\

-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 4/7] drm/hisilicon: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 ` [PATCH 4/7] drm/hisilicon: " Chris Wilson
@ 2016-06-20  3:36   ` Xinliang Liu
  0 siblings, 0 replies; 14+ messages in thread
From: Xinliang Liu @ 2016-06-20  3:36 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Xinliang Liu, Daniel Vetter, Intel Graphics Development,
	dri-devel, Chen Feng

Hi,

On 17 June 2016 at 16:25, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> Cc: Chen Feng <puck.chen@hisilicon.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org

This patch looks fine to me. Thank you for your patch.

Acked-by: Xinliang Liu <z.liuxinliang@hisilicon.com>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 193657259ee9..ef2c32ec1616 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -221,19 +221,12 @@ static int kirin_drm_bind(struct device *dev)
>         if (ret)
>                 goto err_kms_cleanup;
>
> -       /* connectors should be registered after drm device register */
> -       ret = drm_connector_register_all(drm_dev);
> -       if (ret)
> -               goto err_drm_dev_unregister;
> -
>         DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
>                  driver->name, driver->major, driver->minor, driver->patchlevel,
>                  driver->date, drm_dev->primary->index);
>
>         return 0;
>
> -err_drm_dev_unregister:
> -       drm_dev_unregister(drm_dev);
>  err_kms_cleanup:
>         kirin_drm_kms_cleanup(drm_dev);
>  err_drm_dev_unref:
> @@ -246,7 +239,6 @@ static void kirin_drm_unbind(struct device *dev)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(dev);
>
> -       drm_connector_unregister_all(drm_dev);
>         drm_dev_unregister(drm_dev);
>         kirin_drm_kms_cleanup(drm_dev);
>         drm_dev_unref(drm_dev);
> --
> 2.8.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 7/7] drm/rcar-du: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 ` [PATCH 7/7] drm/rcar-du: " Chris Wilson
@ 2016-06-21  8:56   ` Daniel Vetter
  2016-06-21  9:15   ` Laurent Pinchart
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2016-06-21  8:56 UTC (permalink / raw)
  To: Chris Wilson
  Cc: dri-devel, intel-gfx, Daniel Vetter, Laurent Pinchart,
	David Airlie, linux-renesas-soc

On Fri, Jun 17, 2016 at 09:25:23AM +0100, Chris Wilson wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-renesas-soc@vger.kernel.org

Ok, merged the driver patches now. Would be good to unexport/static
drm_connector_register_all, and I think there's a few drivers (like vc4)
which open-coded it.
-Daniel

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 48ec4b6e8b26..36d390093c92 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -278,7 +278,6 @@ static int rcar_du_remove(struct platform_device *pdev)
>  	struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
>  	struct drm_device *ddev = rcdu->ddev;
>  
> -	drm_connector_unregister_all(ddev);
>  	drm_dev_unregister(ddev);
>  
>  	if (rcdu->fbdev)
> @@ -360,10 +359,6 @@ static int rcar_du_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto error;
>  
> -	ret = drm_connector_register_all(ddev);
> -	if (ret < 0)
> -		goto error;
> -
>  	DRM_INFO("Device %s probed\n", dev_name(&pdev->dev));
>  
>  	return 0;
> -- 
> 2.8.1
> 

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

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

* Re: [PATCH 7/7] drm/rcar-du: Remove redundant calls to drm_connector_register_all()
  2016-06-17  8:25 ` [PATCH 7/7] drm/rcar-du: " Chris Wilson
  2016-06-21  8:56   ` Daniel Vetter
@ 2016-06-21  9:15   ` Laurent Pinchart
  1 sibling, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2016-06-21  9:15 UTC (permalink / raw)
  To: Chris Wilson
  Cc: David Airlie, Daniel Vetter, intel-gfx, linux-renesas-soc,
	dri-devel

Hi Chris,

Thank you for the patch.

On Friday 17 Jun 2016 09:25:23 Chris Wilson wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-renesas-soc@vger.kernel.org

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 48ec4b6e8b26..36d390093c92
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -278,7 +278,6 @@ static int rcar_du_remove(struct platform_device *pdev)
>  	struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
>  	struct drm_device *ddev = rcdu->ddev;
> 
> -	drm_connector_unregister_all(ddev);
>  	drm_dev_unregister(ddev);
> 
>  	if (rcdu->fbdev)
> @@ -360,10 +359,6 @@ static int rcar_du_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto error;
> 
> -	ret = drm_connector_register_all(ddev);
> -	if (ret < 0)
> -		goto error;
> -
>  	DRM_INFO("Device %s probed\n", dev_name(&pdev->dev));
> 
>  	return 0;

-- 
Regards,

Laurent Pinchart

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-06-21  9:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17  8:25 Make connector registration automatic Chris Wilson
2016-06-17  8:25 ` [PATCH 1/7] drm: Automatically register/unregister all connectors Chris Wilson
2016-06-17 12:43   ` Daniel Vetter
2016-06-17  8:25 ` [PATCH 2/7] drm/arc: Remove redundant calls to drm_connector_register_all() Chris Wilson
2016-06-17  8:25 ` [PATCH 3/7] drm/atmel-hlcdc: " Chris Wilson
2016-06-18  0:41   ` Emil Velikov
2016-06-17  8:25 ` [PATCH 4/7] drm/hisilicon: " Chris Wilson
2016-06-20  3:36   ` Xinliang Liu
2016-06-17  8:25 ` [PATCH 5/7] drm/mediatek: " Chris Wilson
     [not found] ` <1466151923-1572-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2016-06-17  8:25   ` [PATCH 6/7] drm/msm: " Chris Wilson
2016-06-17  9:14     ` Archit Taneja
2016-06-17  8:25 ` [PATCH 7/7] drm/rcar-du: " Chris Wilson
2016-06-21  8:56   ` Daniel Vetter
2016-06-21  9:15   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox