Skip to content

Commit a8db8cf

Browse files
committed
irq_domain: Replace irq_alloc_host() with revmap-specific initializers
Each revmap type has different arguments for setting up the revmap. This patch splits up the generator functions so that each revmap type can do its own setup and the user doesn't need to keep track of how each revmap type handles the arguments. This patch also adds a host_data argument to the generators. There are cases where the host_data pointer will be needed before the function returns. ie. the legacy map calls the .map callback for each irq before returning. v2: - Add void *host_data argument to irq_domain_add_*() functions - fixed failure to compile - Moved IRQ_DOMAIN_MAP_* defines into irqdomain.c Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Milton Miller <miltonm@bga.com> Tested-by: Olof Johansson <olof@lixom.net>
1 parent 6870065 commit a8db8cf

35 files changed

Lines changed: 198 additions & 185 deletions

‎arch/powerpc/platforms/512x/mpc5121_ads_cpld.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ mpc5121_ads_cpld_pic_init(void)
190190

191191
cpld_pic_node = of_node_get(np);
192192

193-
cpld_pic_host =
194-
irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR, 16, &cpld_pic_host_ops, 16);
193+
cpld_pic_host = irq_domain_add_linear(np, 16, &cpld_pic_host_ops, NULL);
195194
if (!cpld_pic_host) {
196195
printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n");
197196
goto end;

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,12 @@ static void __init media5200_init_irq(void)
173173

174174
spin_lock_init(&media5200_irq.lock);
175175

176-
media5200_irq.irqhost = irq_alloc_host(fpga_np, IRQ_DOMAIN_MAP_LINEAR,
177-
MEDIA5200_NUM_IRQS,
178-
&media5200_irq_ops, -1);
176+
media5200_irq.irqhost = irq_domain_add_linear(fpga_np,
177+
MEDIA5200_NUM_IRQS, &media5200_irq_ops, &media5200_irq);
179178
if (!media5200_irq.irqhost)
180179
goto out;
181180
pr_debug("%s: allocated irqhost\n", __func__);
182181

183-
media5200_irq.irqhost->host_data = &media5200_irq;
184-
185182
irq_set_handler_data(cascade_virq, &media5200_irq);
186183
irq_set_chained_handler(cascade_virq, media5200_irq_cascade);
187184

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,12 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
252252
if (!cascade_virq)
253253
return;
254254

255-
gpt->irqhost = irq_alloc_host(node, IRQ_DOMAIN_MAP_LINEAR, 1,
256-
&mpc52xx_gpt_irq_ops, -1);
255+
gpt->irqhost = irq_domain_add_linear(node, 1, &mpc52xx_gpt_irq_ops, gpt);
257256
if (!gpt->irqhost) {
258-
dev_err(gpt->dev, "irq_alloc_host() failed\n");
257+
dev_err(gpt->dev, "irq_domain_add_linear() failed\n");
259258
return;
260259
}
261260

262-
gpt->irqhost->host_data = gpt;
263261
irq_set_handler_data(cascade_virq, gpt);
264262
irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade);
265263

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,9 @@ void __init mpc52xx_init_irq(void)
444444
* As last step, add an irq host to translate the real
445445
* hw irq information provided by the ofw to linux virq
446446
*/
447-
mpc52xx_irqhost = irq_alloc_host(picnode, IRQ_DOMAIN_MAP_LINEAR,
447+
mpc52xx_irqhost = irq_domain_add_linear(picnode,
448448
MPC52xx_IRQ_HIGHTESTHWIRQ,
449-
&mpc52xx_irqhost_ops, -1);
449+
&mpc52xx_irqhost_ops, NULL);
450450

451451
if (!mpc52xx_irqhost)
452452
panic(__FILE__ ": Cannot allocate the IRQ host\n");

‎arch/powerpc/platforms/82xx/pq2ads-pci-pic.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,13 @@ int __init pq2ads_pci_init_irq(void)
156156
out_be32(&priv->regs->mask, ~0);
157157
mb();
158158

159-
host = irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR, NUM_IRQS,
160-
&pci_pic_host_ops, NUM_IRQS);
159+
host = irq_domain_add_linear(np, NUM_IRQS, &pci_pic_host_ops, priv);
161160
if (!host) {
162161
ret = -ENOMEM;
163162
goto out_unmap_regs;
164163
}
165164

166-
host->host_data = priv;
167-
168165
priv->host = host;
169-
host->host_data = priv;
170166
irq_set_handler_data(irq, priv);
171167
irq_set_chained_handler(irq, pq2ads_pci_irq_demux);
172168

‎arch/powerpc/platforms/85xx/socrates_fpga_pic.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,8 @@ void socrates_fpga_pic_init(struct device_node *pic)
280280
int i;
281281

282282
/* Setup an irq_domain structure */
283-
socrates_fpga_pic_irq_host = irq_alloc_host(pic, IRQ_DOMAIN_MAP_LINEAR,
284-
SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops,
285-
SOCRATES_FPGA_NUM_IRQS);
283+
socrates_fpga_pic_irq_host = irq_domain_add_linear(pic,
284+
SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, NULL);
286285
if (socrates_fpga_pic_irq_host == NULL) {
287286
pr_err("FPGA PIC: Unable to allocate host\n");
288287
return;

‎arch/powerpc/platforms/86xx/gef_pic.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,8 @@ void __init gef_pic_init(struct device_node *np)
212212
}
213213

214214
/* Setup an irq_domain structure */
215-
gef_pic_irq_host = irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR,
216-
GEF_PIC_NUM_IRQS,
217-
&gef_pic_host_ops, NO_IRQ);
215+
gef_pic_irq_host = irq_domain_add_linear(np, GEF_PIC_NUM_IRQS,
216+
&gef_pic_host_ops, NULL);
218217
if (gef_pic_irq_host == NULL)
219218
return;
220219

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,13 @@ static int axon_msi_probe(struct platform_device *device)
392392
}
393393
memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES);
394394

395-
msic->irq_domain = irq_alloc_host(dn, IRQ_DOMAIN_MAP_NOMAP,
396-
NR_IRQS, &msic_host_ops, 0);
395+
msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic);
397396
if (!msic->irq_domain) {
398397
printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n",
399398
dn->full_name);
400399
goto out_free_fifo;
401400
}
402401

403-
msic->irq_domain->host_data = msic;
404-
405402
irq_set_handler_data(virq, msic);
406403
irq_set_chained_handler(virq, axon_msi_cascade);
407404
pr_devel("axon_msi: irq 0x%x setup for axon_msi\n", virq);

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ void __init beatic_init_IRQ(void)
239239
ppc_md.get_irq = beatic_get_irq;
240240

241241
/* Allocate an irq host */
242-
beatic_host = irq_alloc_host(NULL, IRQ_DOMAIN_MAP_NOMAP, 0,
243-
&beatic_pic_host_ops,
244-
0);
242+
beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL);
245243
BUG_ON(beatic_host == NULL);
246244
irq_set_default_host(beatic_host);
247245
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ static int __init setup_iic(void)
378378
void __init iic_init_IRQ(void)
379379
{
380380
/* Setup an irq host data structure */
381-
iic_host = irq_alloc_host(NULL, IRQ_DOMAIN_MAP_LINEAR, IIC_SOURCE_COUNT,
382-
&iic_host_ops, IIC_IRQ_INVALID);
381+
iic_host = irq_domain_add_linear(NULL, IIC_SOURCE_COUNT, &iic_host_ops,
382+
NULL);
383383
BUG_ON(iic_host == NULL);
384384
irq_set_default_host(iic_host);
385385

0 commit comments

Comments
 (0)