diff mbox series

[3/3] media: i2c: adv7180: Print the chip ID on probe

Message ID 20210530204410.676831-3-festevam@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/3] dt-bindings: adv7180: Introduce the 'reset-gpios' property | expand

Commit Message

Fabio Estevam May 30, 2021, 8:44 p.m. UTC
Improve the probe message by printing the chip ID version.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/media/i2c/adv7180.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Frieder Schrempf May 31, 2021, 7:04 a.m. UTC | #1
On 30.05.21 22:44, Fabio Estevam wrote:
> Improve the probe message by printing the chip ID version.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>  drivers/media/i2c/adv7180.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index 2811f2c337fa..e5ef99f0460c 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -1404,11 +1404,19 @@ static int adv7180_probe(struct i2c_client *client,
>  	if (ret)
>  		goto err_free_irq;
>  
> -	v4l_info(client, "chip found @ 0x%02x (%s)\n",
> -		 client->addr, client->adapter->name);
> +	mutex_lock(&state->mutex);
> +	ret = adv7180_read(state, ADV7180_REG_IDENT);
> +	mutex_unlock(&state->mutex);
> +	if (ret < 0)
> +		goto err_v4l2_async_unregister;
> +
> +	v4l_info(client, "chip id 0x%x found @ 0x%02x (%s)\n",
> +		 ret, client->addr, client->adapter->name);
>  
>  	return 0;
>  
> +err_v4l2_async_unregister:
> +	v4l2_async_unregister_subdev(sd);
>  err_free_irq:
>  	if (state->irq > 0)
>  		free_irq(client->irq, state);
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 2811f2c337fa..e5ef99f0460c 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1404,11 +1404,19 @@  static int adv7180_probe(struct i2c_client *client,
 	if (ret)
 		goto err_free_irq;
 
-	v4l_info(client, "chip found @ 0x%02x (%s)\n",
-		 client->addr, client->adapter->name);
+	mutex_lock(&state->mutex);
+	ret = adv7180_read(state, ADV7180_REG_IDENT);
+	mutex_unlock(&state->mutex);
+	if (ret < 0)
+		goto err_v4l2_async_unregister;
+
+	v4l_info(client, "chip id 0x%x found @ 0x%02x (%s)\n",
+		 ret, client->addr, client->adapter->name);
 
 	return 0;
 
+err_v4l2_async_unregister:
+	v4l2_async_unregister_subdev(sd);
 err_free_irq:
 	if (state->irq > 0)
 		free_irq(client->irq, state);