Skip to contentSkip to conversation

add might_sleep() to all implementations of gpio_free

PATCH In review Uwe Kleine-König 7 participants 14 messages Jul 24, 2008 – Sep 18, 2008 1 message not in the archive

Subsystems (9)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 add might_sleep() to all implementations of gpio_free

According to Documentation gpio_free should only be called from task context. To make this more explicit add a might_sleep.

Cc David Brownell <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>

---
Hello,

I added #include <linux/kernel.h> for all files that didn't already have it. And note I didn't test these changes.

Best regards
Uwe

 arch/arm/mach-davinci/gpio.c         |    2 ++
 arch/arm/mach-ns9xxx/gpio.c          |    2 ++
 arch/arm/mach-orion5x/gpio.c         |    2 ++
 drivers/gpio/gpiolib.c               |    2 ++
 include/asm-arm/arch-at91/gpio.h     |    2 ++
 include/asm-arm/arch-imx/gpio.h      |    3 +++
 include/asm-arm/arch-ixp4xx/gpio.h   |    3 +++
 include/asm-arm/arch-ks8695/gpio.h   |    3 +++
 include/asm-mips/mach-au1x00/gpio.h  |    2 ++
 include/asm-mips/mach-bcm47xx/gpio.h |    3 +++
 include/asm-mips/mach-rc32434/gpio.h |    2 ++
 include/asm-x86/mach-rdc321x/gpio.h  |    3 +++
 include/linux/gpio.h                 |    3 +++
 13 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/gpio.c +2 -0
index 9c67886..663e621 100644
@@ -43,6 +43,8 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	if (gpio >= DAVINCI_N_GPIO)
 		return;
 
arch/arm/mach-ns9xxx/gpio.c +2 -0
index b3c963b..cc7141c 100644
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/module.h>
+#include <linux/kernel.h>
 
 #include <asm/arch-ns9xxx/gpio.h>
 #include <asm/arch-ns9xxx/processor.h>
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned gpio)
 {
+	might_sleep();
 	clear_bit(gpio, gpiores);
 	return;
 }
arch/arm/mach-orion5x/gpio.c +2 -0
index d097979..f0ff5af 100644
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned pin)
 {
+	might_sleep();
+
 	if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
 		pr_debug("%s: invalid GPIO %d\n", __func__, pin);
 		return;
drivers/gpio/gpiolib.c +2 -0
index beaf6b3..049d37d 100644
@@ -291,6 +291,8 @@ void gpio_free(unsigned gpio)
 	unsigned long		flags;
 	struct gpio_desc	*desc;
 
+	might_sleep();
+
 	if (!gpio_is_valid(gpio)) {
 		WARN_ON(extra_checks);
 		return;
include/asm-arm/arch-at91/gpio.h +2 -0
index 0a241e2..2fd7a83 100644
@@ -13,6 +13,7 @@
 #ifndef __ASM_ARCH_AT91RM9200_GPIO_H
 #define __ASM_ARCH_AT91RM9200_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/irq.h>
 
 #define PIN_BASE		NR_AIC_IRQS
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 extern int gpio_direction_input(unsigned gpio);
include/asm-arm/arch-imx/gpio.h +3 -0
index 4860232..55b896e 100644
@@ -1,5 +1,6 @@
 #ifndef _IMX_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/arch/imx-regs.h>
 
 #define IMX_GPIO_ALLOC_MODE_NORMAL	0
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	imx_gpio_free(gpio);
 }
 
include/asm-arm/arch-ixp4xx/gpio.h +3 -0
index 3a4c5b8..d804661 100644
@@ -25,6 +25,7 @@
 #ifndef __ASM_ARCH_IXP4XX_GPIO_H
 #define __ASM_ARCH_IXP4XX_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/hardware.h>
 
 static inline int gpio_request(unsigned gpio, const char *label)
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	return;
 }
 
include/asm-arm/arch-ks8695/gpio.h +3 -0
index 65ceea2..758df66 100644
@@ -11,6 +11,8 @@
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
+#include <linux/kernel.h>
+
 #define KS8695_GPIO_0		0
 #define KS8695_GPIO_1		1
 #define KS8695_GPIO_2		2
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label)
 
 static inline void gpio_free(unsigned int pin)
 {
+	might_sleep();
 }
 
 #endif
include/asm-mips/mach-au1x00/gpio.h +2 -0
index 2dc61e0..31eddba 100644
@@ -1,6 +1,7 @@
 #ifndef _AU1XXX_GPIO_H_
 #define _AU1XXX_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 #define AU1XXX_GPIO_BASE	200
@@ -31,6 +32,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 
 static inline int gpio_direction_input(unsigned gpio)
include/asm-mips/mach-bcm47xx/gpio.h +3 -0
index cfc8f4d..af17ccd 100644
@@ -9,6 +9,8 @@
 #ifndef __BCM47XX_GPIO_H
 #define __BCM47XX_GPIO_H
 
+#include <linux/kernel.h>
+
 #define BCM47XX_EXTIF_GPIO_LINES	5
 #define BCM47XX_CHIPCO_GPIO_LINES	16
 
@@ -25,6 +27,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 static inline int gpio_to_irq(unsigned gpio)
include/asm-mips/mach-rc32434/gpio.h +2 -0
index f946f5f..9b4722e 100644
@@ -13,6 +13,7 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 struct rb532_gpio_reg {
@@ -88,6 +89,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 
 static inline int gpio_direction_input(unsigned gpio)
include/asm-x86/mach-rdc321x/gpio.h +3 -0
index acce0b7..3639ece 100644
@@ -1,6 +1,8 @@
 #ifndef _RDC321X_GPIO_H
 #define _RDC321X_GPIO_H
 
+#include <linux/kernel.h>
+
 extern int rdc_gpio_get_value(unsigned gpio);
 extern void rdc_gpio_set_value(unsigned gpio, int value);
 extern int rdc_gpio_direction_input(unsigned gpio);
@@ -18,6 +20,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 	rdc_gpio_free(gpio);
 }
 
include/linux/gpio.h +3 -0
index 98be6c5..570a4f3 100644
@@ -8,6 +8,7 @@
 
 #else
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	/* GPIO can never have been requested */
 	WARN_ON(1);
 }
Signature · 1 line
1.5.6.3
#2 lore raw

Hello,

Quoted 2 lines · Uwe Kleine-König

According to Documentation gpio_free should only be called from task context. To make this more explicit add a might_sleep.

I just now noticed that I forgot to include my changes to arch/blackfin/kernel/bfin_gpio.c in my patch. Will fix that when/if resending the patch.

Best regards
Uwe

Signature · 3 lines
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
#3 lore raw

PATCH 1/1 gpio_free might sleep, generic part

In reply to Uwe Kleine-König

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This is the generic part which changes gpiolib and the fallback implementation only.

Cc David Brownell <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>

---
Hello,

this is a new version of the patch I sent on 2008-07-24 07:28:35 GMT
(http://thread.gmane.org/gmane.linux.kernel/711078)

David Brownell suggested (via private mail) to split the patch along arch lines. I did that, added Blackfin (which I missed last time) and left out DaVinci (in ARCH=arm) on Dave's request.

Something that really made me happy is that git managed to use the old patch although many includes for arm changed location with only three conflicts.

Note the series is not compile tested because I only have an x86 compiler handy at the moment.

Best regards
Uwe

 drivers/gpio/gpiolib.c |    2 ++
 include/linux/gpio.h   |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpio/gpiolib.c +2 -0
index 8d29405..317004f 100644
@@ -792,6 +792,8 @@ void gpio_free(unsigned gpio)
 	unsigned long		flags;
 	struct gpio_desc	*desc;
 
+	might_sleep();
+
 	if (!gpio_is_valid(gpio)) {
 		WARN_ON(extra_checks);
 		return;
include/linux/gpio.h +3 -0
index 730a20b..e10c49a 100644
@@ -8,6 +8,7 @@
 
 #else
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	/* GPIO can never have been requested */
 	WARN_ON(1);
 }
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH 1/1 gpio_free might sleep, arm architecture

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the arm architecture. DaVinci is skipped on purpose to simplify the merge process for patches switching it over to use gpiolib as per request by David Brownell.

Cc David Brownell <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Haavard Skinnemoen <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/mach-at91/include/mach/gpio.h   |    2 ++
 arch/arm/mach-imx/include/mach/gpio.h    |    3 +++
 arch/arm/mach-ixp4xx/include/mach/gpio.h |    3 +++
 arch/arm/mach-ks8695/include/mach/gpio.h |    3 +++
 arch/arm/mach-ns9xxx/gpio.c              |    2 ++
 arch/arm/mach-orion5x/gpio.c             |    2 ++
 6 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/mach-at91/include/mach/gpio.h +2 -0
index 76d76e2..bffa674 100644
@@ -13,6 +13,7 @@
 #ifndef __ASM_ARCH_AT91RM9200_GPIO_H
 #define __ASM_ARCH_AT91RM9200_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/irq.h>
 
 #define PIN_BASE		NR_AIC_IRQS
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 extern int gpio_direction_input(unsigned gpio);
arch/arm/mach-imx/include/mach/gpio.h +3 -0
index 6e3d795..502d5aa 100644
@@ -1,5 +1,6 @@
 #ifndef _IMX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/imx-regs.h>
 
 #define IMX_GPIO_ALLOC_MODE_NORMAL	0
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	imx_gpio_free(gpio);
 }
 
arch/arm/mach-ixp4xx/include/mach/gpio.h +3 -0
index 9fbde17..cd5aec2 100644
@@ -25,6 +25,7 @@
 #ifndef __ASM_ARCH_IXP4XX_GPIO_H
 #define __ASM_ARCH_IXP4XX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/hardware.h>
 
 static inline int gpio_request(unsigned gpio, const char *label)
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	return;
 }
 
arch/arm/mach-ks8695/include/mach/gpio.h +3 -0
index 73c8416..d4af5c3 100644
@@ -11,6 +11,8 @@
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
+#include <linux/kernel.h>
+
 #define KS8695_GPIO_0		0
 #define KS8695_GPIO_1		1
 #define KS8695_GPIO_2		2
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label)
 
 static inline void gpio_free(unsigned int pin)
 {
+	might_sleep();
 }
 
 #endif
arch/arm/mach-ns9xxx/gpio.c +2 -0
index 804c300..9e088c4 100644
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/module.h>
+#include <linux/kernel.h>
 
 #include <mach/gpio.h>
 #include <mach/processor.h>
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned gpio)
 {
+	might_sleep();
 	clear_bit(gpio, gpiores);
 	return;
 }
arch/arm/mach-orion5x/gpio.c +2 -0
index cd8a16f..3bdfd0a 100644
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned pin)
 {
+	might_sleep();
+
 	if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
 		pr_debug("%s: invalid GPIO %d\n", __func__, pin);
 		return;
Signature · 1 line
1.5.6.5
#5 lore raw

PATCH 1/1 gpio_free might sleep, mips architecture

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the mips architecture.

Cc David Brownell <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 include/asm-mips/mach-au1x00/gpio.h  |    2 ++
 include/asm-mips/mach-bcm47xx/gpio.h |    3 +++
 include/asm-mips/mach-rc32434/gpio.h |    2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)
include/asm-mips/mach-au1x00/gpio.h +2 -0
index 2dc61e0..31eddba 100644
@@ -1,6 +1,7 @@
 #ifndef _AU1XXX_GPIO_H_
 #define _AU1XXX_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 #define AU1XXX_GPIO_BASE	200
@@ -31,6 +32,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 
 static inline int gpio_direction_input(unsigned gpio)
include/asm-mips/mach-bcm47xx/gpio.h +3 -0
index cfc8f4d..af17ccd 100644
@@ -9,6 +9,8 @@
 #ifndef __BCM47XX_GPIO_H
 #define __BCM47XX_GPIO_H
 
+#include <linux/kernel.h>
+
 #define BCM47XX_EXTIF_GPIO_LINES	5
 #define BCM47XX_CHIPCO_GPIO_LINES	16
 
@@ -25,6 +27,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 static inline int gpio_to_irq(unsigned gpio)
include/asm-mips/mach-rc32434/gpio.h +2 -0
index f946f5f..9b4722e 100644
@@ -13,6 +13,7 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 struct rb532_gpio_reg {
@@ -88,6 +89,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 
 static inline int gpio_direction_input(unsigned gpio)
Signature · 1 line
1.5.6.5
#6 lore raw

PATCH 1/1 gpio_free might sleep, blackfin architecture

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the blackfin architecture.

Cc David Brownell <[email protected]>
Cc Bryan Wu <[email protected]
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 arch/blackfin/kernel/bfin_gpio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/blackfin/kernel/bfin_gpio.c +2 -0
index ecbd141..394006d 100644
@@ -1151,6 +1151,8 @@ void gpio_free(unsigned gpio)
 	if (check_gpio(gpio) < 0)
 		return;
 
+	might_sleep();
+
 	local_irq_save(flags);
 
 	if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
Signature · 1 line
1.5.6.5
#7 lore raw

PATCH 1/1 gpio_free might sleep, x86 architecture

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the x86 architecture.

Cc David Brownell <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 include/asm-x86/mach-rdc321x/gpio.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/asm-x86/mach-rdc321x/gpio.h +3 -0
index acce0b7..3639ece 100644
@@ -1,6 +1,8 @@
 #ifndef _RDC321X_GPIO_H
 #define _RDC321X_GPIO_H
 
+#include <linux/kernel.h>
+
 extern int rdc_gpio_get_value(unsigned gpio);
 extern void rdc_gpio_set_value(unsigned gpio, int value);
 extern int rdc_gpio_direction_input(unsigned gpio);
@@ -18,6 +20,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 	rdc_gpio_free(gpio);
 }
 
Signature · 1 line
1.5.6.5
Applied
#8 lore raw

Re: [PATCH] gpio_free might sleep, x86 architecture

Quoted 6 lines · Uwe Kleine-König

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the x86 architecture.

applied to tip/x86/debug, thanks Uwe,

Ingo

Acked-by on v1 1/1
#9 lore raw

Re: [PATCH] gpio_free might sleep, blackfin architecture

In reply to Uwe Kleine-König
Quoted 7 lines · Uwe Kleine-König

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the blackfin architecture.

It looks fine for me, thanks a lot.

Quoted 35 lines
Cc David Brownell <[email protected]>
Cc Bryan Wu <[email protected]
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 arch/blackfin/kernel/bfin_gpio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/blackfin/kernel/bfin_gpio.c +2 -1
index ecbd141..394006d 100644
@@ -1151,6 +1151,8 @@ void gpio_free(unsigned gpio)
       if (check_gpio(gpio) < 0)
               return;
 
+       might_sleep();
+
       local_irq_save(flags);
 
       if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
--

1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#10 lore raw

Re: [PATCH] gpio_free might sleep, blackfin architecture

Hello Bryan,

Quoted 6 lines · Bryan Wu
Quoted 4 lines · Uwe Kleine-König

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

Quoted 7 lines
Quoted 3 lines

This patch changes the gpio_free implementations for the blackfin architecture.

It looks fine for me, thanks a lot.

I suspect David suggested to split my initial patch at arch lines because then the patches can go via the arch trees into vanilla.

Best regards and thanks,
Uwe

Signature · 3 lines
Uwe Kleine-König

http://www.google.com/search?q=0+degree+Celsius+in+kelvin
#11 lore raw

Re: [PATCH] gpio_free might sleep, mips architecture

In reply to Uwe Kleine-König
Quoted 76 lines · On Mon, 15 Sep 2008 22:02:41 +0200 Uwe Kleine-K__nig…

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the mips architecture.

Cc David Brownell <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 include/asm-mips/mach-au1x00/gpio.h  |    2 ++
 include/asm-mips/mach-bcm47xx/gpio.h |    3 +++
 include/asm-mips/mach-rc32434/gpio.h |    2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)
include/asm-mips/mach-au1x00/gpio.h +2 -0
index 2dc61e0..31eddba 100644
@@ -1,6 +1,7 @@
 #ifndef _AU1XXX_GPIO_H_
 #define _AU1XXX_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 #define AU1XXX_GPIO_BASE	200
@@ -31,6 +32,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 
 static inline int gpio_direction_input(unsigned gpio)
include/asm-mips/mach-bcm47xx/gpio.h +3 -0
index cfc8f4d..af17ccd 100644
@@ -9,6 +9,8 @@
 #ifndef __BCM47XX_GPIO_H
 #define __BCM47XX_GPIO_H
 
+#include <linux/kernel.h>
+
 #define BCM47XX_EXTIF_GPIO_LINES	5
 #define BCM47XX_CHIPCO_GPIO_LINES	16
 
@@ -25,6 +27,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 static inline int gpio_to_irq(unsigned gpio)
include/asm-mips/mach-rc32434/gpio.h +1 -0
index f946f5f..9b4722e 100644
@@ -13,6 +13,7 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 struct rb532_gpio_reg {

include/asm-mips/mach-rc32434/gpio.h static inline int gpio_request(unsigned gpio, const char *label) · line 94

Quoted 6 lines
include/asm-mips/mach-rc32434/gpio.h +1 -0
@@ -88,6 +89,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 

There is no gpio_free() in linux-next's include/asm-mips/mach-rc32434/gpio.h

#12 lore raw

Re: [PATCH] gpio_free might sleep, mips architecture

Hello,

Quoted 11 lines · Andrew Morton
Quoted 11 lines
include/asm-mips/mach-rc32434/gpio.h +1 -0
index f946f5f..9b4722e 100644
@@ -13,6 +13,7 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
Quoted 10 lines

include/asm-mips/mach-rc32434/gpio.h static inline int gpio_request(unsigned gpio, const char *label) · line 94

Quoted 8 lines
include/asm-mips/mach-rc32434/gpio.h +1 -0
 struct rb532_gpio_reg {
@@ -88,6 +89,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 

There is no gpio_free() in linux-next's include/asm-mips/mach-rc32434/gpio.h

This is OK. This machine type is converted to GPIO lib in linus-next. So just drop the two hunks for this file. (Note, you only dropped the addition of might_sleep, but then including linux/kernel.h isn't needed either.)

Best regards and thanks
Uwe

Signature · 6 lines
Uwe Kleine-König

exit vi, lesson II:
: w q ! <CR>

NB: write the current file
#13 lore raw

Re: [PATCH] gpio_free might sleep, mips architecture

Quoted 22 lines · Uwe Kleine-König
Quoted 11 lines · Andrew Morton
Quoted 11 lines
include/asm-mips/mach-rc32434/gpio.h +1 -0
index f946f5f..9b4722e 100644
@@ -13,6 +13,7 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 
Quoted 10 lines

include/asm-mips/mach-rc32434/gpio.h static inline int gpio_request(unsigned gpio, const char *label) · line 94

Quoted 8 lines
include/asm-mips/mach-rc32434/gpio.h +1 -0
 struct rb532_gpio_reg {
@@ -88,6 +89,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 static inline void gpio_free(unsigned gpio)
 {
 	/* Not yet implemented */
+	might_sleep();
 }
 

There is no gpio_free() in linux-next's include/asm-mips/mach-rc32434/gpio.h

Quoted 4 lines

This is OK. This machine type is converted to GPIO lib in linus-next. So just drop the two hunks for this file. (Note, you only dropped the addition of might_sleep, but then including linux/kernel.h isn't needed either.)

A few days ago I've put a patch to move include/asm-mips/ to arch/ like several other architectures already did so you patch may conflict ...

Ralf

Acked-by on v1 1/1
#14 lore raw

Re: [PATCH] gpio_free might sleep, arm architecture

In reply to Uwe Kleine-König
Quoted 10 lines · Uwe Kleine-König

According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations.

This patch changes the gpio_free implementations for the arm architecture. DaVinci is skipped on purpose to simplify the merge process for patches switching it over to use gpiolib as per request by David Brownell.

Not dependent on anything else, FWIW (and Kevin already sent the DaVinci patch for review) ... so IMO this is ready to merge as soon as Russell agrees.

Consider this also an ack for the MIPS, Blackfin, and x86 arch-specific updates. (Which are likewise ripe for merge.)

(These patches are not a 2.6.27 priority, of course...)

Quoted 138 lines
Cc David Brownell <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Haavard Skinnemoen <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Greg KH <[email protected]>
Cc Kay Sievers <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/mach-at91/include/mach/gpio.h   |    2 ++
 arch/arm/mach-imx/include/mach/gpio.h    |    3 +++
 arch/arm/mach-ixp4xx/include/mach/gpio.h |    3 +++
 arch/arm/mach-ks8695/include/mach/gpio.h |    3 +++
 arch/arm/mach-ns9xxx/gpio.c              |    2 ++
 arch/arm/mach-orion5x/gpio.c             |    2 ++
 6 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/mach-at91/include/mach/gpio.h +2 -0
index 76d76e2..bffa674 100644
@@ -13,6 +13,7 @@
 #ifndef __ASM_ARCH_AT91RM9200_GPIO_H
 #define __ASM_ARCH_AT91RM9200_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/irq.h>
 
 #define PIN_BASE		NR_AIC_IRQS
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
 }
 
 extern int gpio_direction_input(unsigned gpio);
arch/arm/mach-imx/include/mach/gpio.h +3 -0
index 6e3d795..502d5aa 100644
@@ -1,5 +1,6 @@
 #ifndef _IMX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/imx-regs.h>
 
 #define IMX_GPIO_ALLOC_MODE_NORMAL	0
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	imx_gpio_free(gpio);
 }
 
arch/arm/mach-ixp4xx/include/mach/gpio.h +3 -0
index 9fbde17..cd5aec2 100644
@@ -25,6 +25,7 @@
 #ifndef __ASM_ARCH_IXP4XX_GPIO_H
 #define __ASM_ARCH_IXP4XX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/hardware.h>
 
 static inline int gpio_request(unsigned gpio, const char *label)
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	return;
 }
 
arch/arm/mach-ks8695/include/mach/gpio.h +3 -0
index 73c8416..d4af5c3 100644
@@ -11,6 +11,8 @@
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
+#include <linux/kernel.h>
+
 #define KS8695_GPIO_0		0
 #define KS8695_GPIO_1		1
 #define KS8695_GPIO_2		2
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label)
 
 static inline void gpio_free(unsigned int pin)
 {
+	might_sleep();
 }
 
 #endif
arch/arm/mach-ns9xxx/gpio.c +2 -0
index 804c300..9e088c4 100644
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/module.h>
+#include <linux/kernel.h>
 
 #include <mach/gpio.h>
 #include <mach/processor.h>
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned gpio)
 {
+	might_sleep();
 	clear_bit(gpio, gpiores);
 	return;
 }
arch/arm/mach-orion5x/gpio.c +2 -0
index cd8a16f..3bdfd0a 100644
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned pin)
 {
+	might_sleep();
+
 	if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
 		pr_debug("%s: invalid GPIO %d\n", __func__, pin);
 		return;
Signature · 1 line
1.5.6.5