Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e
Commit:     5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e
Parent:     adff264fe66d78a166dc887f861e7273d0cb1654
Author:     Philipp Zabel <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 20 13:58:20 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 20 17:10:16 2007 -0800

    [PATCH] GPIO API: SA1100 wrapper cleanup
    
    Based on the discussion last december (http://lkml.org/lkml/2006/12/20/241),
    this patch
      - adds gpio_direction_input/output functions to
        generic.c instead of making them inline,
      - fixes comment and includes and uses inline functions
        instead of macros in gpio.h
    
    Signed-off-by: Philipp Zabel <[EMAIL PROTECTED]>
    Signed-off-by: David Brownell <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/arm/mach-sa1100/generic.c     |   30 ++++++++++++++++++++++++++++++
 include/asm-arm/arch-sa1100/gpio.h |   34 ++++++++++++++--------------------
 2 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index e510295..192a5a2 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -138,6 +138,36 @@ unsigned long long sched_clock(void)
        return v;
 }
 
+int gpio_direction_input(unsigned gpio)
+{
+       unsigned long flags;
+
+       if (gpio > GPIO_MAX)
+               return -EINVAL;
+
+       local_irq_save(flags);
+       GPDR &= ~GPIO_GPIO(gpio);
+       local_irq_restore(flags);
+       return 0;
+}
+
+EXPORT_SYMBOL(gpio_direction_input);
+
+int gpio_direction_output(unsigned gpio)
+{
+       unsigned long flags;
+
+       if (gpio > GPIO_MAX)
+               return -EINVAL;
+
+       local_irq_save(flags);
+       GPDR |= GPIO_GPIO(gpio);
+       local_irq_restore(flags);
+       return 0;
+}
+
+EXPORT_SYMBOL(gpio_direction_output);
+
 /*
  * Default power-off for SA1100
  */
diff --git a/include/asm-arm/arch-sa1100/gpio.h 
b/include/asm-arm/arch-sa1100/gpio.h
index a331fe3..da7575b 100644
--- a/include/asm-arm/arch-sa1100/gpio.h
+++ b/include/asm-arm/arch-sa1100/gpio.h
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/arch-pxa/gpio.h
+ * linux/include/asm-arm/arch-sa1100/gpio.h
  *
  * SA1100 GPIO wrappers for arch-neutral GPIO calls
  *
@@ -24,11 +24,8 @@
 #ifndef __ASM_ARCH_SA1100_GPIO_H
 #define __ASM_ARCH_SA1100_GPIO_H
 
-#include <asm/arch/SA-1100.h>
-#include <asm/arch/irqs.h>
-#include <asm/arch/hardware.h>
-
-#include <asm/errno.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
 
 static inline int gpio_request(unsigned gpio, const char *label)
 {
@@ -40,26 +37,23 @@ static inline void gpio_free(unsigned gpio)
        return;
 }
 
-static inline int gpio_direction_input(unsigned gpio)
+extern int gpio_direction_input(unsigned gpio);
+extern int gpio_direction_output(unsigned gpio);
+
+
+static inline int gpio_get_value(unsigned gpio)
 {
-       if (gpio > GPIO_MAX)
-               return -EINVAL;
-       GPDR = (GPDR_In << gpio) 0
+       return GPLR & GPIO_GPIO(gpio);
 }
 
-static inline int gpio_direction_output(unsigned gpio)
+static inline void gpio_set_value(unsigned gpio, int value)
 {
-       if (gpio > GPIO_MAX)
-               return -EINVAL;
-       GPDR = (GPDR_Out << gpio) 0
+       if (value)
+               GPSR = GPIO_GPIO(gpio);
+       else
+               GPCR = GPIO_GPIO(gpio);
 }
 
-#define gpio_get_value(gpio) \
-       (GPLR & GPIO_GPIO(gpio))
-
-#define gpio_set_value(gpio,value) \
-       ((value) ? (GPSR = GPIO_GPIO(gpio)) : (GPCR(gpio) = GPIO_GPIO(gpio)))
-
 #include <asm-generic/gpio.h>                  /* cansleep wrappers */
 
 static inline unsigned gpio_to_irq(unsigned gpio)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to