diff options
author | Graf Yang <graf.yang@analog.com> | 2009-01-07 10:14:38 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2009-01-07 10:14:38 -0500 |
commit | 9570ff4af6920c5992eb91141d71fc94127d864b (patch) | |
tree | 8ab0887035ab00a655eb8f78b39ed0acbb0b3bed /arch/blackfin/mach-common/ints-priority.c | |
parent | 94106e0fb6b863348a566617ca6bf431c37ddc5e (diff) |
Blackfin arch: Allow a gpio pin be requested both as gpio and irq.
[Mike Frysinger <vapier.adi@gmail.com>:
- use KERN_NOTICE when using gpios as both irq and non
rather than KERN_ERR
- embedded newlines in printk() does not fly]
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/mach-common/ints-priority.c')
-rw-r--r-- | arch/blackfin/mach-common/ints-priority.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index a0bfca921712..7c1db775751b 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c | |||
@@ -432,7 +432,7 @@ static void bfin_gpio_irq_shutdown(unsigned int irq) | |||
432 | 432 | ||
433 | bfin_gpio_mask_irq(irq); | 433 | bfin_gpio_mask_irq(irq); |
434 | __clear_bit(gpionr, gpio_enabled); | 434 | __clear_bit(gpionr, gpio_enabled); |
435 | bfin_gpio_free(gpionr); | 435 | bfin_gpio_irq_free(gpionr); |
436 | } | 436 | } |
437 | 437 | ||
438 | static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | 438 | static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) |
@@ -441,11 +441,6 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | |||
441 | char buf[16]; | 441 | char buf[16]; |
442 | u32 gpionr = irq_to_gpio(irq); | 442 | u32 gpionr = irq_to_gpio(irq); |
443 | 443 | ||
444 | snprintf(buf, 16, "gpio-irq%d", irq); | ||
445 | ret = bfin_gpio_request(gpionr, buf); | ||
446 | if (ret) | ||
447 | return ret; | ||
448 | |||
449 | if (type == IRQ_TYPE_PROBE) { | 444 | if (type == IRQ_TYPE_PROBE) { |
450 | /* only probe unenabled GPIO interrupt lines */ | 445 | /* only probe unenabled GPIO interrupt lines */ |
451 | if (__test_bit(gpionr, gpio_enabled)) | 446 | if (__test_bit(gpionr, gpio_enabled)) |
@@ -456,6 +451,11 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | |||
456 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | | 451 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | |
457 | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { | 452 | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { |
458 | 453 | ||
454 | snprintf(buf, 16, "gpio-irq%d", irq); | ||
455 | ret = bfin_gpio_irq_request(gpionr, buf); | ||
456 | if (ret) | ||
457 | return ret; | ||
458 | |||
459 | if (__test_and_set_bit(gpionr, gpio_enabled)) | 459 | if (__test_and_set_bit(gpionr, gpio_enabled)) |
460 | bfin_gpio_irq_prepare(gpionr); | 460 | bfin_gpio_irq_prepare(gpionr); |
461 | 461 | ||
@@ -740,7 +740,7 @@ static void bfin_gpio_irq_shutdown(unsigned int irq) | |||
740 | 740 | ||
741 | bfin_gpio_mask_irq(irq); | 741 | bfin_gpio_mask_irq(irq); |
742 | __clear_bit(gpionr, gpio_enabled); | 742 | __clear_bit(gpionr, gpio_enabled); |
743 | bfin_gpio_free(gpionr); | 743 | bfin_gpio_irq_free(gpionr); |
744 | } | 744 | } |
745 | 745 | ||
746 | static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | 746 | static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) |
@@ -755,11 +755,6 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | |||
755 | if (pint_val == IRQ_NOT_AVAIL) | 755 | if (pint_val == IRQ_NOT_AVAIL) |
756 | return -ENODEV; | 756 | return -ENODEV; |
757 | 757 | ||
758 | snprintf(buf, 16, "gpio-irq%d", irq); | ||
759 | ret = bfin_gpio_request(gpionr, buf); | ||
760 | if (ret) | ||
761 | return ret; | ||
762 | |||
763 | if (type == IRQ_TYPE_PROBE) { | 758 | if (type == IRQ_TYPE_PROBE) { |
764 | /* only probe unenabled GPIO interrupt lines */ | 759 | /* only probe unenabled GPIO interrupt lines */ |
765 | if (__test_bit(gpionr, gpio_enabled)) | 760 | if (__test_bit(gpionr, gpio_enabled)) |
@@ -769,6 +764,12 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) | |||
769 | 764 | ||
770 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | | 765 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | |
771 | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { | 766 | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { |
767 | |||
768 | snprintf(buf, 16, "gpio-irq%d", irq); | ||
769 | ret = bfin_gpio_irq_request(gpionr, buf); | ||
770 | if (ret) | ||
771 | return ret; | ||
772 | |||
772 | if (__test_and_set_bit(gpionr, gpio_enabled)) | 773 | if (__test_and_set_bit(gpionr, gpio_enabled)) |
773 | bfin_gpio_irq_prepare(gpionr); | 774 | bfin_gpio_irq_prepare(gpionr); |
774 | 775 | ||