aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-08-28 04:47:55 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-13 11:33:20 -0400
commit6815800601d3e46b976c868e4e85fb6de32b9133 (patch)
treedf047ed69d7b2b1a744625fd6b2b6f49ada47df4 /arch
parent8528ab84ebe7a1eeed9b0acc808df86663d506c0 (diff)
[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>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/irq.c10
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c7
-rw-r--r--arch/powerpc/platforms/82xx/mpc82xx_ads.c6
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c6
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c6
-rw-r--r--arch/powerpc/sysdev/commproc.c6
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c6
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c6
-rw-r--r--arch/powerpc/sysdev/mv64x60_pic.c6
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c6
-rw-r--r--arch/powerpc/sysdev/uic.c6
11 files changed, 9 insertions, 62 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 30fb8e2c5c9d..d5c7e4cf2b39 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -418,6 +418,11 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
418} 418}
419EXPORT_SYMBOL_GPL(virq_to_hw); 419EXPORT_SYMBOL_GPL(virq_to_hw);
420 420
421static 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
421__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node, 426__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
422 unsigned int revmap_type, 427 unsigned int revmap_type,
423 unsigned int revmap_arg, 428 unsigned int revmap_arg,
@@ -449,6 +454,9 @@ __init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
449 host->ops = ops; 454 host->ops = ops;
450 host->of_node = of_node; 455 host->of_node = of_node;
451 456
457 if (host->ops->match == NULL)
458 host->ops->match = default_irq_host_match;
459
452 spin_lock_irqsave(&irq_big_lock, flags); 460 spin_lock_irqsave(&irq_big_lock, flags);
453 461
454 /* If it's a legacy controller, check for duplicates and 462 /* If it's a legacy controller, check for duplicates and
@@ -523,7 +531,7 @@ struct irq_host *irq_find_host(struct device_node *node)
523 */ 531 */
524 spin_lock_irqsave(&irq_big_lock, flags); 532 spin_lock_irqsave(&irq_big_lock, flags);
525 list_for_each_entry(h, &irq_hosts, link) 533 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)) {
527 found = h; 535 found = h;
528 break; 536 break;
529 } 537 }
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 1d793e4b8d56..0f4ca8a2b777 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -241,12 +241,6 @@ static struct irq_chip mpc52xx_sdma_irqchip = {
241 * irq_host 241 * irq_host
242*/ 242*/
243 243
244static 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
250static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct, 244static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
251 u32 * intspec, unsigned int intsize, 245 u32 * intspec, unsigned int intsize,
252 irq_hw_number_t * out_hwirq, 246 irq_hw_number_t * out_hwirq,
@@ -367,7 +361,6 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
367} 361}
368 362
369static struct irq_host_ops mpc52xx_irqhost_ops = { 363static struct irq_host_ops mpc52xx_irqhost_ops = {
370 .match = mpc52xx_irqhost_match,
371 .xlate = mpc52xx_irqhost_xlate, 364 .xlate = mpc52xx_irqhost_xlate,
372 .map = mpc52xx_irqhost_map, 365 .map = mpc52xx_irqhost_map,
373}; 366};
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index 91ddbd2f477d..40087952935a 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -398,11 +398,6 @@ m82xx_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
398 } 398 }
399} 399}
400 400
401static int pci_pic_host_match(struct irq_host *h, struct device_node *node)
402{
403 return h->of_node == node;
404}
405
406static int pci_pic_host_map(struct irq_host *h, unsigned int virq, 401static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
407 irq_hw_number_t hw) 402 irq_hw_number_t hw)
408{ 403{
@@ -418,7 +413,6 @@ static void pci_host_unmap(struct irq_host *h, unsigned int virq)
418} 413}
419 414
420static struct irq_host_ops pci_pic_host_ops = { 415static struct irq_host_ops pci_pic_host_ops = {
421 .match = pci_pic_host_match,
422 .map = pci_pic_host_map, 416 .map = pci_pic_host_map,
423 .unmap = pci_host_unmap, 417 .unmap = pci_host_unmap,
424}; 418};
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index bdd97bb2446d..74407afddf46 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -294,13 +294,7 @@ static int msic_host_map(struct irq_host *h, unsigned int virq,
294 return 0; 294 return 0;
295} 295}
296 296
297static int msic_host_match(struct irq_host *host, struct device_node *dn)
298{
299 return host->of_node == dn;
300}
301
302static struct irq_host_ops msic_host_ops = { 297static struct irq_host_ops msic_host_ops = {
303 .match = msic_host_match,
304 .map = msic_host_map, 298 .map = msic_host_map,
305}; 299};
306 300
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 4309c2cbbeb9..3f4b4aef756d 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -175,11 +175,6 @@ static struct irq_chip spider_pic = {
175 .set_type = spider_set_irq_type, 175 .set_type = spider_set_irq_type,
176}; 176};
177 177
178static int spider_host_match(struct irq_host *h, struct device_node *node)
179{
180 return h->of_node == node;
181}
182
183static int spider_host_map(struct irq_host *h, unsigned int virq, 178static int spider_host_map(struct irq_host *h, unsigned int virq,
184 irq_hw_number_t hw) 179 irq_hw_number_t hw)
185{ 180{
@@ -206,7 +201,6 @@ static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
206} 201}
207 202
208static struct irq_host_ops spider_host_ops = { 203static struct irq_host_ops spider_host_ops = {
209 .match = spider_host_match,
210 .map = spider_host_map, 204 .map = spider_host_map,
211 .xlate = spider_host_xlate, 205 .xlate = spider_host_xlate,
212}; 206};
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 05dc30b80e29..b562afc4e50c 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -94,11 +94,6 @@ int cpm_get_irq(void)
94 return irq_linear_revmap(cpm_pic_host, cpm_vec); 94 return irq_linear_revmap(cpm_pic_host, cpm_vec);
95} 95}
96 96
97static int cpm_pic_host_match(struct irq_host *h, struct device_node *node)
98{
99 return h->of_node == node;
100}
101
102static int cpm_pic_host_map(struct irq_host *h, unsigned int virq, 97static int cpm_pic_host_map(struct irq_host *h, unsigned int virq,
103 irq_hw_number_t hw) 98 irq_hw_number_t hw)
104{ 99{
@@ -126,7 +121,6 @@ static struct irqaction cpm_error_irqaction = {
126}; 121};
127 122
128static struct irq_host_ops cpm_pic_host_ops = { 123static struct irq_host_ops cpm_pic_host_ops = {
129 .match = cpm_pic_host_match,
130 .map = cpm_pic_host_map, 124 .map = cpm_pic_host_map,
131}; 125};
132 126
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index d9ab30c66ebf..d5b36e0ecbda 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -205,11 +205,6 @@ unsigned int cpm2_get_irq(void)
205 return irq_linear_revmap(cpm2_pic_host, irq); 205 return irq_linear_revmap(cpm2_pic_host, irq);
206} 206}
207 207
208static int cpm2_pic_host_match(struct irq_host *h, struct device_node *node)
209{
210 return h->of_node == node;
211}
212
213static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, 208static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
214 irq_hw_number_t hw) 209 irq_hw_number_t hw)
215{ 210{
@@ -233,7 +228,6 @@ static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct,
233} 228}
234 229
235static struct irq_host_ops cpm2_pic_host_ops = { 230static struct irq_host_ops cpm2_pic_host_ops = {
236 .match = cpm2_pic_host_match,
237 .map = cpm2_pic_host_map, 231 .map = cpm2_pic_host_map,
238 .xlate = cpm2_pic_host_xlate, 232 .xlate = cpm2_pic_host_xlate,
239}; 233};
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index f20a4d43d104..565156ae65bc 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -119,11 +119,6 @@ unsigned int mpc8xx_get_irq(void)
119 119
120} 120}
121 121
122static int mpc8xx_pic_host_match(struct irq_host *h, struct device_node *node)
123{
124 return h->of_node == node;
125}
126
127static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq, 122static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq,
128 irq_hw_number_t hw) 123 irq_hw_number_t hw)
129{ 124{
@@ -157,7 +152,6 @@ static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct,
157 152
158 153
159static struct irq_host_ops mpc8xx_pic_host_ops = { 154static struct irq_host_ops mpc8xx_pic_host_ops = {
160 .match = mpc8xx_pic_host_match,
161 .map = mpc8xx_pic_host_map, 155 .map = mpc8xx_pic_host_map,
162 .xlate = mpc8xx_pic_host_xlate, 156 .xlate = mpc8xx_pic_host_xlate,
163}; 157};
diff --git a/arch/powerpc/sysdev/mv64x60_pic.c b/arch/powerpc/sysdev/mv64x60_pic.c
index a145bfd003c7..19e6ef263797 100644
--- a/arch/powerpc/sysdev/mv64x60_pic.c
+++ b/arch/powerpc/sysdev/mv64x60_pic.c
@@ -202,11 +202,6 @@ static struct irq_chip mv64x60_chip_gpp = {
202 * mv64x60_host_ops functions 202 * mv64x60_host_ops functions
203 */ 203 */
204 204
205static int mv64x60_host_match(struct irq_host *h, struct device_node *np)
206{
207 return h->of_node == np;
208}
209
210static struct irq_chip *mv64x60_chips[] = { 205static struct irq_chip *mv64x60_chips[] = {
211 [MV64x60_LEVEL1_LOW] = &mv64x60_chip_low, 206 [MV64x60_LEVEL1_LOW] = &mv64x60_chip_low,
212 [MV64x60_LEVEL1_HIGH] = &mv64x60_chip_high, 207 [MV64x60_LEVEL1_HIGH] = &mv64x60_chip_high,
@@ -228,7 +223,6 @@ static int mv64x60_host_map(struct irq_host *h, unsigned int virq,
228} 223}
229 224
230static struct irq_host_ops mv64x60_host_ops = { 225static struct irq_host_ops mv64x60_host_ops = {
231 .match = mv64x60_host_match,
232 .map = mv64x60_host_map, 226 .map = mv64x60_host_map,
233}; 227};
234 228
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index b41492a8d600..31d3d33d91fc 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -404,13 +404,7 @@ static int pci_irq_host_map(struct irq_host *h, unsigned int virq,
404 return 0; 404 return 0;
405} 405}
406 406
407static int pci_irq_host_match(struct irq_host *h, struct device_node *node)
408{
409 return h->of_node == node;
410}
411
412static struct irq_host_ops pci_irq_host_ops = { 407static struct irq_host_ops pci_irq_host_ops = {
413 .match = pci_irq_host_match,
414 .map = pci_irq_host_map, 408 .map = pci_irq_host_map,
415 .xlate = pci_irq_host_xlate, 409 .xlate = pci_irq_host_xlate,
416}; 410};
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index bf3766754173..5149716c734d 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -215,11 +215,6 @@ out_unlock:
215 spin_unlock(&desc->lock); 215 spin_unlock(&desc->lock);
216} 216}
217 217
218static int uic_host_match(struct irq_host *h, struct device_node *node)
219{
220 return h->of_node == node;
221}
222
223static int uic_host_map(struct irq_host *h, unsigned int virq, 218static int uic_host_map(struct irq_host *h, unsigned int virq,
224 irq_hw_number_t hw) 219 irq_hw_number_t hw)
225{ 220{
@@ -249,7 +244,6 @@ static int uic_host_xlate(struct irq_host *h, struct device_node *ct,
249} 244}
250 245
251static struct irq_host_ops uic_host_ops = { 246static struct irq_host_ops uic_host_ops = {
252 .match = uic_host_match,
253 .map = uic_host_map, 247 .map = uic_host_map,
254 .xlate = uic_host_xlate, 248 .xlate = uic_host_xlate,
255}; 249};