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>

diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index a0bfca9..7c1db77 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -432,7 +432,7 @@
 
 	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 @@
 	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 @@
 	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 @@
 
 	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 @@
 	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 @@
 
 	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);