diff options
Diffstat (limited to 'arch/blackfin/kernel/bfin_gpio.c')
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 9f309480024..5d488ef965c 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -180,11 +180,13 @@ static int cmp_label(unsigned short ident, const char *label) | |||
180 | #ifdef BF537_FAMILY | 180 | #ifdef BF537_FAMILY |
181 | static void port_setup(unsigned short gpio, unsigned short usage) | 181 | static void port_setup(unsigned short gpio, unsigned short usage) |
182 | { | 182 | { |
183 | if (usage == GPIO_USAGE) { | 183 | if (!check_gpio(gpio)) { |
184 | *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio); | 184 | if (usage == GPIO_USAGE) { |
185 | } else | 185 | *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio); |
186 | *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); | 186 | } else |
187 | SSYNC(); | 187 | *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); |
188 | SSYNC(); | ||
189 | } | ||
188 | } | 190 | } |
189 | #else | 191 | #else |
190 | # define port_setup(...) do { } while (0) | 192 | # define port_setup(...) do { } while (0) |
@@ -644,11 +646,10 @@ int peripheral_request(unsigned short per, const char *label) | |||
644 | if (!(per & P_DEFINED)) | 646 | if (!(per & P_DEFINED)) |
645 | return -ENODEV; | 647 | return -ENODEV; |
646 | 648 | ||
647 | if (check_gpio(ident) < 0) | ||
648 | return -EINVAL; | ||
649 | |||
650 | local_irq_save(flags); | 649 | local_irq_save(flags); |
651 | 650 | ||
651 | if (!check_gpio(ident)) { | ||
652 | |||
652 | if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { | 653 | if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { |
653 | printk(KERN_ERR | 654 | printk(KERN_ERR |
654 | "%s: Peripheral %d is already reserved as GPIO by %s !\n", | 655 | "%s: Peripheral %d is already reserved as GPIO by %s !\n", |
@@ -658,6 +659,8 @@ int peripheral_request(unsigned short per, const char *label) | |||
658 | return -EBUSY; | 659 | return -EBUSY; |
659 | } | 660 | } |
660 | 661 | ||
662 | } | ||
663 | |||
661 | if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { | 664 | if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { |
662 | 665 | ||
663 | /* | 666 | /* |