dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device
@ 2019-10-08 20:33 ` Wolfram Sang
  2019-10-09  8:16   ` Laurent Pinchart
  2019-10-10  7:01   ` Andrzej Hajda
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2019-10-08 20:33 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-i2c, Wolfram Sang, Andrzej Hajda, Neil Armstrong,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, David Airlie,
	Daniel Vetter, linux-kernel

Move from the deprecated i2c_new_dummy() to devm_i2c_new_dummy_device().
We now get an ERRPTR which we use in error handling and we can skip
removal of the created devices.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Rebased to v5.4-rc2 since last time. One of the last two users of the
old API, so please apply soon, so I can remove the old interface. Only
build tested.

 drivers/gpu/drm/bridge/sii9234.c | 36 +++++++++++---------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
index 25d4ad8c7ad6..8a6c85693a88 100644
--- a/drivers/gpu/drm/bridge/sii9234.c
+++ b/drivers/gpu/drm/bridge/sii9234.c
@@ -841,39 +841,28 @@ static int sii9234_init_resources(struct sii9234 *ctx,
 
 	ctx->client[I2C_MHL] = client;
 
-	ctx->client[I2C_TPI] = i2c_new_dummy(adapter, I2C_TPI_ADDR);
-	if (!ctx->client[I2C_TPI]) {
+	ctx->client[I2C_TPI] = devm_i2c_new_dummy_device(&client->dev, adapter,
+							 I2C_TPI_ADDR);
+	if (IS_ERR(ctx->client[I2C_TPI])) {
 		dev_err(ctx->dev, "failed to create TPI client\n");
-		return -ENODEV;
+		return PTR_ERR(ctx->client[I2C_TPI]);
 	}
 
-	ctx->client[I2C_HDMI] = i2c_new_dummy(adapter, I2C_HDMI_ADDR);
-	if (!ctx->client[I2C_HDMI]) {
+	ctx->client[I2C_HDMI] = devm_i2c_new_dummy_device(&client->dev, adapter,
+							  I2C_HDMI_ADDR);
+	if (IS_ERR(ctx->client[I2C_HDMI])) {
 		dev_err(ctx->dev, "failed to create HDMI RX client\n");
-		goto fail_tpi;
+		return PTR_ERR(ctx->client[I2C_HDMI]);
 	}
 
-	ctx->client[I2C_CBUS] = i2c_new_dummy(adapter, I2C_CBUS_ADDR);
-	if (!ctx->client[I2C_CBUS]) {
+	ctx->client[I2C_CBUS] = devm_i2c_new_dummy_device(&client->dev, adapter,
+							  I2C_CBUS_ADDR);
+	if (IS_ERR(ctx->client[I2C_CBUS])) {
 		dev_err(ctx->dev, "failed to create CBUS client\n");
-		goto fail_hdmi;
+		return PTR_ERR(ctx->client[I2C_CBUS]);
 	}
 
 	return 0;
-
-fail_hdmi:
-	i2c_unregister_device(ctx->client[I2C_HDMI]);
-fail_tpi:
-	i2c_unregister_device(ctx->client[I2C_TPI]);
-
-	return -ENODEV;
-}
-
-static void sii9234_deinit_resources(struct sii9234 *ctx)
-{
-	i2c_unregister_device(ctx->client[I2C_CBUS]);
-	i2c_unregister_device(ctx->client[I2C_HDMI]);
-	i2c_unregister_device(ctx->client[I2C_TPI]);
 }
 
 static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
@@ -950,7 +939,6 @@ static int sii9234_remove(struct i2c_client *client)
 
 	sii9234_cable_out(ctx);
 	drm_bridge_remove(&ctx->bridge);
-	sii9234_deinit_resources(ctx);
 
 	return 0;
 }
-- 
2.20.1

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

* Re: [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device
  2019-10-08 20:33 ` [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device Wolfram Sang
@ 2019-10-09  8:16   ` Laurent Pinchart
  2019-10-10  7:01   ` Andrzej Hajda
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2019-10-09  8:16 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Jernej Skrabec, Jonas Karlman, David Airlie, Neil Armstrong,
	linux-kernel, dri-devel, linux-i2c

Hi Wolfram,

Thank you for the patch.

On Tue, Oct 08, 2019 at 10:33:22PM +0200, Wolfram Sang wrote:
> Move from the deprecated i2c_new_dummy() to devm_i2c_new_dummy_device().
> We now get an ERRPTR which we use in error handling and we can skip
> removal of the created devices.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

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

> ---
> 
> Rebased to v5.4-rc2 since last time. One of the last two users of the
> old API, so please apply soon, so I can remove the old interface. Only
> build tested.
> 
>  drivers/gpu/drm/bridge/sii9234.c | 36 +++++++++++---------------------
>  1 file changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
> index 25d4ad8c7ad6..8a6c85693a88 100644
> --- a/drivers/gpu/drm/bridge/sii9234.c
> +++ b/drivers/gpu/drm/bridge/sii9234.c
> @@ -841,39 +841,28 @@ static int sii9234_init_resources(struct sii9234 *ctx,
>  
>  	ctx->client[I2C_MHL] = client;
>  
> -	ctx->client[I2C_TPI] = i2c_new_dummy(adapter, I2C_TPI_ADDR);
> -	if (!ctx->client[I2C_TPI]) {
> +	ctx->client[I2C_TPI] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							 I2C_TPI_ADDR);
> +	if (IS_ERR(ctx->client[I2C_TPI])) {
>  		dev_err(ctx->dev, "failed to create TPI client\n");
> -		return -ENODEV;
> +		return PTR_ERR(ctx->client[I2C_TPI]);
>  	}
>  
> -	ctx->client[I2C_HDMI] = i2c_new_dummy(adapter, I2C_HDMI_ADDR);
> -	if (!ctx->client[I2C_HDMI]) {
> +	ctx->client[I2C_HDMI] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							  I2C_HDMI_ADDR);
> +	if (IS_ERR(ctx->client[I2C_HDMI])) {
>  		dev_err(ctx->dev, "failed to create HDMI RX client\n");
> -		goto fail_tpi;
> +		return PTR_ERR(ctx->client[I2C_HDMI]);
>  	}
>  
> -	ctx->client[I2C_CBUS] = i2c_new_dummy(adapter, I2C_CBUS_ADDR);
> -	if (!ctx->client[I2C_CBUS]) {
> +	ctx->client[I2C_CBUS] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							  I2C_CBUS_ADDR);
> +	if (IS_ERR(ctx->client[I2C_CBUS])) {
>  		dev_err(ctx->dev, "failed to create CBUS client\n");
> -		goto fail_hdmi;
> +		return PTR_ERR(ctx->client[I2C_CBUS]);
>  	}
>  
>  	return 0;
> -
> -fail_hdmi:
> -	i2c_unregister_device(ctx->client[I2C_HDMI]);
> -fail_tpi:
> -	i2c_unregister_device(ctx->client[I2C_TPI]);
> -
> -	return -ENODEV;
> -}
> -
> -static void sii9234_deinit_resources(struct sii9234 *ctx)
> -{
> -	i2c_unregister_device(ctx->client[I2C_CBUS]);
> -	i2c_unregister_device(ctx->client[I2C_HDMI]);
> -	i2c_unregister_device(ctx->client[I2C_TPI]);
>  }
>  
>  static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
> @@ -950,7 +939,6 @@ static int sii9234_remove(struct i2c_client *client)
>  
>  	sii9234_cable_out(ctx);
>  	drm_bridge_remove(&ctx->bridge);
> -	sii9234_deinit_resources(ctx);
>  
>  	return 0;
>  }

-- 
Regards,

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

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

* Re: [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device
  2019-10-08 20:33 ` [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device Wolfram Sang
  2019-10-09  8:16   ` Laurent Pinchart
@ 2019-10-10  7:01   ` Andrzej Hajda
  1 sibling, 0 replies; 3+ messages in thread
From: Andrzej Hajda @ 2019-10-10  7:01 UTC (permalink / raw)
  To: Wolfram Sang, dri-devel
  Cc: linux-i2c, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, linux-kernel

On 08.10.2019 22:33, Wolfram Sang wrote:
> Move from the deprecated i2c_new_dummy() to devm_i2c_new_dummy_device().
> We now get an ERRPTR which we use in error handling and we can skip
> removal of the created devices.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---


Applied, thx.


Rergards

Andrzej


>
> Rebased to v5.4-rc2 since last time. One of the last two users of the
> old API, so please apply soon, so I can remove the old interface. Only
> build tested.
>
>  drivers/gpu/drm/bridge/sii9234.c | 36 +++++++++++---------------------
>  1 file changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
> index 25d4ad8c7ad6..8a6c85693a88 100644
> --- a/drivers/gpu/drm/bridge/sii9234.c
> +++ b/drivers/gpu/drm/bridge/sii9234.c
> @@ -841,39 +841,28 @@ static int sii9234_init_resources(struct sii9234 *ctx,
>  
>  	ctx->client[I2C_MHL] = client;
>  
> -	ctx->client[I2C_TPI] = i2c_new_dummy(adapter, I2C_TPI_ADDR);
> -	if (!ctx->client[I2C_TPI]) {
> +	ctx->client[I2C_TPI] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							 I2C_TPI_ADDR);
> +	if (IS_ERR(ctx->client[I2C_TPI])) {
>  		dev_err(ctx->dev, "failed to create TPI client\n");
> -		return -ENODEV;
> +		return PTR_ERR(ctx->client[I2C_TPI]);
>  	}
>  
> -	ctx->client[I2C_HDMI] = i2c_new_dummy(adapter, I2C_HDMI_ADDR);
> -	if (!ctx->client[I2C_HDMI]) {
> +	ctx->client[I2C_HDMI] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							  I2C_HDMI_ADDR);
> +	if (IS_ERR(ctx->client[I2C_HDMI])) {
>  		dev_err(ctx->dev, "failed to create HDMI RX client\n");
> -		goto fail_tpi;
> +		return PTR_ERR(ctx->client[I2C_HDMI]);
>  	}
>  
> -	ctx->client[I2C_CBUS] = i2c_new_dummy(adapter, I2C_CBUS_ADDR);
> -	if (!ctx->client[I2C_CBUS]) {
> +	ctx->client[I2C_CBUS] = devm_i2c_new_dummy_device(&client->dev, adapter,
> +							  I2C_CBUS_ADDR);
> +	if (IS_ERR(ctx->client[I2C_CBUS])) {
>  		dev_err(ctx->dev, "failed to create CBUS client\n");
> -		goto fail_hdmi;
> +		return PTR_ERR(ctx->client[I2C_CBUS]);
>  	}
>  
>  	return 0;
> -
> -fail_hdmi:
> -	i2c_unregister_device(ctx->client[I2C_HDMI]);
> -fail_tpi:
> -	i2c_unregister_device(ctx->client[I2C_TPI]);
> -
> -	return -ENODEV;
> -}
> -
> -static void sii9234_deinit_resources(struct sii9234 *ctx)
> -{
> -	i2c_unregister_device(ctx->client[I2C_CBUS]);
> -	i2c_unregister_device(ctx->client[I2C_HDMI]);
> -	i2c_unregister_device(ctx->client[I2C_TPI]);
>  }
>  
>  static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
> @@ -950,7 +939,6 @@ static int sii9234_remove(struct i2c_client *client)
>  
>  	sii9234_cable_out(ctx);
>  	drm_bridge_remove(&ctx->bridge);
> -	sii9234_deinit_resources(ctx);
>  
>  	return 0;
>  }

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

end of thread, other threads:[~2019-10-10  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191008203330epcas2p31dc15af8587d35eba5a03f71418587bd@epcas2p3.samsung.com>
2019-10-08 20:33 ` [PATCH RESEND] gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device Wolfram Sang
2019-10-09  8:16   ` Laurent Pinchart
2019-10-10  7:01   ` Andrzej Hajda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).