Re: [PATCH] i2c: pca954x: improve usage of gpiod API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Uwe,

Thank you for the patch.

On Tuesday 17 February 2015 10:12:08 Uwe Kleine-König wrote:
> Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
> which appeared in v3.17-rc1, the gpiod_get* functions take an additional
> parameter that allows to specify direction and initial value for
> outputs.
> 
> Also there is an *_optional variant that serves well here.  The sematics
> is slightly changed here by using it. Now if a reset gpio is specified
> and getting hold on it fails, pca954x_probe fails, too.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>

Acked-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> ---
>  drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c
> b/drivers/i2c/muxes/i2c-mux-pca954x.c index ec11b404b433..0042cf3d77db
> 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -201,9 +201,9 @@ static int pca954x_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, data);
> 
>  	/* Get the mux out of reset if a reset GPIO is specified. */
> -	gpio = devm_gpiod_get(&client->dev, "reset");
> -	if (!IS_ERR(gpio))
> -		gpiod_direction_output(gpio, 0);
> +	gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
> +	if (IS_ERR(gpio))
> +		return PTR_ERR(gpio);
> 
>  	/* Write the mux register at addr to verify
>  	 * that the mux is in fact present. This also

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux