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

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

 



On Wed, 2018-02-21 at 19:52 +0800, Phil Reid wrote:
> On 21/02/2018 17:02, Wolfram Sang wrote:
> > On Wed, Feb 21, 2018 at 04:56:36PM +0800, Phil Reid wrote:
> > > On 21/02/2018 16:41, Wolfram Sang wrote:
> > > > On Wed, Feb 21, 2018 at 04:38:10PM +0800, Phil Reid wrote:
> > > 
> > > 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.
> > 
> > My preference would still be to encode that only for -EPROBE_DEFER
> > we
> > bail out of probe and for every other error, we simply don't do bus
> > recovery. I think it's way more understandable to say what error we
> > are
> > interested in instead of masking all those out we are not interested
> > in.
> > 
> > Or?
> > 
> 
> I would think all the other errors are probably something that needs
> to be investigated.
> eg: incorrect GPIO flags on the dt binding etc.

I agree with Phil, OTOH there are both patterns in the kernel to check
by IS_ERR_OR_NULL vs. -ENOSYS and -ENOENT.

So, I have no strong opinion which one to use.

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy



[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