Re: [PATCH v1] i2c: designware: Consider SCL GPIO optional

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

 



On 21/02/2018 16:41, Wolfram Sang wrote:
On Wed, Feb 21, 2018 at 04:38:10PM +0800, Phil Reid wrote:
On 21/02/2018 16:31, Wolfram Sang wrote:
On Sat, Feb 17, 2018 at 10:58:43PM +0200, Andy Shevchenko wrote:
GPIO library can return -ENOSYS for the failed request.
Instead of failing ->probe() in this case override error code to 0.

I wonder if the code wouldn't be much easier if
i2c_dw_init_recovery_info() was simply returning void? Or just give a
warning in the log but not bail out of probe()?

You need to handle EPROBE_DEFER.

Right. Then we should probably encode that explicitly?


I think this will handle all cases correctly.

       gpio = devm_gpiod_get_optional(dev->dev, "scl", GPIOD_OUT_HIGH);
       if (IS_ERR_OR_NULL(gpio))
           return PTR_ERR_OR_ZERO(gpio);

My logic at the time was that scl is not optional for the i2c recovery.
But it's optional form the driver point of view.

The core returns NULL for that call if GPIO is not selected.
And NULL if ENOENT was returned by the inner gpiod_get when GPIO is selected.

Let me know if you want a patch.
--
Regards
Phil Reid




[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