Re: [PATCH v2 10/10] gpiolib: add of_xlate support

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

 



On 23-06-16, Sascha Hauer wrote:
> On Wed, Jun 14, 2023 at 12:07:47PM +0200, Ahmad Fatoum wrote:

...

> > diff --git a/include/gpio.h b/include/gpio.h
> > index 5f2c16584c3b..9951532084ac 100644
> > --- a/include/gpio.h
> > +++ b/include/gpio.h
> > @@ -168,6 +168,7 @@ int gpio_array_to_id(const struct gpio *array, size_t num, u32 *val);
> >  #endif
> >  
> >  struct gpio_chip;
> > +struct of_phandle_args;
> >  
> >  struct gpio_ops {
> >  	int (*request)(struct gpio_chip *chip, unsigned offset);
> > @@ -177,6 +178,22 @@ struct gpio_ops {
> >  	int (*get_direction)(struct gpio_chip *chip, unsigned offset);
> >  	int (*get)(struct gpio_chip *chip, unsigned offset);
> >  	void (*set)(struct gpio_chip *chip, unsigned offset, int value);
> > +
> > +#if defined(CONFIG_OF_GPIO)
> > +	/*
> > +	 * If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in
> > +	 * the device tree automatically may have an OF translation
> > +	 */
> > +
> > +	/**
> > +	 * @of_xlate:
> > +	 *
> > +	 * Callback to translate a device tree GPIO specifier into a chip-
> > +	 * relative GPIO number and flags.
> > +	 */
> > +	int (*of_xlate)(struct gpio_chip *gc,
> > +			const struct of_phandle_args *gpiospec, u32 *flags);
> > +#endif
> >  };
> >  
> >  struct gpio_chip {
> > @@ -185,6 +202,15 @@ struct gpio_chip {
> >  	int base;
> >  	int ngpio;
> >  
> > +#if defined(CONFIG_OF_GPIO)
> > +	/**
> > +	 * @of_gpio_n_cells:
> > +	 *
> > +	 * Number of cells used to form the GPIO specifier.
> > +	 */
> > +	unsigned int of_gpio_n_cells;
> > +#endif
> 
> This patch adds new fields to struct gpio_chip and struct gpio_ops
> #ifdeffed with CONFIG_OF_GPIO, but the code accessing these fields is
> not guarded with that #ifdef resulting in compilation failures in
> several defconfigs like for example animeo_ip_defconfig.

Argh..

> I fixed this by adding the missing #ifdefs in the code.

Thanks a lot.

Regards,
  Marco




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux