aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-02 14:18:51 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-07-31 17:28:19 -0400
commit5c05a8d1f0105ada3cb04be5b70686fc6b272619 (patch)
treeba8c16b5c553c4f35a2a483aa7d7f5d5625cc3dd /drivers
parentb9d03d999b46f0897492f3aac3e794312e5282db (diff)
mfd: Support dynamic allocation of IRQ range for wm831x
Use irq_allocate_desc() to get the IRQ range, which turns into a noop on non-sparse systems. Since all existing users are non-sparse there should be no compatibility issues. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/wm831x-irq.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index b23d8d5ee96c..1808deb8083b 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -527,13 +527,22 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
527 0xffff); 527 0xffff);
528 } 528 }
529 529
530 if (!pdata || !pdata->irq_base) { 530 /* Try to dynamically allocate IRQs if no base is specified */
531 dev_err(wm831x->dev, 531 if (!pdata || !pdata->irq_base)
532 "No interrupt base specified, no interrupts\n"); 532 wm831x->irq_base = -1;
533 else
534 wm831x->irq_base = pdata->irq_base;
535
536 wm831x->irq_base = irq_alloc_descs(wm831x->irq_base, 0,
537 WM831X_NUM_IRQS, 0);
538 if (wm831x->irq_base < 0) {
539 dev_warn(wm831x->dev, "Failed to allocate IRQs: %d\n",
540 wm831x->irq_base);
541 wm831x->irq_base = 0;
533 return 0; 542 return 0;
534 } 543 }
535 544
536 if (pdata->irq_cmos) 545 if (pdata && pdata->irq_cmos)
537 i = 0; 546 i = 0;
538 else 547 else
539 i = WM831X_IRQ_OD; 548 i = WM831X_IRQ_OD;
@@ -553,7 +562,6 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
553 } 562 }
554 563
555 wm831x->irq = irq; 564 wm831x->irq = irq;
556 wm831x->irq_base = pdata->irq_base;
557 565
558 /* Register them with genirq */ 566 /* Register them with genirq */
559 for (cur_irq = wm831x->irq_base; 567 for (cur_irq = wm831x->irq_base;