From 9570ff4af6920c5992eb91141d71fc94127d864b Mon Sep 17 00:00:00 2001 From: Graf Yang Date: Wed, 7 Jan 2009 23:14:38 +0800 Subject: Blackfin arch: Allow a gpio pin be requested both as gpio and irq. [Mike Frysinger : - 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 Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- arch/blackfin/mach-common/ints-priority.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'arch/blackfin/mach-common') diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index a0bfca92171..7c1db775751 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) bfin_gpio_mask_irq(irq); __clear_bit(gpionr, gpio_enabled); - bfin_gpio_free(gpionr); + bfin_gpio_irq_free(gpionr); } 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) char buf[16]; u32 gpionr = irq_to_gpio(irq); - snprintf(buf, 16, "gpio-irq%d", irq); - ret = bfin_gpio_request(gpionr, buf); - if (ret) - return ret; - if (type == IRQ_TYPE_PROBE) { /* only probe unenabled GPIO interrupt lines */ if (__test_bit(gpionr, gpio_enabled)) @@ -456,6 +451,11 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { + snprintf(buf, 16, "gpio-irq%d", irq); + ret = bfin_gpio_irq_request(gpionr, buf); + if (ret) + return ret; + if (__test_and_set_bit(gpionr, gpio_enabled)) bfin_gpio_irq_prepare(gpionr); @@ -740,7 +740,7 @@ static void bfin_gpio_irq_shutdown(unsigned int irq) bfin_gpio_mask_irq(irq); __clear_bit(gpionr, gpio_enabled); - bfin_gpio_free(gpionr); + bfin_gpio_irq_free(gpionr); } 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) if (pint_val == IRQ_NOT_AVAIL) return -ENODEV; - snprintf(buf, 16, "gpio-irq%d", irq); - ret = bfin_gpio_request(gpionr, buf); - if (ret) - return ret; - if (type == IRQ_TYPE_PROBE) { /* only probe unenabled GPIO interrupt lines */ if (__test_bit(gpionr, gpio_enabled)) @@ -769,6 +764,12 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { + + snprintf(buf, 16, "gpio-irq%d", irq); + ret = bfin_gpio_irq_request(gpionr, buf); + if (ret) + return ret; + if (__test_and_set_bit(gpionr, gpio_enabled)) bfin_gpio_irq_prepare(gpionr); -- cgit v1.2.3