aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-03-14 13:16:20 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-03-18 04:28:30 -0400
commit57ef04288abd27a717287a652d324f95cb77c3c6 (patch)
tree2cb5e15f0325e6860b008da5997e5f63d4cf6171
parent1d4a2166f9501fd5b564b33414a2aa9c493fdfb8 (diff)
gpio: switch drivers to use new callback
This switches all GPIO and pin control drivers with irqchips that were using .startup() and .shutdown() callbacks to lock GPIO lines for IRQ usage over to using the .request_resources() and .release_resources() callbacks just introduced into the irqchip vtable. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jean-Jacques Hiblot <jjhiblot@traphandler.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-adnp.c15
-rw-r--r--drivers/gpio/gpio-bcm-kona.c14
-rw-r--r--drivers/gpio/gpio-dwapb.c14
-rw-r--r--drivers/gpio/gpio-em.c14
-rw-r--r--drivers/gpio/gpio-intel-mid.c14
-rw-r--r--drivers/gpio/gpio-lynxpoint.c14
-rw-r--r--drivers/gpio/gpio-mcp23s08.c14
-rw-r--r--drivers/gpio/gpio-pl061.c14
-rw-r--r--drivers/pinctrl/pinctrl-adi2.c1
-rw-r--r--drivers/pinctrl/pinctrl-baytrail.c14
-rw-r--r--drivers/pinctrl/pinctrl-msm.c11
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c25
-rw-r--r--drivers/pinctrl/sirf/pinctrl-sirf.c14
13 files changed, 97 insertions, 81 deletions
diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index 6fc6206b38bd..b2239d678d01 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -408,24 +408,23 @@ static void adnp_irq_bus_unlock(struct irq_data *data)
408 mutex_unlock(&adnp->irq_lock); 408 mutex_unlock(&adnp->irq_lock);
409} 409}
410 410
411static unsigned int adnp_irq_startup(struct irq_data *data) 411static int adnp_irq_reqres(struct irq_data *data)
412{ 412{
413 struct adnp *adnp = irq_data_get_irq_chip_data(data); 413 struct adnp *adnp = irq_data_get_irq_chip_data(data);
414 414
415 if (gpio_lock_as_irq(&adnp->gpio, data->hwirq)) 415 if (gpio_lock_as_irq(&adnp->gpio, data->hwirq)) {
416 dev_err(adnp->gpio.dev, 416 dev_err(adnp->gpio.dev,
417 "unable to lock HW IRQ %lu for IRQ\n", 417 "unable to lock HW IRQ %lu for IRQ\n",
418 data->hwirq); 418 data->hwirq);
419 /* Satisfy the .enable semantics by unmasking the line */ 419 return -EINVAL;
420 adnp_irq_unmask(data); 420 }
421 return 0; 421 return 0;
422} 422}
423 423
424static void adnp_irq_shutdown(struct irq_data *data) 424static void adnp_irq_relres(struct irq_data *data)
425{ 425{
426 struct adnp *adnp = irq_data_get_irq_chip_data(data); 426 struct adnp *adnp = irq_data_get_irq_chip_data(data);
427 427
428 adnp_irq_mask(data);
429 gpio_unlock_as_irq(&adnp->gpio, data->hwirq); 428 gpio_unlock_as_irq(&adnp->gpio, data->hwirq);
430} 429}
431 430
@@ -436,8 +435,8 @@ static struct irq_chip adnp_irq_chip = {
436 .irq_set_type = adnp_irq_set_type, 435 .irq_set_type = adnp_irq_set_type,
437 .irq_bus_lock = adnp_irq_bus_lock, 436 .irq_bus_lock = adnp_irq_bus_lock,
438 .irq_bus_sync_unlock = adnp_irq_bus_unlock, 437 .irq_bus_sync_unlock = adnp_irq_bus_unlock,
439 .irq_startup = adnp_irq_startup, 438 .irq_request_resources = adnp_irq_reqres,
440 .irq_shutdown = adnp_irq_shutdown, 439 .irq_release_resources = adnp_irq_relres,
441}; 440};
442 441
443static int adnp_irq_map(struct irq_domain *domain, unsigned int irq, 442static int adnp_irq_map(struct irq_domain *domain, unsigned int irq,
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index 5622cfb8325a..3f6b33ce9bd4 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -466,23 +466,23 @@ static void bcm_kona_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
466 chained_irq_exit(chip, desc); 466 chained_irq_exit(chip, desc);
467} 467}
468 468
469static unsigned int bcm_kona_gpio_irq_startup(struct irq_data *d) 469static int bcm_kona_gpio_irq_reqres(struct irq_data *d)
470{ 470{
471 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); 471 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
472 472
473 if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) 473 if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) {
474 dev_err(kona_gpio->gpio_chip.dev, 474 dev_err(kona_gpio->gpio_chip.dev,
475 "unable to lock HW IRQ %lu for IRQ\n", 475 "unable to lock HW IRQ %lu for IRQ\n",
476 d->hwirq); 476 d->hwirq);
477 bcm_kona_gpio_irq_unmask(d); 477 return -EINVAL;
478 }
478 return 0; 479 return 0;
479} 480}
480 481
481static void bcm_kona_gpio_irq_shutdown(struct irq_data *d) 482static void bcm_kona_gpio_irq_relres(struct irq_data *d)
482{ 483{
483 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); 484 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
484 485
485 bcm_kona_gpio_irq_mask(d);
486 gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq); 486 gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq);
487} 487}
488 488
@@ -492,8 +492,8 @@ static struct irq_chip bcm_gpio_irq_chip = {
492 .irq_mask = bcm_kona_gpio_irq_mask, 492 .irq_mask = bcm_kona_gpio_irq_mask,
493 .irq_unmask = bcm_kona_gpio_irq_unmask, 493 .irq_unmask = bcm_kona_gpio_irq_unmask,
494 .irq_set_type = bcm_kona_gpio_irq_set_type, 494 .irq_set_type = bcm_kona_gpio_irq_set_type,
495 .irq_startup = bcm_kona_gpio_irq_startup, 495 .irq_request_resources = bcm_kona_gpio_irq_reqres,
496 .irq_shutdown = bcm_kona_gpio_irq_shutdown, 496 .irq_release_resources = bcm_kona_gpio_irq_relres,
497}; 497};
498 498
499static struct __initconst of_device_id bcm_kona_gpio_of_match[] = { 499static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 2797fbb535d0..ed5711f77e2d 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -136,26 +136,26 @@ static void dwapb_irq_disable(struct irq_data *d)
136 spin_unlock_irqrestore(&bgc->lock, flags); 136 spin_unlock_irqrestore(&bgc->lock, flags);
137} 137}
138 138
139static unsigned int dwapb_irq_startup(struct irq_data *d) 139static int dwapb_irq_reqres(struct irq_data *d)
140{ 140{
141 struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); 141 struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
142 struct dwapb_gpio *gpio = igc->private; 142 struct dwapb_gpio *gpio = igc->private;
143 struct bgpio_chip *bgc = &gpio->ports[0].bgc; 143 struct bgpio_chip *bgc = &gpio->ports[0].bgc;
144 144
145 if (gpio_lock_as_irq(&bgc->gc, irqd_to_hwirq(d))) 145 if (gpio_lock_as_irq(&bgc->gc, irqd_to_hwirq(d))) {
146 dev_err(gpio->dev, "unable to lock HW IRQ %lu for IRQ\n", 146 dev_err(gpio->dev, "unable to lock HW IRQ %lu for IRQ\n",
147 irqd_to_hwirq(d)); 147 irqd_to_hwirq(d));
148 dwapb_irq_enable(d); 148 return -EINVAL;
149 }
149 return 0; 150 return 0;
150} 151}
151 152
152static void dwapb_irq_shutdown(struct irq_data *d) 153static void dwapb_irq_relres(struct irq_data *d)
153{ 154{
154 struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); 155 struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
155 struct dwapb_gpio *gpio = igc->private; 156 struct dwapb_gpio *gpio = igc->private;
156 struct bgpio_chip *bgc = &gpio->ports[0].bgc; 157 struct bgpio_chip *bgc = &gpio->ports[0].bgc;
157 158
158 dwapb_irq_disable(d);
159 gpio_unlock_as_irq(&bgc->gc, irqd_to_hwirq(d)); 159 gpio_unlock_as_irq(&bgc->gc, irqd_to_hwirq(d));
160} 160}
161 161
@@ -255,8 +255,8 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
255 ct->chip.irq_set_type = dwapb_irq_set_type; 255 ct->chip.irq_set_type = dwapb_irq_set_type;
256 ct->chip.irq_enable = dwapb_irq_enable; 256 ct->chip.irq_enable = dwapb_irq_enable;
257 ct->chip.irq_disable = dwapb_irq_disable; 257 ct->chip.irq_disable = dwapb_irq_disable;
258 ct->chip.irq_startup = dwapb_irq_startup; 258 ct->chip.irq_request_resources = dwapb_irq_reqres;
259 ct->chip.irq_shutdown = dwapb_irq_shutdown; 259 ct->chip.irq_release_resources = dwapb_irq_relres;
260 ct->regs.ack = GPIO_PORTA_EOI; 260 ct->regs.ack = GPIO_PORTA_EOI;
261 ct->regs.mask = GPIO_INTMASK; 261 ct->regs.mask = GPIO_INTMASK;
262 262
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 1e98a9873967..8765bd6f48e1 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -99,23 +99,23 @@ static void em_gio_irq_enable(struct irq_data *d)
99 em_gio_write(p, GIO_IEN, BIT(irqd_to_hwirq(d))); 99 em_gio_write(p, GIO_IEN, BIT(irqd_to_hwirq(d)));
100} 100}
101 101
102static unsigned int em_gio_irq_startup(struct irq_data *d) 102static int em_gio_irq_reqres(struct irq_data *d)
103{ 103{
104 struct em_gio_priv *p = irq_data_get_irq_chip_data(d); 104 struct em_gio_priv *p = irq_data_get_irq_chip_data(d);
105 105
106 if (gpio_lock_as_irq(&p->gpio_chip, irqd_to_hwirq(d))) 106 if (gpio_lock_as_irq(&p->gpio_chip, irqd_to_hwirq(d))) {
107 dev_err(p->gpio_chip.dev, 107 dev_err(p->gpio_chip.dev,
108 "unable to lock HW IRQ %lu for IRQ\n", 108 "unable to lock HW IRQ %lu for IRQ\n",
109 irqd_to_hwirq(d)); 109 irqd_to_hwirq(d));
110 em_gio_irq_enable(d); 110 return -EINVAL;
111 }
111 return 0; 112 return 0;
112} 113}
113 114
114static void em_gio_irq_shutdown(struct irq_data *d) 115static void em_gio_irq_relres(struct irq_data *d)
115{ 116{
116 struct em_gio_priv *p = irq_data_get_irq_chip_data(d); 117 struct em_gio_priv *p = irq_data_get_irq_chip_data(d);
117 118
118 em_gio_irq_disable(d);
119 gpio_unlock_as_irq(&p->gpio_chip, irqd_to_hwirq(d)); 119 gpio_unlock_as_irq(&p->gpio_chip, irqd_to_hwirq(d));
120} 120}
121 121
@@ -359,8 +359,8 @@ static int em_gio_probe(struct platform_device *pdev)
359 irq_chip->irq_mask = em_gio_irq_disable; 359 irq_chip->irq_mask = em_gio_irq_disable;
360 irq_chip->irq_unmask = em_gio_irq_enable; 360 irq_chip->irq_unmask = em_gio_irq_enable;
361 irq_chip->irq_set_type = em_gio_irq_set_type; 361 irq_chip->irq_set_type = em_gio_irq_set_type;
362 irq_chip->irq_startup = em_gio_irq_startup; 362 irq_chip->irq_request_resources = em_gio_irq_reqres;
363 irq_chip->irq_shutdown = em_gio_irq_shutdown; 363 irq_chip->irq_release_resources = em_gio_irq_relres;
364 irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; 364 irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
365 365
366 p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, 366 p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c
index 3a34bb151fd4..118a6bf455d9 100644
--- a/drivers/gpio/gpio-intel-mid.c
+++ b/drivers/gpio/gpio-intel-mid.c
@@ -231,23 +231,23 @@ static void intel_mid_irq_mask(struct irq_data *d)
231{ 231{
232} 232}
233 233
234static unsigned int intel_mid_irq_startup(struct irq_data *d) 234static int intel_mid_irq_reqres(struct irq_data *d)
235{ 235{
236 struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d); 236 struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d);
237 237
238 if (gpio_lock_as_irq(&priv->chip, irqd_to_hwirq(d))) 238 if (gpio_lock_as_irq(&priv->chip, irqd_to_hwirq(d))) {
239 dev_err(priv->chip.dev, 239 dev_err(priv->chip.dev,
240 "unable to lock HW IRQ %lu for IRQ\n", 240 "unable to lock HW IRQ %lu for IRQ\n",
241 irqd_to_hwirq(d)); 241 irqd_to_hwirq(d));
242 intel_mid_irq_unmask(d); 242 return -EINVAL;
243 }
243 return 0; 244 return 0;
244} 245}
245 246
246static void intel_mid_irq_shutdown(struct irq_data *d) 247static void intel_mid_irq_relres(struct irq_data *d)
247{ 248{
248 struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d); 249 struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d);
249 250
250 intel_mid_irq_mask(d);
251 gpio_unlock_as_irq(&priv->chip, irqd_to_hwirq(d)); 251 gpio_unlock_as_irq(&priv->chip, irqd_to_hwirq(d));
252} 252}
253 253
@@ -256,8 +256,8 @@ static struct irq_chip intel_mid_irqchip = {
256 .irq_mask = intel_mid_irq_mask, 256 .irq_mask = intel_mid_irq_mask,
257 .irq_unmask = intel_mid_irq_unmask, 257 .irq_unmask = intel_mid_irq_unmask,
258 .irq_set_type = intel_mid_irq_type, 258 .irq_set_type = intel_mid_irq_type,
259 .irq_startup = intel_mid_irq_startup, 259 .irq_request_resources = intel_mid_irq_reqres,
260 .irq_shutdown = intel_mid_irq_shutdown, 260 .irq_release_resources = intel_mid_irq_relres,
261}; 261};
262 262
263static const struct intel_mid_gpio_ddata gpio_lincroft = { 263static const struct intel_mid_gpio_ddata gpio_lincroft = {
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 66b18535b5ae..41f79cb24a9e 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -301,23 +301,23 @@ static void lp_irq_disable(struct irq_data *d)
301 spin_unlock_irqrestore(&lg->lock, flags); 301 spin_unlock_irqrestore(&lg->lock, flags);
302} 302}
303 303
304static unsigned int lp_irq_startup(struct irq_data *d) 304static int lp_irq_reqres(struct irq_data *d)
305{ 305{
306 struct lp_gpio *lg = irq_data_get_irq_chip_data(d); 306 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
307 307
308 if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d))) 308 if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d))) {
309 dev_err(lg->chip.dev, 309 dev_err(lg->chip.dev,
310 "unable to lock HW IRQ %lu for IRQ\n", 310 "unable to lock HW IRQ %lu for IRQ\n",
311 irqd_to_hwirq(d)); 311 irqd_to_hwirq(d));
312 lp_irq_enable(d); 312 return -EINVAL;
313 }
313 return 0; 314 return 0;
314} 315}
315 316
316static void lp_irq_shutdown(struct irq_data *d) 317static void lp_irq_relres(struct irq_data *d)
317{ 318{
318 struct lp_gpio *lg = irq_data_get_irq_chip_data(d); 319 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
319 320
320 lp_irq_disable(d);
321 gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d)); 321 gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d));
322} 322}
323 323
@@ -328,8 +328,8 @@ static struct irq_chip lp_irqchip = {
328 .irq_enable = lp_irq_enable, 328 .irq_enable = lp_irq_enable,
329 .irq_disable = lp_irq_disable, 329 .irq_disable = lp_irq_disable,
330 .irq_set_type = lp_irq_type, 330 .irq_set_type = lp_irq_type,
331 .irq_startup = lp_irq_startup, 331 .irq_request_resources = lp_irq_reqres,
332 .irq_shutdown = lp_irq_shutdown, 332 .irq_release_resources = lp_irq_relres,
333 .flags = IRQCHIP_SKIP_SET_WAKE, 333 .flags = IRQCHIP_SKIP_SET_WAKE,
334}; 334};
335 335
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index e1734c114916..99a68310e7c0 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -440,24 +440,24 @@ static void mcp23s08_irq_bus_unlock(struct irq_data *data)
440 mutex_unlock(&mcp->irq_lock); 440 mutex_unlock(&mcp->irq_lock);
441} 441}
442 442
443static unsigned int mcp23s08_irq_startup(struct irq_data *data) 443static int mcp23s08_irq_reqres(struct irq_data *data)
444{ 444{
445 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data); 445 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data);
446 446
447 if (gpio_lock_as_irq(&mcp->chip, data->hwirq)) 447 if (gpio_lock_as_irq(&mcp->chip, data->hwirq)) {
448 dev_err(mcp->chip.dev, 448 dev_err(mcp->chip.dev,
449 "unable to lock HW IRQ %lu for IRQ usage\n", 449 "unable to lock HW IRQ %lu for IRQ usage\n",
450 data->hwirq); 450 data->hwirq);
451 return -EINVAL;
452 }
451 453
452 mcp23s08_irq_unmask(data);
453 return 0; 454 return 0;
454} 455}
455 456
456static void mcp23s08_irq_shutdown(struct irq_data *data) 457static void mcp23s08_irq_relres(struct irq_data *data)
457{ 458{
458 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data); 459 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data);
459 460
460 mcp23s08_irq_mask(data);
461 gpio_unlock_as_irq(&mcp->chip, data->hwirq); 461 gpio_unlock_as_irq(&mcp->chip, data->hwirq);
462} 462}
463 463
@@ -468,8 +468,8 @@ static struct irq_chip mcp23s08_irq_chip = {
468 .irq_set_type = mcp23s08_irq_set_type, 468 .irq_set_type = mcp23s08_irq_set_type,
469 .irq_bus_lock = mcp23s08_irq_bus_lock, 469 .irq_bus_lock = mcp23s08_irq_bus_lock,
470 .irq_bus_sync_unlock = mcp23s08_irq_bus_unlock, 470 .irq_bus_sync_unlock = mcp23s08_irq_bus_unlock,
471 .irq_startup = mcp23s08_irq_startup, 471 .irq_request_resources = mcp23s08_irq_reqres,
472 .irq_shutdown = mcp23s08_irq_shutdown, 472 .irq_release_resources = mcp23s08_irq_relres,
473}; 473};
474 474
475static int mcp23s08_irq_setup(struct mcp23s08 *mcp) 475static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 391766e5aeed..d2a0ad5fc752 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -233,23 +233,23 @@ static void pl061_irq_unmask(struct irq_data *d)
233 spin_unlock(&chip->lock); 233 spin_unlock(&chip->lock);
234} 234}
235 235
236static unsigned int pl061_irq_startup(struct irq_data *d) 236static int pl061_irq_reqres(struct irq_data *d)
237{ 237{
238 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); 238 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
239 239
240 if (gpio_lock_as_irq(&chip->gc, irqd_to_hwirq(d))) 240 if (gpio_lock_as_irq(&chip->gc, irqd_to_hwirq(d))) {
241 dev_err(chip->gc.dev, 241 dev_err(chip->gc.dev,
242 "unable to lock HW IRQ %lu for IRQ\n", 242 "unable to lock HW IRQ %lu for IRQ\n",
243 irqd_to_hwirq(d)); 243 irqd_to_hwirq(d));
244 pl061_irq_unmask(d); 244 return -EINVAL;
245 }
245 return 0; 246 return 0;
246} 247}
247 248
248static void pl061_irq_shutdown(struct irq_data *d) 249static void pl061_irq_relres(struct irq_data *d)
249{ 250{
250 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); 251 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
251 252
252 pl061_irq_mask(d);
253 gpio_unlock_as_irq(&chip->gc, irqd_to_hwirq(d)); 253 gpio_unlock_as_irq(&chip->gc, irqd_to_hwirq(d));
254} 254}
255 255
@@ -258,8 +258,8 @@ static struct irq_chip pl061_irqchip = {
258 .irq_mask = pl061_irq_mask, 258 .irq_mask = pl061_irq_mask,
259 .irq_unmask = pl061_irq_unmask, 259 .irq_unmask = pl061_irq_unmask,
260 .irq_set_type = pl061_irq_type, 260 .irq_set_type = pl061_irq_type,
261 .irq_startup = pl061_irq_startup, 261 .irq_request_resources = pl061_irq_reqres,
262 .irq_shutdown = pl061_irq_shutdown, 262 .irq_release_resources = pl061_irq_relres,
263}; 263};
264 264
265static int pl061_irq_map(struct irq_domain *d, unsigned int irq, 265static int pl061_irq_map(struct irq_domain *d, unsigned int irq,
diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index 7a39562c3e42..94138bca1f2e 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -324,6 +324,7 @@ static unsigned int adi_gpio_irq_startup(struct irq_data *d)
324 324
325 if (!port) { 325 if (!port) {
326 pr_err("GPIO IRQ %d :Not exist\n", d->irq); 326 pr_err("GPIO IRQ %d :Not exist\n", d->irq);
327 /* FIXME: negative return code will be ignored */
327 return -ENODEV; 328 return -ENODEV;
328 } 329 }
329 330
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 665b96bc0c3a..9a4abd9cc878 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -371,23 +371,23 @@ static void byt_irq_mask(struct irq_data *d)
371{ 371{
372} 372}
373 373
374static unsigned int byt_irq_startup(struct irq_data *d) 374static int byt_irq_reqres(struct irq_data *d)
375{ 375{
376 struct byt_gpio *vg = irq_data_get_irq_chip_data(d); 376 struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
377 377
378 if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d))) 378 if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d))) {
379 dev_err(vg->chip.dev, 379 dev_err(vg->chip.dev,
380 "unable to lock HW IRQ %lu for IRQ\n", 380 "unable to lock HW IRQ %lu for IRQ\n",
381 irqd_to_hwirq(d)); 381 irqd_to_hwirq(d));
382 byt_irq_unmask(d); 382 return -EINVAL;
383 }
383 return 0; 384 return 0;
384} 385}
385 386
386static void byt_irq_shutdown(struct irq_data *d) 387static void byt_irq_relres(struct irq_data *d)
387{ 388{
388 struct byt_gpio *vg = irq_data_get_irq_chip_data(d); 389 struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
389 390
390 byt_irq_mask(d);
391 gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d)); 391 gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d));
392} 392}
393 393
@@ -396,8 +396,8 @@ static struct irq_chip byt_irqchip = {
396 .irq_mask = byt_irq_mask, 396 .irq_mask = byt_irq_mask,
397 .irq_unmask = byt_irq_unmask, 397 .irq_unmask = byt_irq_unmask,
398 .irq_set_type = byt_irq_type, 398 .irq_set_type = byt_irq_type,
399 .irq_startup = byt_irq_startup, 399 .irq_request_resources = byt_irq_reqres,
400 .irq_shutdown = byt_irq_shutdown, 400 .irq_release_resources = byt_irq_relres,
401}; 401};
402 402
403static void byt_gpio_irq_init_hw(struct byt_gpio *vg) 403static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c
index ef2bf3126da6..81ecd6ba4169 100644
--- a/drivers/pinctrl/pinctrl-msm.c
+++ b/drivers/pinctrl/pinctrl-msm.c
@@ -805,23 +805,22 @@ static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
805 return 0; 805 return 0;
806} 806}
807 807
808static unsigned int msm_gpio_irq_startup(struct irq_data *d) 808static int msm_gpio_irq_reqres(struct irq_data *d)
809{ 809{
810 struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d); 810 struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d);
811 811
812 if (gpio_lock_as_irq(&pctrl->chip, d->hwirq)) { 812 if (gpio_lock_as_irq(&pctrl->chip, d->hwirq)) {
813 dev_err(pctrl->dev, "unable to lock HW IRQ %lu for IRQ\n", 813 dev_err(pctrl->dev, "unable to lock HW IRQ %lu for IRQ\n",
814 d->hwirq); 814 d->hwirq);
815 return -EINVAL;
815 } 816 }
816 msm_gpio_irq_unmask(d);
817 return 0; 817 return 0;
818} 818}
819 819
820static void msm_gpio_irq_shutdown(struct irq_data *d) 820static void msm_gpio_irq_relres(struct irq_data *d)
821{ 821{
822 struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d); 822 struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d);
823 823
824 msm_gpio_irq_mask(d);
825 gpio_unlock_as_irq(&pctrl->chip, d->hwirq); 824 gpio_unlock_as_irq(&pctrl->chip, d->hwirq);
826} 825}
827 826
@@ -832,8 +831,8 @@ static struct irq_chip msm_gpio_irq_chip = {
832 .irq_ack = msm_gpio_irq_ack, 831 .irq_ack = msm_gpio_irq_ack,
833 .irq_set_type = msm_gpio_irq_set_type, 832 .irq_set_type = msm_gpio_irq_set_type,
834 .irq_set_wake = msm_gpio_irq_set_wake, 833 .irq_set_wake = msm_gpio_irq_set_wake,
835 .irq_startup = msm_gpio_irq_startup, 834 .irq_request_resources = msm_gpio_irq_reqres,
836 .irq_shutdown = msm_gpio_irq_shutdown, 835 .irq_release_resources = msm_gpio_irq_relres,
837}; 836};
838 837
839static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 838static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 53a11114927f..2ea3f3738eab 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -848,10 +848,6 @@ static unsigned int nmk_gpio_irq_startup(struct irq_data *d)
848{ 848{
849 struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d); 849 struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d);
850 850
851 if (gpio_lock_as_irq(&nmk_chip->chip, d->hwirq))
852 dev_err(nmk_chip->chip.dev,
853 "unable to lock HW IRQ %lu for IRQ\n",
854 d->hwirq);
855 clk_enable(nmk_chip->clk); 851 clk_enable(nmk_chip->clk);
856 nmk_gpio_irq_unmask(d); 852 nmk_gpio_irq_unmask(d);
857 return 0; 853 return 0;
@@ -863,6 +859,25 @@ static void nmk_gpio_irq_shutdown(struct irq_data *d)
863 859
864 nmk_gpio_irq_mask(d); 860 nmk_gpio_irq_mask(d);
865 clk_disable(nmk_chip->clk); 861 clk_disable(nmk_chip->clk);
862}
863
864static int nmk_gpio_irq_reqres(struct irq_data *d)
865{
866 struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d);
867
868 if (gpio_lock_as_irq(&nmk_chip->chip, d->hwirq)) {
869 dev_err(nmk_chip->chip.dev,
870 "unable to lock HW IRQ %lu for IRQ\n",
871 d->hwirq);
872 return -EINVAL;
873 }
874 return 0;
875}
876
877static void nmk_gpio_irq_relres(struct irq_data *d)
878{
879 struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d);
880
866 gpio_unlock_as_irq(&nmk_chip->chip, d->hwirq); 881 gpio_unlock_as_irq(&nmk_chip->chip, d->hwirq);
867} 882}
868 883
@@ -875,6 +890,8 @@ static struct irq_chip nmk_gpio_irq_chip = {
875 .irq_set_wake = nmk_gpio_irq_set_wake, 890 .irq_set_wake = nmk_gpio_irq_set_wake,
876 .irq_startup = nmk_gpio_irq_startup, 891 .irq_startup = nmk_gpio_irq_startup,
877 .irq_shutdown = nmk_gpio_irq_shutdown, 892 .irq_shutdown = nmk_gpio_irq_shutdown,
893 .irq_request_resources = nmk_gpio_irq_reqres,
894 .irq_release_resources = nmk_gpio_irq_relres,
878 .flags = IRQCHIP_MASK_ON_SUSPEND, 895 .flags = IRQCHIP_MASK_ON_SUSPEND,
879}; 896};
880 897
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index 617a4916b50f..3ce6e258bc80 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -594,23 +594,23 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
594 return 0; 594 return 0;
595} 595}
596 596
597static unsigned int sirfsoc_gpio_irq_startup(struct irq_data *d) 597static int sirfsoc_gpio_irq_reqres(struct irq_data *d)
598{ 598{
599 struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); 599 struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d);
600 600
601 if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE)) 601 if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE)) {
602 dev_err(bank->chip.gc.dev, 602 dev_err(bank->chip.gc.dev,
603 "unable to lock HW IRQ %lu for IRQ\n", 603 "unable to lock HW IRQ %lu for IRQ\n",
604 d->hwirq); 604 d->hwirq);
605 sirfsoc_gpio_irq_unmask(d); 605 return -EINVAL;
606 }
606 return 0; 607 return 0;
607} 608}
608 609
609static void sirfsoc_gpio_irq_shutdown(struct irq_data *d) 610static void sirfsoc_gpio_irq_relres(struct irq_data *d)
610{ 611{
611 struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); 612 struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d);
612 613
613 sirfsoc_gpio_irq_mask(d);
614 gpio_unlock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE); 614 gpio_unlock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE);
615} 615}
616 616
@@ -620,8 +620,8 @@ static struct irq_chip sirfsoc_irq_chip = {
620 .irq_mask = sirfsoc_gpio_irq_mask, 620 .irq_mask = sirfsoc_gpio_irq_mask,
621 .irq_unmask = sirfsoc_gpio_irq_unmask, 621 .irq_unmask = sirfsoc_gpio_irq_unmask,
622 .irq_set_type = sirfsoc_gpio_irq_type, 622 .irq_set_type = sirfsoc_gpio_irq_type,
623 .irq_startup = sirfsoc_gpio_irq_startup, 623 .irq_request_resources = sirfsoc_gpio_irq_reqres,
624 .irq_shutdown = sirfsoc_gpio_irq_shutdown, 624 .irq_release_resources = sirfsoc_gpio_irq_relres,
625}; 625};
626 626
627static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc) 627static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc)