Skip to content

Commit f0bbe4d

Browse files
blogicralfbaechle
authored andcommitted
MIPS: Lantiq: Fix eiu interrupt loading code
Using of_irq_count to load the irq index from the devicetree is incorrect. This will cause the kernel to map them regardless, even if they dont actually get used. Change the code to use of_property_count_u32_elems() instead which is the correct API to use in this case. Signed-off-by: John Crispin <john@phrozen.org> Cc: Linux-MIPS <linux-mips@linux-mips.org> Patchwork: https://patchwork.linux-mips.org/patch/13601/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 3ef0665 commit f0bbe4d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

arch/mips/lantiq/irq.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int gic_present;
6666
#endif
6767

6868
static int exin_avail;
69-
static struct resource ltq_eiu_irq[MAX_EIU];
69+
static u32 ltq_eiu_irq[MAX_EIU];
7070
static void __iomem *ltq_icu_membase[MAX_IM];
7171
static void __iomem *ltq_eiu_membase;
7272
static struct irq_domain *ltq_domain;
@@ -75,7 +75,7 @@ static int ltq_perfcount_irq;
7575
int ltq_eiu_get_irq(int exin)
7676
{
7777
if (exin < exin_avail)
78-
return ltq_eiu_irq[exin].start;
78+
return ltq_eiu_irq[exin];
7979
return -1;
8080
}
8181

@@ -126,7 +126,7 @@ static int ltq_eiu_settype(struct irq_data *d, unsigned int type)
126126
int i;
127127

128128
for (i = 0; i < MAX_EIU; i++) {
129-
if (d->hwirq == ltq_eiu_irq[i].start) {
129+
if (d->hwirq == ltq_eiu_irq[i]) {
130130
int val = 0;
131131
int edge = 0;
132132

@@ -174,7 +174,7 @@ static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
174174

175175
ltq_enable_irq(d);
176176
for (i = 0; i < MAX_EIU; i++) {
177-
if (d->hwirq == ltq_eiu_irq[i].start) {
177+
if (d->hwirq == ltq_eiu_irq[i]) {
178178
/* by default we are low level triggered */
179179
ltq_eiu_settype(d, IRQF_TRIGGER_LOW);
180180
/* clear all pending */
@@ -196,7 +196,7 @@ static void ltq_shutdown_eiu_irq(struct irq_data *d)
196196

197197
ltq_disable_irq(d);
198198
for (i = 0; i < MAX_EIU; i++) {
199-
if (d->hwirq == ltq_eiu_irq[i].start) {
199+
if (d->hwirq == ltq_eiu_irq[i]) {
200200
/* disable */
201201
ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),
202202
LTQ_EIU_EXIN_INEN);
@@ -341,7 +341,7 @@ static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
341341
return 0;
342342

343343
for (i = 0; i < exin_avail; i++)
344-
if (hw == ltq_eiu_irq[i].start)
344+
if (hw == ltq_eiu_irq[i])
345345
chip = &ltq_eiu_type;
346346

347347
irq_set_chip_and_handler(hw, chip, handle_level_irq);
@@ -439,14 +439,15 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
439439
eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");
440440
if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {
441441
/* find out how many external irq sources we have */
442-
exin_avail = of_irq_count(eiu_node);
442+
exin_avail = of_property_count_u32_elems(eiu_node,
443+
"lantiq,eiu-irqs");
443444

444445
if (exin_avail > MAX_EIU)
445446
exin_avail = MAX_EIU;
446447

447-
ret = of_irq_to_resource_table(eiu_node,
448+
ret = of_property_read_u32_array(eiu_node, "lantiq,eiu-irqs",
448449
ltq_eiu_irq, exin_avail);
449-
if (ret != exin_avail)
450+
if (ret)
450451
panic("failed to load external irq resources");
451452

452453
if (!request_mem_region(res.start, resource_size(&res),

0 commit comments

Comments
 (0)