* [PATCH 0/4 v2] drm: introduce drm_connector_register_all() helper
@ 2016-03-21 12:28 Alexey Brodkin
2016-03-21 12:28 ` [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all() Alexey Brodkin
2016-03-21 12:28 ` [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper Alexey Brodkin
0 siblings, 2 replies; 5+ messages in thread
From: Alexey Brodkin @ 2016-03-21 12:28 UTC (permalink / raw)
To: dri-devel
Cc: linux-kernel, Alexey Brodkin, Daniel Vetter, David Airlie,
Boris Brezillon, Laurent Pinchart, linux-renesas-soc
As a pair to already existing drm_connector_unplug_all()
(which we'll rename in this series to drm_connector_unregister_all())
we're adding generic implementation of what is already done in some drivers
for registering all connectors.
After implementation of that new helper we're updating 2 drivers
that used to use it's own implementation:
[1] atmel_hlcdc
[2] rcar_du
And one driver that uses unregister():
[1] udl
Other drivers still use load() callback and so should be first modified so
their load() gets called from their probe() explicitly.
Build- and run-tested on yet to be upstreamed ARC PGU (part of AXS10x board).
Changes v1 -> v2:
* Rename drm_connector_unplug_all() to drm_connector_unregister_all()
* Use drm_for_each_connector() instead of list_for_each_entry()
* Updated kerneldoc for drm_dev_register()
Alexey Brodkin (4):
drm: rename drm_connector_unplug_all() to
drm_connector_unregister_all()
drm: introduce drm_connector_register_all() helper
drm: atmel_hldc - use generic drm_connector_register_all() helper
drm: rcar-du - use generic drm_connector_register_all() helper
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 39 +------------------
drivers/gpu/drm/drm_crtc.c | 56 +++++++++++++++++++++++++---
drivers/gpu/drm/drm_drv.c | 6 ++-
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 14 +------
drivers/gpu/drm/udl/udl_drv.c | 2 +-
include/drm/drm_crtc.h | 5 ++-
6 files changed, 63 insertions(+), 59 deletions(-)
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
--
2.5.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all()
2016-03-21 12:28 [PATCH 0/4 v2] drm: introduce drm_connector_register_all() helper Alexey Brodkin
@ 2016-03-21 12:28 ` Alexey Brodkin
2016-03-21 13:23 ` Laurent Pinchart
2016-03-21 12:28 ` [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper Alexey Brodkin
1 sibling, 1 reply; 5+ messages in thread
From: Alexey Brodkin @ 2016-03-21 12:28 UTC (permalink / raw)
To: dri-devel
Cc: linux-kernel, Alexey Brodkin, Daniel Vetter, David Airlie,
Boris Brezillon, Laurent Pinchart, linux-renesas-soc
Current name is a bit misleading because what that helper function
really does it calls drm_connector_unregister() for all connectors.
This all has nothing to do with hotplugging so let's name things
properly.
And while at it remove potentially dangerous locking around
drm_connector_unregister() in rcar_du_remove() as mentioned
in kerneldoc for drm_connector_unregister_all().
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
Changes v1 -> v2:
* This patch was only introduced in v2.
drivers/gpu/drm/drm_crtc.c | 6 +++---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 +----
drivers/gpu/drm/udl/udl_drv.c | 2 +-
include/drm/drm_crtc.h | 4 ++--
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 65258ac..76453cd 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1082,14 +1082,14 @@ EXPORT_SYMBOL(drm_connector_unregister);
/**
- * drm_connector_unplug_all - unregister connector userspace interfaces
+ * drm_connector_unregister_all - unregister connector userspace interfaces
* @dev: drm device
*
* This function unregisters all connector userspace interfaces in sysfs. Should
* be call when the device is disconnected, e.g. from an usb driver's
* ->disconnect callback.
*/
-void drm_connector_unplug_all(struct drm_device *dev)
+void drm_connector_unregister_all(struct drm_device *dev)
{
struct drm_connector *connector;
@@ -1098,7 +1098,7 @@ void drm_connector_unplug_all(struct drm_device *dev)
drm_connector_unregister(connector);
}
-EXPORT_SYMBOL(drm_connector_unplug_all);
+EXPORT_SYMBOL(drm_connector_unregister_all);
/**
* drm_encoder_init - Init a preallocated encoder
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index ed6006b..644db36 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -278,10 +278,7 @@ static int rcar_du_remove(struct platform_device *pdev)
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
struct drm_device *ddev = rcdu->ddev;
- mutex_lock(&ddev->mode_config.mutex);
- drm_connector_unplug_all(ddev);
- mutex_unlock(&ddev->mode_config.mutex);
-
+ drm_connector_unregister_all(ddev);
drm_dev_unregister(ddev);
if (rcdu->fbdev)
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 772ec9e..c204089 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -94,7 +94,7 @@ static void udl_usb_disconnect(struct usb_interface *interface)
struct drm_device *dev = usb_get_intfdata(interface);
drm_kms_helper_poll_disable(dev);
- drm_connector_unplug_all(dev);
+ drm_connector_unregister_all(dev);
udl_fbdev_unplug(dev);
udl_drop_usb(dev);
drm_unplug_dev(dev);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 8c7fb3d..42d9f4d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -2214,8 +2214,8 @@ void drm_connector_unregister(struct drm_connector *connector);
extern void drm_connector_cleanup(struct drm_connector *connector);
extern unsigned int drm_connector_index(struct drm_connector *connector);
-/* helper to unplug all connectors from sysfs for device */
-extern void drm_connector_unplug_all(struct drm_device *dev);
+/* helper to unregister all connectors from sysfs for device */
+extern void drm_connector_unregister_all(struct drm_device *dev);
extern int drm_bridge_add(struct drm_bridge *bridge);
extern void drm_bridge_remove(struct drm_bridge *bridge);
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all()
2016-03-21 12:28 ` [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all() Alexey Brodkin
@ 2016-03-21 13:23 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-03-21 13:23 UTC (permalink / raw)
To: dri-devel; +Cc: Alexey Brodkin, linux-kernel, linux-renesas-soc
Hi Alexey,
Thank you for the patch.
On Monday 21 Mar 2016 15:28:37 Alexey Brodkin wrote:
> Current name is a bit misleading because what that helper function
> really does it calls drm_connector_unregister() for all connectors.
>
> This all has nothing to do with hotplugging so let's name things
> properly.
>
> And while at it remove potentially dangerous locking around
> drm_connector_unregister() in rcar_du_remove() as mentioned
> in kerneldoc for drm_connector_unregister_all().
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>
> Changes v1 -> v2:
> * This patch was only introduced in v2.
>
> drivers/gpu/drm/drm_crtc.c | 6 +++---
> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 5 +----
> drivers/gpu/drm/udl/udl_drv.c | 2 +-
> include/drm/drm_crtc.h | 4 ++--
> 4 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 65258ac..76453cd 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1082,14 +1082,14 @@ EXPORT_SYMBOL(drm_connector_unregister);
>
>
> /**
> - * drm_connector_unplug_all - unregister connector userspace interfaces
> + * drm_connector_unregister_all - unregister connector userspace interfaces
> * @dev: drm device
> *
> * This function unregisters all connector userspace interfaces in sysfs.
> Should * be call when the device is disconnected, e.g. from an usb driver's
> * ->disconnect callback.
> */
> -void drm_connector_unplug_all(struct drm_device *dev)
> +void drm_connector_unregister_all(struct drm_device *dev)
> {
> struct drm_connector *connector;
>
> @@ -1098,7 +1098,7 @@ void drm_connector_unplug_all(struct drm_device *dev)
> drm_connector_unregister(connector);
>
> }
> -EXPORT_SYMBOL(drm_connector_unplug_all);
> +EXPORT_SYMBOL(drm_connector_unregister_all);
>
> /**
> * drm_encoder_init - Init a preallocated encoder
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index ed6006b..644db36 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -278,10 +278,7 @@ static int rcar_du_remove(struct platform_device *pdev)
> struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
> struct drm_device *ddev = rcdu->ddev;
>
> - mutex_lock(&ddev->mode_config.mutex);
> - drm_connector_unplug_all(ddev);
> - mutex_unlock(&ddev->mode_config.mutex);
> -
> + drm_connector_unregister_all(ddev);
> drm_dev_unregister(ddev);
>
> if (rcdu->fbdev)
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index 772ec9e..c204089 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -94,7 +94,7 @@ static void udl_usb_disconnect(struct usb_interface
> *interface) struct drm_device *dev = usb_get_intfdata(interface);
>
> drm_kms_helper_poll_disable(dev);
> - drm_connector_unplug_all(dev);
> + drm_connector_unregister_all(dev);
> udl_fbdev_unplug(dev);
> udl_drop_usb(dev);
> drm_unplug_dev(dev);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 8c7fb3d..42d9f4d 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -2214,8 +2214,8 @@ void drm_connector_unregister(struct drm_connector
> *connector);
>
> extern void drm_connector_cleanup(struct drm_connector *connector);
> extern unsigned int drm_connector_index(struct drm_connector *connector);
> -/* helper to unplug all connectors from sysfs for device */
> -extern void drm_connector_unplug_all(struct drm_device *dev);
> +/* helper to unregister all connectors from sysfs for device */
> +extern void drm_connector_unregister_all(struct drm_device *dev);
>
> extern int drm_bridge_add(struct drm_bridge *bridge);
> extern void drm_bridge_remove(struct drm_bridge *bridge);
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper
2016-03-21 12:28 [PATCH 0/4 v2] drm: introduce drm_connector_register_all() helper Alexey Brodkin
2016-03-21 12:28 ` [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all() Alexey Brodkin
@ 2016-03-21 12:28 ` Alexey Brodkin
2016-03-21 13:26 ` Laurent Pinchart
1 sibling, 1 reply; 5+ messages in thread
From: Alexey Brodkin @ 2016-03-21 12:28 UTC (permalink / raw)
To: dri-devel
Cc: linux-kernel, Alexey Brodkin, Daniel Vetter, David Airlie,
Laurent Pinchart, linux-renesas-soc
Now when generic drm_connector_register_all() helper exists we may safely
substiture with it driver-specific implementation of connectors plugging in
sysfs.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
No changes v1 -> v2.
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 644db36..0f251dc 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -361,14 +361,7 @@ static int rcar_du_probe(struct platform_device *pdev)
if (ret)
goto error;
- mutex_lock(&ddev->mode_config.mutex);
- drm_for_each_connector(connector, ddev) {
- ret = drm_connector_register(connector);
- if (ret < 0)
- break;
- }
- mutex_unlock(&ddev->mode_config.mutex);
-
+ ret = drm_connector_register_all(ddev);
if (ret < 0)
goto error;
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper
2016-03-21 12:28 ` [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper Alexey Brodkin
@ 2016-03-21 13:26 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-03-21 13:26 UTC (permalink / raw)
To: dri-devel; +Cc: Alexey Brodkin, linux-kernel, linux-renesas-soc
Hi Alexey,
Thank you for the patch.
On Monday 21 Mar 2016 15:28:40 Alexey Brodkin wrote:
> Now when generic drm_connector_register_all() helper exists we may safely
s/Now when/Now that a/
> substiture with it driver-specific implementation of connectors plugging in
s/substiture with it/substitute it for the/
> sysfs.
And while at it, in the subject line,
s/rcar-du - use/rcar-du: Use/
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: linux-renesas-soc@vger.kernel.org
Apart for the commit message fixes,
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>
> No changes v1 -> v2.
>
> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 644db36..0f251dc 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -361,14 +361,7 @@ static int rcar_du_probe(struct platform_device *pdev)
> if (ret)
> goto error;
>
> - mutex_lock(&ddev->mode_config.mutex);
> - drm_for_each_connector(connector, ddev) {
> - ret = drm_connector_register(connector);
> - if (ret < 0)
> - break;
> - }
> - mutex_unlock(&ddev->mode_config.mutex);
> -
> + ret = drm_connector_register_all(ddev);
> if (ret < 0)
> goto error;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-21 13:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21 12:28 [PATCH 0/4 v2] drm: introduce drm_connector_register_all() helper Alexey Brodkin
2016-03-21 12:28 ` [PATCH 1/4 v2] drm: rename drm_connector_unplug_all() to drm_connector_unregister_all() Alexey Brodkin
2016-03-21 13:23 ` Laurent Pinchart
2016-03-21 12:28 ` [PATCH 4/4 v2] drm: rcar-du - use generic drm_connector_register_all() helper Alexey Brodkin
2016-03-21 13:26 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox