diff mbox series

gpio: Move gpiochip_.*lock_as_irq() to the proper ifdef

Message ID 20190904154631.kjegnsk6cf473nr6@flow
State New
Headers show
Series gpio: Move gpiochip_.*lock_as_irq() to the proper ifdef | expand

Commit Message

Sebastian Andrzej Siewior Sept. 4, 2019, 3:46 p.m. UTC
In a recent commit the gpiochip_.*lock_as_irq() were moved and ended up
in the wrong `ifdef' section. Now for !CONFIG_GPIOLIB the function is
defined twice leading to an compile error.

Move the extern function declaration under CONFIG_GPIOLIB, the "static
inline" version is already under !CONFIG_GPIOLIB.

Fixes: c7663fa2a6631 ("gpio: Move gpiochip_lock/unlock_as_irq to gpio/driver.h")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/gpio/driver.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Yue Haibing Sept. 5, 2019, 2:04 a.m. UTC | #1
On 2019/9/4 23:46, Sebastian Andrzej Siewior wrote:
> In a recent commit the gpiochip_.*lock_as_irq() were moved and ended up
> in the wrong `ifdef' section. Now for !CONFIG_GPIOLIB the function is
> defined twice leading to an compile error.
> 
> Move the extern function declaration under CONFIG_GPIOLIB, the "static
> inline" version is already under !CONFIG_GPIOLIB.
> 
> Fixes: c7663fa2a6631 ("gpio: Move gpiochip_lock/unlock_as_irq to gpio/driver.h")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  include/linux/gpio/driver.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index b74a3bee85e5d..fb134ff20f6b2 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -702,14 +702,14 @@ void gpiochip_free_own_desc(struct gpio_desc *desc);
>  void devprop_gpiochip_set_names(struct gpio_chip *chip,
>  				const struct fwnode_handle *fwnode);
>  
> -/* lock/unlock as IRQ */
> -int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
> -void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
> -
>  #ifdef CONFIG_GPIOLIB
>  
>  struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
>  
> +/* lock/unlock as IRQ */
> +int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
> +void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
> +
>  #else /* CONFIG_GPIOLIB */

Interesting, my patch indeed do the correct thing:

+/* lock/unlock as IRQ */
+int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
+void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
+
 #else /* CONFIG_GPIOLIB */

however, now in include/linux/gpio/driver.h, it is:

/* lock/unlock as IRQ */
int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);

#ifdef CONFIG_GPIOLIB

struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);

#else /* CONFIG_GPIOLIB */


Maybe this caused by the fuzzing?  Anyway, this fix the issue, so

Reviewed-by: YueHaibing <yuehaibing@huawei.com>

>  
>  static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
>
Linus Walleij Sept. 5, 2019, 9:36 a.m. UTC | #2
I aldready fixed this up in my tree.

On Thu, Sep 5, 2019 at 4:04 AM Yuehaibing <yuehaibing@huawei.com> wrote:

> Interesting, my patch indeed do the correct thing:

It is a classic merge collision. Something fun for the subsystem
maintainer to deal with :D

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index b74a3bee85e5d..fb134ff20f6b2 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -702,14 +702,14 @@  void gpiochip_free_own_desc(struct gpio_desc *desc);
 void devprop_gpiochip_set_names(struct gpio_chip *chip,
 				const struct fwnode_handle *fwnode);
 
-/* lock/unlock as IRQ */
-int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
-void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
-
 #ifdef CONFIG_GPIOLIB
 
 struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
 
+/* lock/unlock as IRQ */
+int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
+void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
+
 #else /* CONFIG_GPIOLIB */
 
 static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)