Skip to content

Commit 6815800

Browse files
mpepaulusmack
authored andcommitted
[POWERPC] Provide a default irq_host match, which matches on an exact of_node
The most common match semantic is an exact match based on the device node. So provide a default implementation that does this, and hook it up if no match routine is specified. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 8528ab8 commit 6815800

11 files changed

Lines changed: 9 additions & 62 deletions

File tree

‎arch/powerpc/kernel/irq.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
418418
}
419419
EXPORT_SYMBOL_GPL(virq_to_hw);
420420

421+
static int default_irq_host_match(struct irq_host *h, struct device_node *np)
422+
{
423+
return h->of_node != NULL && h->of_node == np;
424+
}
425+
421426
__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
422427
unsigned int revmap_type,
423428
unsigned int revmap_arg,
@@ -449,6 +454,9 @@ __init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
449454
host->ops = ops;
450455
host->of_node = of_node;
451456

457+
if (host->ops->match == NULL)
458+
host->ops->match = default_irq_host_match;
459+
452460
spin_lock_irqsave(&irq_big_lock, flags);
453461

454462
/* If it's a legacy controller, check for duplicates and
@@ -523,7 +531,7 @@ struct irq_host *irq_find_host(struct device_node *node)
523531
*/
524532
spin_lock_irqsave(&irq_big_lock, flags);
525533
list_for_each_entry(h, &irq_hosts, link)
526-
if (h->ops->match != NULL && h->ops->match(h, node)) {
534+
if (h->ops->match(h, node)) {
527535
found = h;
528536
break;
529537
}

‎arch/powerpc/platforms/52xx/mpc52xx_pic.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,6 @@ static struct irq_chip mpc52xx_sdma_irqchip = {
241241
* irq_host
242242
*/
243243

244-
static int mpc52xx_irqhost_match(struct irq_host *h, struct device_node *node)
245-
{
246-
pr_debug("%s: node=%p\n", __func__, node);
247-
return h->of_node == node;
248-
}
249-
250244
static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
251245
u32 * intspec, unsigned int intsize,
252246
irq_hw_number_t * out_hwirq,
@@ -367,7 +361,6 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
367361
}
368362

369363
static struct irq_host_ops mpc52xx_irqhost_ops = {
370-
.match = mpc52xx_irqhost_match,
371364
.xlate = mpc52xx_irqhost_xlate,
372365
.map = mpc52xx_irqhost_map,
373366
};

‎arch/powerpc/platforms/82xx/mpc82xx_ads.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,6 @@ m82xx_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
398398
}
399399
}
400400

401-
static int pci_pic_host_match(struct irq_host *h, struct device_node *node)
402-
{
403-
return h->of_node == node;
404-
}
405-
406401
static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
407402
irq_hw_number_t hw)
408403
{
@@ -418,7 +413,6 @@ static void pci_host_unmap(struct irq_host *h, unsigned int virq)
418413
}
419414

420415
static struct irq_host_ops pci_pic_host_ops = {
421-
.match = pci_pic_host_match,
422416
.map = pci_pic_host_map,
423417
.unmap = pci_host_unmap,
424418
};

‎arch/powerpc/platforms/cell/axon_msi.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,7 @@ static int msic_host_map(struct irq_host *h, unsigned int virq,
294294
return 0;
295295
}
296296

297-
static int msic_host_match(struct irq_host *host, struct device_node *dn)
298-
{
299-
return host->of_node == dn;
300-
}
301-
302297
static struct irq_host_ops msic_host_ops = {
303-
.match = msic_host_match,
304298
.map = msic_host_map,
305299
};
306300

‎arch/powerpc/platforms/cell/spider-pic.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ static struct irq_chip spider_pic = {
175175
.set_type = spider_set_irq_type,
176176
};
177177

178-
static int spider_host_match(struct irq_host *h, struct device_node *node)
179-
{
180-
return h->of_node == node;
181-
}
182-
183178
static int spider_host_map(struct irq_host *h, unsigned int virq,
184179
irq_hw_number_t hw)
185180
{
@@ -206,7 +201,6 @@ static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
206201
}
207202

208203
static struct irq_host_ops spider_host_ops = {
209-
.match = spider_host_match,
210204
.map = spider_host_map,
211205
.xlate = spider_host_xlate,
212206
};

‎arch/powerpc/sysdev/commproc.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ int cpm_get_irq(void)
9494
return irq_linear_revmap(cpm_pic_host, cpm_vec);
9595
}
9696

97-
static int cpm_pic_host_match(struct irq_host *h, struct device_node *node)
98-
{
99-
return h->of_node == node;
100-
}
101-
10297
static int cpm_pic_host_map(struct irq_host *h, unsigned int virq,
10398
irq_hw_number_t hw)
10499
{
@@ -126,7 +121,6 @@ static struct irqaction cpm_error_irqaction = {
126121
};
127122

128123
static struct irq_host_ops cpm_pic_host_ops = {
129-
.match = cpm_pic_host_match,
130124
.map = cpm_pic_host_map,
131125
};
132126

‎arch/powerpc/sysdev/cpm2_pic.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ unsigned int cpm2_get_irq(void)
205205
return irq_linear_revmap(cpm2_pic_host, irq);
206206
}
207207

208-
static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node)
209-
{
210-
return h->of_node == node;
211-
}
212-
213208
static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
214209
irq_hw_number_t hw)
215210
{
@@ -233,7 +228,6 @@ static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct,
233228
}
234229

235230
static struct irq_host_ops cpm2_pic_host_ops = {
236-
.match = cpm2_pic_host_match,
237231
.map = cpm2_pic_host_map,
238232
.xlate = cpm2_pic_host_xlate,
239233
};

‎arch/powerpc/sysdev/mpc8xx_pic.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ unsigned int mpc8xx_get_irq(void)
119119

120120
}
121121

122-
static int mpc8xx_pic_host_match(struct irq_host *h, struct device_node *node)
123-
{
124-
return h->of_node == node;
125-
}
126-
127122
static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq,
128123
irq_hw_number_t hw)
129124
{
@@ -157,7 +152,6 @@ static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct,
157152

158153

159154
static struct irq_host_ops mpc8xx_pic_host_ops = {
160-
.match = mpc8xx_pic_host_match,
161155
.map = mpc8xx_pic_host_map,
162156
.xlate = mpc8xx_pic_host_xlate,
163157
};

‎arch/powerpc/sysdev/mv64x60_pic.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ static struct irq_chip mv64x60_chip_gpp = {
202202
* mv64x60_host_ops functions
203203
*/
204204

205-
static int mv64x60_host_match(struct irq_host *h, struct device_node *np)
206-
{
207-
return h->of_node == np;
208-
}
209-
210205
static struct irq_chip *mv64x60_chips[] = {
211206
[MV64x60_LEVEL1_LOW] = &mv64x60_chip_low,
212207
[MV64x60_LEVEL1_HIGH] = &mv64x60_chip_high,
@@ -228,7 +223,6 @@ static int mv64x60_host_map(struct irq_host *h, unsigned int virq,
228223
}
229224

230225
static struct irq_host_ops mv64x60_host_ops = {
231-
.match = mv64x60_host_match,
232226
.map = mv64x60_host_map,
233227
};
234228

‎arch/powerpc/sysdev/tsi108_pci.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,7 @@ static int pci_irq_host_map(struct irq_host *h, unsigned int virq,
404404
return 0;
405405
}
406406

407-
static int pci_irq_host_match(struct irq_host *h, struct device_node *node)
408-
{
409-
return h->of_node == node;
410-
}
411-
412407
static struct irq_host_ops pci_irq_host_ops = {
413-
.match = pci_irq_host_match,
414408
.map = pci_irq_host_map,
415409
.xlate = pci_irq_host_xlate,
416410
};

0 commit comments

Comments
 (0)