aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/timbgpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/timbgpio.c')
-rw-r--r--drivers/gpio/timbgpio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c
index d4295fa5369e..ddd053108a13 100644
--- a/drivers/gpio/timbgpio.c
+++ b/drivers/gpio/timbgpio.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/timb_gpio.h> 28#include <linux/timb_gpio.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/slab.h>
30 31
31#define DRIVER_NAME "timb-gpio" 32#define DRIVER_NAME "timb-gpio"
32 33
@@ -130,6 +131,7 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
130 unsigned long flags; 131 unsigned long flags;
131 u32 lvr, flr, bflr = 0; 132 u32 lvr, flr, bflr = 0;
132 u32 ver; 133 u32 ver;
134 int ret = 0;
133 135
134 if (offset < 0 || offset > tgpio->gpio.ngpio) 136 if (offset < 0 || offset > tgpio->gpio.ngpio)
135 return -EINVAL; 137 return -EINVAL;
@@ -153,8 +155,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
153 } 155 }
154 156
155 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { 157 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
156 if (ver < 3) 158 if (ver < 3) {
157 return -EINVAL; 159 ret = -EINVAL;
160 goto out;
161 }
158 else { 162 else {
159 flr |= 1 << offset; 163 flr |= 1 << offset;
160 bflr |= 1 << offset; 164 bflr |= 1 << offset;
@@ -174,9 +178,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
174 iowrite32(bflr, tgpio->membase + TGPIO_BFLR); 178 iowrite32(bflr, tgpio->membase + TGPIO_BFLR);
175 179
176 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR); 180 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR);
177 spin_unlock_irqrestore(&tgpio->lock, flags);
178 181
179 return 0; 182out:
183 spin_unlock_irqrestore(&tgpio->lock, flags);
184 return ret;
180} 185}
181 186
182static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) 187static void timbgpio_irq(unsigned int irq, struct irq_desc *desc)