diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-11-26 06:33:41 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-02-03 03:11:58 -0500 |
commit | f6f293112e3d747e5d39ff0d12793909c3946035 (patch) | |
tree | 289c1a01a95644f4ed55888c450c16979cde8199 /drivers/gpio/gpio-pl061.c | |
parent | 7808755d4b0ccdaa9e78edfc8cce94f51c5c8da4 (diff) |
gpio: pl061: lock IRQs when starting them
This uses the new API for tagging GPIO lines as in use by
IRQs. This enforces a few semantic checks on how the underlying
GPIO line is used.
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pl061.c')
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index eba66c7efb18..93b51e339a27 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
@@ -231,11 +231,33 @@ static void pl061_irq_unmask(struct irq_data *d) | |||
231 | spin_unlock(&chip->lock); | 231 | spin_unlock(&chip->lock); |
232 | } | 232 | } |
233 | 233 | ||
234 | static unsigned int pl061_irq_startup(struct irq_data *d) | ||
235 | { | ||
236 | struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); | ||
237 | |||
238 | if (gpio_lock_as_irq(&chip->gc, irqd_to_hwirq(d))) | ||
239 | dev_err(chip->gc.dev, | ||
240 | "unable to lock HW IRQ %lu for IRQ\n", | ||
241 | irqd_to_hwirq(d)); | ||
242 | pl061_irq_unmask(d); | ||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | static void pl061_irq_shutdown(struct irq_data *d) | ||
247 | { | ||
248 | struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); | ||
249 | |||
250 | pl061_irq_mask(d); | ||
251 | gpio_unlock_as_irq(&chip->gc, irqd_to_hwirq(d)); | ||
252 | } | ||
253 | |||
234 | static struct irq_chip pl061_irqchip = { | 254 | static struct irq_chip pl061_irqchip = { |
235 | .name = "pl061 gpio", | 255 | .name = "pl061 gpio", |
236 | .irq_mask = pl061_irq_mask, | 256 | .irq_mask = pl061_irq_mask, |
237 | .irq_unmask = pl061_irq_unmask, | 257 | .irq_unmask = pl061_irq_unmask, |
238 | .irq_set_type = pl061_irq_type, | 258 | .irq_set_type = pl061_irq_type, |
259 | .irq_startup = pl061_irq_startup, | ||
260 | .irq_shutdown = pl061_irq_shutdown, | ||
239 | }; | 261 | }; |
240 | 262 | ||
241 | static int pl061_irq_map(struct irq_domain *d, unsigned int irq, | 263 | static int pl061_irq_map(struct irq_domain *d, unsigned int irq, |