[v4,17/23] drm/ast: Provide ddc symlink in connector sysfs directory
diff mbox series

Message ID d3651bd2fd8ba69b8380304bca4c629a8c1da4e9.1562843413.git.andrzej.p@collabora.com
State New
Headers show
Series
  • Associate ddc adapters with connectors
Related show

Commit Message

Andrzej Pietrasiewicz July 11, 2019, 11:26 a.m. UTC
Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 drivers/gpu/drm/ast/ast_mode.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Thomas Zimmermann July 11, 2019, 5:27 p.m. UTC | #1
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Am 11.07.19 um 13:26 schrieb Andrzej Pietrasiewicz:
> Use the ddc pointer provided by the generic connector.
> 
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
> ---
>  drivers/gpu/drm/ast/ast_mode.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index ffccbef962a4..1ca9bc4aa3bb 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -890,6 +890,11 @@ static int ast_connector_init(struct drm_device *dev)
>  		return -ENOMEM;
>  
>  	connector = &ast_connector->base;
> +	ast_connector->i2c = ast_i2c_create(dev);
> +	if (!ast_connector->i2c)
> +		DRM_ERROR("failed to add ddc bus for connector\n");
> +
> +	connector->ddc = &ast_connector->i2c->adapter;
>  	drm_connector_init(dev, connector, &ast_connector_funcs, DRM_MODE_CONNECTOR_VGA);
>  
>  	drm_connector_helper_add(connector, &ast_connector_helper_funcs);
> @@ -904,10 +909,6 @@ static int ast_connector_init(struct drm_device *dev)
>  	encoder = list_first_entry(&dev->mode_config.encoder_list, struct drm_encoder, head);
>  	drm_connector_attach_encoder(connector, encoder);
>  
> -	ast_connector->i2c = ast_i2c_create(dev);
> -	if (!ast_connector->i2c)
> -		DRM_ERROR("failed to add ddc bus for connector\n");
> -
>  	return 0;
>  }
>  
>
Sam Ravnborg July 23, 2019, 9:09 a.m. UTC | #2
Hi Andrzej.

On Thu, Jul 11, 2019 at 01:26:44PM +0200, Andrzej Pietrasiewicz wrote:
> Use the ddc pointer provided by the generic connector.
> 
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
> ---
>  drivers/gpu/drm/ast/ast_mode.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index ffccbef962a4..1ca9bc4aa3bb 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -890,6 +890,11 @@ static int ast_connector_init(struct drm_device *dev)
>  		return -ENOMEM;
>  
>  	connector = &ast_connector->base;
> +	ast_connector->i2c = ast_i2c_create(dev);
> +	if (!ast_connector->i2c)
> +		DRM_ERROR("failed to add ddc bus for connector\n");
> +
> +	connector->ddc = &ast_connector->i2c->adapter;
>  	drm_connector_init(dev, connector, &ast_connector_funcs, DRM_MODE_CONNECTOR_VGA);
>  
>  	drm_connector_helper_add(connector, &ast_connector_helper_funcs);
Again, assigning before drm_connector_init().
I did not audit the remaining patches - you got the idea.

	Sam

Patch
diff mbox series

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index ffccbef962a4..1ca9bc4aa3bb 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -890,6 +890,11 @@  static int ast_connector_init(struct drm_device *dev)
 		return -ENOMEM;
 
 	connector = &ast_connector->base;
+	ast_connector->i2c = ast_i2c_create(dev);
+	if (!ast_connector->i2c)
+		DRM_ERROR("failed to add ddc bus for connector\n");
+
+	connector->ddc = &ast_connector->i2c->adapter;
 	drm_connector_init(dev, connector, &ast_connector_funcs, DRM_MODE_CONNECTOR_VGA);
 
 	drm_connector_helper_add(connector, &ast_connector_helper_funcs);
@@ -904,10 +909,6 @@  static int ast_connector_init(struct drm_device *dev)
 	encoder = list_first_entry(&dev->mode_config.encoder_list, struct drm_encoder, head);
 	drm_connector_attach_encoder(connector, encoder);
 
-	ast_connector->i2c = ast_i2c_create(dev);
-	if (!ast_connector->i2c)
-		DRM_ERROR("failed to add ddc bus for connector\n");
-
 	return 0;
 }