Re: [PATCH] iio: adc: ti-ads1015: support deferred probe

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

 



Hi,

On 04/09/2023 14:23, Andy Shevchenko wrote:
> On Mon, Sep 04, 2023 at 01:15:22PM +0300, Tomas Melin wrote:
>> Support deferred probe for cases where communication on
>> i2c bus fails. These failures could happen for a variety of
>> reasons including bus arbitration error or power failure.
> 
>> +out:
>> +	if ((ret == -EAGAIN) || (ret == -ENXIO))
>> +		return -EPROBE_DEFER;
>> +	return ret;
> 
> Oh my... This looks so-o hackish.> If anything, it has to be fixed on the level of regmap I2C APIs or
so.As such this does fix a real world issue. Providing some helpers for
this on regmap level would probably be great. To add such an API I
suspect there should first be existing users for it, and this would be
one example.
Until there would be such an generic API, I'm not sure if there are many
other alternatives than to check for invalid returns and defer the probe.

Thanks,
Tomas


> 
> Maybe something like regmap_i2c_try_write()/try_read() new APIs that
> will provide the above. Otherwise you want to fix _every single driver_
> in the Linux kern>
> ...
> 
> $ git grep -lw builtin_i2c_driver | wc
>       5       5     123
> $ git grep -lw module_i2c_driver | wc
>       1164    1164   35240
> 
> (and more that don't use either of the above macros).
> 



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux