gpiolib: iron out include ladder mistakes
The <*/gpio.h> includes are updated again: now we need to account for the problem introduced by commit: 595679a8038584df7b9398bf34f61db3c038bfea "gpiolib: fix up function prototypes etc" Actually we need static inlines in include/asm-generic/gpio.h as well since we may have GPIOLIB but not PINCTRL. Make sure to move all the CONFIG_PINCTRL business to the end of the file so we are sure we have declared struct gpio_chip. And we need to keep the static inlines in <linux/gpio.h> but here for the !CONFIG_GENERIC_GPIO case, and then we may as well throw in a few warnings like the other prototypes there, if someone would have the bad taste of compiling without GENERIC_GPIO even. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
@@ -48,27 +48,6 @@ struct seq_file;
|
|||||||
struct module;
|
struct module;
|
||||||
struct device_node;
|
struct device_node;
|
||||||
|
|
||||||
#ifdef CONFIG_PINCTRL
|
|
||||||
|
|
||||||
/**
|
|
||||||
* struct gpio_pin_range - pin range controlled by a gpio chip
|
|
||||||
* @head: list for maintaining set of pin ranges, used internally
|
|
||||||
* @pctldev: pinctrl device which handles corresponding pins
|
|
||||||
* @range: actual range of pins controlled by a gpio controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct gpio_pin_range {
|
|
||||||
struct list_head node;
|
|
||||||
struct pinctrl_dev *pctldev;
|
|
||||||
struct pinctrl_gpio_range range;
|
|
||||||
};
|
|
||||||
|
|
||||||
int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
|
||||||
unsigned int pin_base, unsigned int npins);
|
|
||||||
void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct gpio_chip - abstract a GPIO controller
|
* struct gpio_chip - abstract a GPIO controller
|
||||||
* @label: for diagnostics
|
* @label: for diagnostics
|
||||||
@@ -288,4 +267,39 @@ static inline void gpio_unexport(unsigned gpio)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_GPIO_SYSFS */
|
#endif /* CONFIG_GPIO_SYSFS */
|
||||||
|
|
||||||
|
#ifdef CONFIG_PINCTRL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct gpio_pin_range - pin range controlled by a gpio chip
|
||||||
|
* @head: list for maintaining set of pin ranges, used internally
|
||||||
|
* @pctldev: pinctrl device which handles corresponding pins
|
||||||
|
* @range: actual range of pins controlled by a gpio controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct gpio_pin_range {
|
||||||
|
struct list_head node;
|
||||||
|
struct pinctrl_dev *pctldev;
|
||||||
|
struct pinctrl_gpio_range range;
|
||||||
|
};
|
||||||
|
|
||||||
|
int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
||||||
|
unsigned int pin_base, unsigned int npins);
|
||||||
|
void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
||||||
|
unsigned int pin_base, unsigned int npins)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_PINCTRL */
|
||||||
|
|
||||||
#endif /* _ASM_GENERIC_GPIO_H */
|
#endif /* _ASM_GENERIC_GPIO_H */
|
||||||
|
@@ -231,21 +231,20 @@ static inline int irq_to_gpio(unsigned irq)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PINCTRL
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
||||||
unsigned int pin_base, unsigned int npins)
|
unsigned int pin_base, unsigned int npins)
|
||||||
{
|
{
|
||||||
|
WARN_ON(1);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
|
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
|
||||||
{
|
{
|
||||||
|
WARN_ON(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_PINCTRL */
|
|
||||||
|
|
||||||
#endif /* ! CONFIG_GENERIC_GPIO */
|
#endif /* ! CONFIG_GENERIC_GPIO */
|
||||||
|
|
||||||
#endif /* __LINUX_GPIO_H */
|
#endif /* __LINUX_GPIO_H */
|
||||||
|
Reference in New Issue
Block a user