diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2007-02-20 16:58:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 20:10:16 -0500 |
commit | 5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e (patch) | |
tree | 76758cee84ef63ab138943a2597b645ce58462cb /arch | |
parent | adff264fe66d78a166dc887f861e7273d0cb1654 (diff) |
[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 <philipp.zabel@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index e510295c2580..192a5a26cf2b 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) | |||
138 | return v; | 138 | return v; |
139 | } | 139 | } |
140 | 140 | ||
141 | int gpio_direction_input(unsigned gpio) | ||
142 | { | ||
143 | unsigned long flags; | ||
144 | |||
145 | if (gpio > GPIO_MAX) | ||
146 | return -EINVAL; | ||
147 | |||
148 | local_irq_save(flags); | ||
149 | GPDR &= ~GPIO_GPIO(gpio); | ||
150 | local_irq_restore(flags); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | EXPORT_SYMBOL(gpio_direction_input); | ||
155 | |||
156 | int gpio_direction_output(unsigned gpio) | ||
157 | { | ||
158 | unsigned long flags; | ||
159 | |||
160 | if (gpio > GPIO_MAX) | ||
161 | return -EINVAL; | ||
162 | |||
163 | local_irq_save(flags); | ||
164 | GPDR |= GPIO_GPIO(gpio); | ||
165 | local_irq_restore(flags); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | EXPORT_SYMBOL(gpio_direction_output); | ||
170 | |||
141 | /* | 171 | /* |
142 | * Default power-off for SA1100 | 172 | * Default power-off for SA1100 |
143 | */ | 173 | */ |