Commit 20adee8fa06ef69012bc277739e9e3762c78b7b7

Authored by Arnd Bergmann
1 parent 863a08dc8b

irqchip: exynos: look up irq using irq_find_mapping

Since we want to move to using the linear IRQ domain in the
future, we cannot rely on the irq numbers to be contiguous
and need to look up the irq from the hwirq using the domain.

This also turns the bogus comparison with NR_IRQ into a
more meaningful check to see if the number has a valid mapping.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Showing 1 changed file with 6 additions and 7 deletions Side-by-side Diff

drivers/irqchip/exynos-combiner.c
... ... @@ -33,7 +33,7 @@
33 33 static DEFINE_SPINLOCK(irq_controller_lock);
34 34  
35 35 struct combiner_chip_data {
36   - unsigned int irq_offset;
  36 + unsigned int hwirq_offset;
37 37 unsigned int irq_mask;
38 38 void __iomem *base;
39 39 unsigned int parent_irq;
40 40  
... ... @@ -80,11 +80,11 @@
80 80 if (status == 0)
81 81 goto out;
82 82  
83   - combiner_irq = __ffs(status);
  83 + combiner_irq = chip_data->hwirq_offset + __ffs(status);
  84 + cascade_irq = irq_find_mapping(combiner_irq_domain, combiner_irq);
84 85  
85   - cascade_irq = combiner_irq + (chip_data->irq_offset & ~31);
86   - if (unlikely(cascade_irq >= NR_IRQS))
87   - do_bad_IRQ(cascade_irq, desc);
  86 + if (unlikely(!cascade_irq))
  87 + do_bad_IRQ(irq, desc);
88 88 else
89 89 generic_handle_irq(cascade_irq);
90 90  
... ... @@ -129,8 +129,7 @@
129 129 void __iomem *base, unsigned int irq)
130 130 {
131 131 combiner_data->base = base;
132   - combiner_data->irq_offset = irq_find_mapping(
133   - combiner_irq_domain, combiner_nr * IRQ_IN_COMBINER);
  132 + combiner_data->hwirq_offset = (combiner_nr & ~3) * IRQ_IN_COMBINER;
134 133 combiner_data->irq_mask = 0xff << ((combiner_nr % 4) << 3);
135 134 combiner_data->parent_irq = irq;
136 135