According to Documentation gpio_free should only be called from task
context. To make this more explicit add a might_sleep.
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---
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(-)
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index 9c67886..663e621 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -43,6 +43,8 @@ EXPORT_SYMBOL(gpio_request);
void gpio_free(unsigned gpio)
{
+ might_sleep();
+
if (gpio >= DAVINCI_N_GPIO)
return;
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c
index b3c963b..cc7141c 100644
--- a/arch/arm/mach-ns9xxx/gpio.c
+++ b/arch/arm/mach-ns9xxx/gpio.c
@@ -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 @@ ...Hello, 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 -- 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 --
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. Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Cc: David Brownell <david-b@pacbell.net> Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> --- 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(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 8d29405..317004f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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; diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 730a20b..e10c49a 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -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 ...
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. Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Cc: David Brownell <david-b@pacbell.net> Cc: Andrew Victor <linux@maxim.org.za> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: arm-linux-kernel@arm.linux.org.uk --- 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(-) diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 76d76e2..bffa674 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h @@ -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); diff --git a/arch/arm/mach-imx/include/mach/gpio.h b/arch/arm/mach-imx/include/mach/gpio.h index 6e3d795..502d5aa 100644 --- ...
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. Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Cc: David Brownell <david-b@pacbell.net> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> --- 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(-) diff --git a/include/asm-mips/mach-au1x00/gpio.h b/include/asm-mips/mach-au1x00/gpio.h index 2dc61e0..31eddba 100644 --- a/include/asm-mips/mach-au1x00/gpio.h +++ b/include/asm-mips/mach-au1x00/gpio.h @@ -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) diff --git a/include/asm-mips/mach-bcm47xx/gpio.h b/include/asm-mips/mach-bcm47xx/gpio.h index cfc8f4d..af17ccd 100644 --- a/include/asm-mips/mach-bcm47xx/gpio.h +++ b/include/asm-mips/mach-bcm47xx/gpio.h @@ -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 ...
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. Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Cc: David Brownell <david-b@pacbell.net> Cc: Bryan Wu <cooloney@kernel.org Cc: uclinux-dist-devel@blackfin.uclinux.org Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/blackfin/kernel/bfin_gpio.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index ecbd141..394006d 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c @@ -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 --
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.
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Cc: David Brownell <david-b@pacbell.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---
include/asm-x86/mach-rdc321x/gpio.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/asm-x86/mach-rdc321x/gpio.h b/include/asm-x86/mach-rdc321x/gpio.h
index acce0b7..3639ece 100644
--- a/include/asm-x86/mach-rdc321x/gpio.h
+++ b/include/asm-x86/mach-rdc321x/gpio.h
@@ -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);
}
--
1.5.6.5
--
applied to tip/x86/debug, thanks Uwe, Ingo --
On Tue, Sep 16, 2008 at 4:02 AM, Uwe Kleine-König It looks fine for me, thanks a lot. --
Hello Bryan, 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 -- Uwe Kleine-König http://www.google.com/search?q=0+degree+Celsius+in+kelvin --
On Mon, 15 Sep 2008 22:02:41 +0200 There is no gpio_free() in linux-next's include/asm-mips/mach-rc32434/gpio.h --
Hello, 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 -- Uwe Kleine-König NB: write the current file --
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: David Brownell <dbrownell@users.sourceforge.net> 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.) --
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX accounting. |
| Linux Kernel Mailing List | ixgbe: fix several counter register errata |
| Linux Kernel Mailing List | b43: fix build with CONFIG_SSB_PCIHOST=n< |
