diff mbox

[1/3] drm/hisilicon: Use drm_connector_register_all

Message ID 1462761128-106487-2-git-send-email-xinliang.liu@linaro.org
State Accepted
Commit b93c846273b9eda820f618a07d8871e20639e0b9
Headers show

Commit Message

Xinliang Liu May 9, 2016, 2:32 a.m. UTC
Use drm_connector_register_all helper to register connectors.
Thanks to Daniel Vetter, this patch is raised by him.

Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 +------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

Comments

Xinliang Liu May 9, 2016, 1:54 p.m. UTC | #1
On 9 May 2016 at 14:43, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, May 09, 2016 at 10:32:06AM +0800, Xinliang Liu wrote:
>> Use drm_connector_register_all helper to register connectors.
>> Thanks to Daniel Vetter, this patch is raised by him.
>>
>> Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> Seems like exactly my patch, except you've taken over authorship. Please
> merge mine instead (except when there's a bug).

OK, I will merge yours instead.

Thanks,
-xinliang

> -Daniel
>
>> ---
>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 +------------------------
>>  1 file changed, 1 insertion(+), 30 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> index e102c9e1e7b2..bc410ee584b7 100644
>> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> @@ -201,35 +201,6 @@ static int compare_of(struct device *dev, void *data)
>>       return dev->of_node == data;
>>  }
>>
>> -static int kirin_drm_connectors_register(struct drm_device *dev)
>> -{
>> -     struct drm_connector *connector;
>> -     struct drm_connector *failed_connector;
>> -     int ret;
>> -
>> -     mutex_lock(&dev->mode_config.mutex);
>> -     drm_for_each_connector(connector, dev) {
>> -             ret = drm_connector_register(connector);
>> -             if (ret) {
>> -                     failed_connector = connector;
>> -                     goto err;
>> -             }
>> -     }
>> -     mutex_unlock(&dev->mode_config.mutex);
>> -
>> -     return 0;
>> -
>> -err:
>> -     drm_for_each_connector(connector, dev) {
>> -             if (failed_connector == connector)
>> -                     break;
>> -             drm_connector_unregister(connector);
>> -     }
>> -     mutex_unlock(&dev->mode_config.mutex);
>> -
>> -     return ret;
>> -}
>> -
>>  static int kirin_drm_bind(struct device *dev)
>>  {
>>       struct drm_driver *driver = &kirin_drm_driver;
>> @@ -251,7 +222,7 @@ static int kirin_drm_bind(struct device *dev)
>>               goto err_kms_cleanup;
>>
>>       /* connectors should be registered after drm device register */
>> -     ret = kirin_drm_connectors_register(drm_dev);
>> +     ret = drm_connector_register_all(drm_dev);
>>       if (ret)
>>               goto err_drm_dev_unregister;
>>
>> --
>> 2.8.2
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index e102c9e1e7b2..bc410ee584b7 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -201,35 +201,6 @@  static int compare_of(struct device *dev, void *data)
 	return dev->of_node == data;
 }
 
-static int kirin_drm_connectors_register(struct drm_device *dev)
-{
-	struct drm_connector *connector;
-	struct drm_connector *failed_connector;
-	int ret;
-
-	mutex_lock(&dev->mode_config.mutex);
-	drm_for_each_connector(connector, dev) {
-		ret = drm_connector_register(connector);
-		if (ret) {
-			failed_connector = connector;
-			goto err;
-		}
-	}
-	mutex_unlock(&dev->mode_config.mutex);
-
-	return 0;
-
-err:
-	drm_for_each_connector(connector, dev) {
-		if (failed_connector == connector)
-			break;
-		drm_connector_unregister(connector);
-	}
-	mutex_unlock(&dev->mode_config.mutex);
-
-	return ret;
-}
-
 static int kirin_drm_bind(struct device *dev)
 {
 	struct drm_driver *driver = &kirin_drm_driver;
@@ -251,7 +222,7 @@  static int kirin_drm_bind(struct device *dev)
 		goto err_kms_cleanup;
 
 	/* connectors should be registered after drm device register */
-	ret = kirin_drm_connectors_register(drm_dev);
+	ret = drm_connector_register_all(drm_dev);
 	if (ret)
 		goto err_drm_dev_unregister;