Re: [PATCH v1 3/5] i2c: mux: pca954x: Drop useless validation for optional GPIO descriptor

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

 



Hi!

On 2020-03-05 16:53, Andy Shevchenko wrote:
> There is no need to perform a check for optional GPIO descriptor.
> If it's NULL, the API can handle it correctly.

But, the removed test is not only (needlessly) protecting the optional
descriptor, it also shortcuts the udelays. I think it is valid to
skip those pointless udelays when no reset is happening anyway. Not
that it matters all that much when the delays are as short as this, but
I simply think it looks sensible to skip the delays when that are not
needed.

So, I do not think this change is an improvement.

Cheers,
Peter

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/i2c/muxes/i2c-mux-pca954x.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index 2e42a113ef1f..fe4320fc0b91 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -444,12 +444,12 @@ static int pca954x_probe(struct i2c_client *client,
>  	gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>  	if (IS_ERR(gpio))
>  		return PTR_ERR(gpio);
> -	if (gpio) {
> -		udelay(1);
> -		gpiod_set_value_cansleep(gpio, 0);
> -		/* Give the chip some time to recover. */
> -		udelay(1);
> -	}
> +
> +	/* Reset the multiplexer */
> +	udelay(1);
> +	gpiod_set_value_cansleep(gpio, 0);
> +	/* Give the chip some time to recover. */
> +	udelay(1);
>  
>  	data->chip = device_get_match_data(dev);
>  	if (!data->chip)
> 




[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