Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334545 > unrolled thread

[PATCH 0/4] clean up irq_to_gpio and asm/gpio.h

Started byArnd Bergmann <arnd@arndb.de>
First post2016-02-15 16:50 +0100
Last post2016-02-16 16:50 +0100
Articles 7 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 0/4] clean up irq_to_gpio and asm/gpio.h Arnd Bergmann <arnd@arndb.de> - 2016-02-15 16:50 +0100
    [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Arnd Bergmann <arnd@arndb.de> - 2016-02-15 16:50 +0100
      Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Lars-Peter Clausen <lars@metafoo.de> - 2016-02-15 17:10 +0100
        Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Arnd Bergmann <arnd@arndb.de> - 2016-02-15 21:20 +0100
      Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Arnd Bergmann <arnd@arndb.de> - 2016-02-16 16:50 +0100
        Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Linus Walleij <linus.walleij@linaro.org> - 2016-02-16 17:00 +0100
      Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Linus Walleij <linus.walleij@linaro.org> - 2016-02-16 16:50 +0100

#1334545 — [PATCH 0/4] clean up irq_to_gpio and asm/gpio.h

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-15 16:50 +0100
Subject[PATCH 0/4] clean up irq_to_gpio and asm/gpio.h
Message-ID<r2tzr-2WJ-3@gated-at.bofh.it>
I noticed that arch/arm/include/asm/gpio.h can almost be removed,
after we have already removed the file for most other architectures
now.

When I removed it, I ran into problems with irq_to_gpio(), which
we had already killed off in ARM, but it survived (barely) in the
global headers. this kills it off some more as well.

I'd suggest merging all four patches through the GPIO tree.

	Arnd

[toc] | [next] | [standalone]


#1334548 — [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-15 16:50 +0100
Subject[PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2tzs-2WJ-25@gated-at.bofh.it>
In reply to#1334545
gpiolib has removed the irq_to_gpio() API several years ago,
but the global header still provided a non-working stub.

Apparently one new user has shown up in arch/mips, so this patch
moves the broken definition to where it is used, ensuring that
we get new users but not changing the current behavior on jz4740.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/jz4740/gpio.c |  7 +++++++
 include/linux/gpio.h    | 12 ------------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 8c6d76c9b2d6..e9bb43714892 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/compiler.h>
 
 #include <linux/io.h>
 #include <linux/gpio.h>
@@ -270,6 +271,12 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
 }
 EXPORT_SYMBOL(jz_gpio_port_get_value);
 
+static inline __deprecated int irq_to_gpio(unsigned int irq)
+{
+	/* this has clearly not worked for a long time */
+	return -EINVAL;
+}
+
 #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
 
 static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index d12b5d566e4b..6fc1c9e74854 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -70,11 +70,6 @@ static inline int gpio_to_irq(unsigned int gpio)
 	return __gpio_to_irq(gpio);
 }
 
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
 #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
 
 /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
@@ -222,13 +217,6 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,
 	WARN_ON(1);
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	/* irq can never have been returned from gpio_to_irq() */
-	WARN_ON(1);
-	return -EINVAL;
-}
-
 static inline int
 gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
 		       unsigned int gpio_offset, unsigned int pin_offset,
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1334557 — Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromLars-Peter Clausen <lars@metafoo.de>
Date2016-02-15 17:10 +0100
SubjectRe: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2tSO-3jp-5@gated-at.bofh.it>
In reply to#1334548
On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> +static inline __deprecated int irq_to_gpio(unsigned int irq)
> +{
> +	/* this has clearly not worked for a long time */
> +	return -EINVAL;
> +}
> +
>  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)

The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
the uses of custom gpio.h").

The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".

- Lars

[toc] | [prev] | [next] | [standalone]


#1334787 — Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-15 21:20 +0100
SubjectRe: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2xMJ-604-3@gated-at.bofh.it>
In reply to#1334557
On Monday 15 February 2016 17:01:09 Lars-Peter Clausen wrote:
> On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> > +static inline __deprecated int irq_to_gpio(unsigned int irq)
> > +{
> > +     /* this has clearly not worked for a long time */
> > +     return -EINVAL;
> > +}
> > +
> >  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
> 
> The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
> the uses of custom gpio.h").
> 
> The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".
> 
> 

Ah, that explain it, so it has not been broken for that long.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1335559 — Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-16 16:50 +0100
SubjectRe: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2Q31-1iJ-27@gated-at.bofh.it>
In reply to#1334548
On Tuesday 16 February 2016 16:42:18 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > gpiolib has removed the irq_to_gpio() API several years ago,
> > but the global header still provided a non-working stub.
> >
> > Apparently one new user has shown up in arch/mips, so this patch
> > moves the broken definition to where it is used, ensuring that
> > we get new users but not changing the current behavior on jz4740.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Patch applied.
> 
> I expect the driver maintainer to deal with the resulting
> deprecation fallout.
> 

I've just sent v2 of the series, with a separate patch for MIPS
that now conflicts with this one. Can you pick up the new patch
instead?

	Arnd

[toc] | [prev] | [next] | [standalone]


#1335580 — Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-02-16 17:00 +0100
SubjectRe: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2QcG-1mI-23@gated-at.bofh.it>
In reply to#1335559
On Tue, Feb 16, 2016 at 4:45 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> I've just sent v2 of the series, with a separate patch for MIPS
> that now conflicts with this one. Can you pick up the new patch
> instead?

OK I'll back out and apply the v2 versions.

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1335570 — Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-02-16 16:50 +0100
SubjectRe: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
Message-ID<r2Q31-1iJ-29@gated-at.bofh.it>
In reply to#1334548
On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> gpiolib has removed the irq_to_gpio() API several years ago,
> but the global header still provided a non-working stub.
>
> Apparently one new user has shown up in arch/mips, so this patch
> moves the broken definition to where it is used, ensuring that
> we get new users but not changing the current behavior on jz4740.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

I expect the driver maintainer to deal with the resulting
deprecation fallout.

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web