Re: [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO

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

 



On 28-09-16, 15:07, Vladimir Zapolskiy wrote:
> I would expect that the change below improves the situation, but I didn't
> perform any tests and here the core change is governed by the accepted
> i.MX i2c bus driver specific changes, thus conceptually it may be incorrect:
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index da3a02ef4a31..3a4f59c3c3e6 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -697,9 +697,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
>  	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
>  	int i = 0, val = 1, ret = 0;
> -	if (bri->prepare_recovery)
> -		bri->prepare_recovery(adap);
> -
>  	bri->set_scl(adap, val);
>  	ndelay(RECOVERY_NDELAY);
> @@ -725,22 +722,34 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
>  		ndelay(RECOVERY_NDELAY);
>  	}
> -	if (bri->unprepare_recovery)
> -		bri->unprepare_recovery(adap);
> -
>  	return ret;
>  }
>  int i2c_generic_scl_recovery(struct i2c_adapter *adap)
>  {
> -	return i2c_generic_recovery(adap);
> +	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
> +	int ret;
> +
> +	if (bri->prepare_recovery)
> +		bri->prepare_recovery(adap);
> +
> +	ret = i2c_generic_recovery(adap);
> +
> +	if (bri->unprepare_recovery)
> +		bri->unprepare_recovery(adap);
> +
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
>  int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
>  {
> +	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
>  	int ret;
> +	if (bri->prepare_recovery)
> +		bri->prepare_recovery(adap);
> +
>  	ret = i2c_get_gpios_for_recovery(adap);
>  	if (ret)
>  		return ret;
> @@ -748,6 +757,9 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
>  	ret = i2c_generic_recovery(adap);
>  	i2c_put_gpios_for_recovery(adap);
> +	if (bri->unprepare_recovery)
> +		bri->unprepare_recovery(adap);
> +
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery);

That looks to like a hack made just to make things work on one platform.

I would rather wait for an answer to my query first, which I asked in a separate
email.
 
-- 
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux