On Tue, 5 Jun 2018 01:09:32 +0200
Boris Brezillon <boris.brezil...@bootlin.com> wrote:

> On Mon, 04 Jun 2018 18:48:08 +0200
> Janusz Krzysztofik <jmkrzy...@gmail.com> wrote:
> 
> > On Monday, June 4, 2018 11:55:43 AM CEST Boris Brezillon wrote:  
> > > On Wed, 30 May 2018 22:39:03 +0200
> > > 
> > > Janusz Krzysztofik <jmkrzy...@gmail.com> wrote:    
> > > > On Wednesday, May 30, 2018 7:52:20 PM CEST Boris Brezillon wrote:    
> > > > > On Wed, 30 May 2018 19:43:09 +0200
> > > > > 
> > > > > Janusz Krzysztofik <jmkrzy...@gmail.com> wrote:    
> > > > > > On Wednesday, May 30, 2018 11:05:00 AM CEST Boris Brezillon wrote:  
> > > > > >   
> > > > > > > Hi Janusz,    
> > > > > > 
> > > > > > Hi Boris,
> > > > > >     
> > > > > > > On Sat, 26 May 2018 00:20:45 +0200
> > > > > > > 
> > > > > > > Janusz Krzysztofik <jmkrzy...@gmail.com> wrote:    
> > > > > > > > ...
> > > > > > > > Changes since v1:
> > > > > > > > - fix handling of devm_gpiod_get_optional() return values - 
> > > > > > > > thanks
> > > > > > > > to
> > > > > > > > 
> > > > > > > >   Andy Shevchenko.    
> > > > > > > 
> > > > > > > Can you put the changelog after the "---" separator so that it 
> > > > > > > does
> > > > > > > not
> > > > > > > appear in the final commit message?    
> > > > > > 
> > > > > > Yes, sure, sorry for that.
> > > > > >     
> > > > > > > > +err_gpiod:
> > > > > > > > +       if (err == -ENODEV || err == -ENOENT)
> > > > > > > > +               err = -EPROBE_DEFER;    
> > > > > > > 
> > > > > > > Hm, isn't it better to make gpiod_find() return
> > > > > > > ERR_PTR(-EPROBE_DEFER)
> > > > > > > here [1]? At least, ENOENT should not be turned into EPROBE_DEFER,
> > > > > > > because it's returned when there's no entry matching the requested
> > > > > > > gpio
> > > > > > > in the lookup table, and deferring the probe won't solve this
> > > > > > > problem.    
> > > > > > 
> > > > > > ENOENT is also returned when no matching lookup table is found. That
> > > > > > may
> > > > > > happen if consumer dev_name stored in the table differs from 
> > > > > > dev_name
> > > > > > assigned to the consumer by its bus, the platform bus in this case.
> > > > > > For
> > > > > > that reason I think the consumer dev_name should be initialized in 
> > > > > > the
> > > > > > table after the device is registered, when its actual dev_name can 
> > > > > > be
> > > > > > obtained. If that device registration happens after the driver is
> > > > > > already
> > > > > > registered, e.g., at late_initcall, the device is probed before its
> > > > > > lookup table is ready. For that reason returning EPROBE_DEFER seems
> > > > > > better to me even in the ENOENT case.    
> > > > > 
> > > > > Sorry, I don't get it. Aren't GPIO lookup tables supposed to be 
> > > > > declared
> > > > > in board files, especially if the GPIO is used by a platform device?
> > > > > When would you have a lookup table registered later in the init/boot
> > > > > process?    
> > > > 
> > > > When e.g. I'd like to register my GPIO consumer platform device at
> > > > late_initcall for some reason, and I'm not sure what exact dev_name my
> > > > consomer will be registered with by the platform bus.    
> > > 
> > > You should know the name before the device is registered.    
> > 
> > What if I use PLATFORM_DEVID_AUTO?

Just had a quick look at board-ams-delta.c and you don't have a single
device setting pdev->id to PLATFORM_DEVID_AUTO. It's either set to
PLATFORM_DEVID_NONE (-1) or assigned a specific id, so the problem does
not exist, really. Just set the name .dev_id to the appropriate value
at declaration time and register the lookup tables before registering
the pdevs.

Reply via email to