If CONFIG_GPIOLIB is not, gpiochip_lock/unlock_as_irq will conflict as this: In file included from sound/soc/codecs/wm5100.c:18:0: ./include/linux/gpio.h:224:19: error: static declaration of gpiochip_lock_as_irq follows non-static declaration static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~ In file included from sound/soc/codecs/wm5100.c:17:0: ./include/linux/gpio/driver.h:494:5: note: previous declaration of gpiochip_lock_as_irq was here int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); ^~~~~~~~~~~~~~~~~~~~ In file included from sound/soc/codecs/wm5100.c:18:0: ./include/linux/gpio.h:231:20: error: static declaration of gpiochip_unlock_as_irq follows non-static declaration static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, ^~~~~~~~~~~~~~~~~~~~~~ In file included from sound/soc/codecs/wm5100.c:17:0: ./include/linux/gpio/driver.h:495:6: note: previous declaration of gpiochip_unlock_as_irq was here void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); ^~~~~~~~~~~~~~~~~~~~~~ Move them to gpio/driver.h and use CONFIG_GPIOLIB guard this.
Unified · Split
| @@ -221,19 +221,6 @@ static inline int gpio_to_irq(unsigned gpio) · 220 unmodified lines | ||
| 221 | 221 | return -EINVAL; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | −static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, | |
| 225 | − unsigned int offset) | |
| 226 | −{ | |
| 227 | − WARN_ON(1); | |
| 228 | − return -EINVAL; | |
| 229 | −} | |
| 230 | − | |
| 231 | −static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, | |
| 232 | − unsigned int offset) | |
| 233 | −{ | |
| 234 | − WARN_ON(1); | |
| 235 | −} | |
| 236 | − | |
| 237 | 224 | static inline int irq_to_gpio(unsigned irq) |
| 238 | 225 | { |
| 239 | 226 | /* irq can never have been returned from gpio_to_irq() */ |
| @@ -495,9 +495,6 @@ extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip, · 494 unmodified lines | ||
| 495 | 495 | extern struct gpio_chip *gpiochip_find(void *data, |
| 496 | 496 | int (*match)(struct gpio_chip *chip, void *data)); |
| 497 | 497 | |
| 498 | −/* lock/unlock as IRQ */ | |
| 499 | −int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 500 | −void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 501 | 498 | bool gpiochip_line_is_irq(struct gpio_chip *chip, unsigned int offset); |
| 502 | 499 | int gpiochip_reqres_irq(struct gpio_chip *chip, unsigned int offset); |
| 503 | 500 | void gpiochip_relres_irq(struct gpio_chip *chip, unsigned int offset); |
| @@ -723,6 +720,10 @@ void gpiochip_free_own_desc(struct gpio_desc *desc); · 219 unmodified lines | ||
| 723 | 720 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
| 724 | 721 | const struct fwnode_handle *fwnode); |
| 725 | 722 | |
| 723 | +/* lock/unlock as IRQ */ | |
| 724 | +int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 725 | +void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); | |
| 726 | + | |
| 726 | 727 | #else /* CONFIG_GPIOLIB */ |
| 727 | 728 | |
| 728 | 729 | static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) |
| @@ -732,6 +733,18 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) · 3 unmodified lines | ||
| 732 | 733 | return ERR_PTR(-ENODEV); |
| 733 | 734 | } |
| 734 | 735 | |
| 736 | +static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, | |
| 737 | + unsigned int offset) | |
| 738 | +{ | |
| 739 | + WARN_ON(1); | |
| 740 | + return -EINVAL; | |
| 741 | +} | |
| 742 | + | |
| 743 | +static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, | |
| 744 | + unsigned int offset) | |
| 745 | +{ | |
| 746 | + WARN_ON(1); | |
| 747 | +} | |
| 735 | 748 | #endif /* CONFIG_GPIOLIB */ |
| 736 | 749 | |
| 737 | 750 | #endif |