diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2012-02-14 16:06:54 -0500 |
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2012-02-16 08:11:22 -0500 |
| commit | a8db8cf0d894df5f1dcfd4bce9894e0dbcc01c96 (patch) | |
| tree | f9f2c53c57eeb04e5df60671951bcf4f2ca4966e | |
| parent | 68700650e71b6bb6636673f4f9c8ec807353d8d6 (diff) | |
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>
35 files changed, 198 insertions, 185 deletions
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c index fefa7977fa9f..291d61c94718 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c | |||
| @@ -190,8 +190,7 @@ mpc5121_ads_cpld_pic_init(void) | |||
| 190 | 190 | ||
| 191 | cpld_pic_node = of_node_get(np); | 191 | cpld_pic_node = of_node_get(np); |
| 192 | 192 | ||
| 193 | cpld_pic_host = | 193 | cpld_pic_host = irq_domain_add_linear(np, 16, &cpld_pic_host_ops, NULL); |
| 194 | irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR, 16, &cpld_pic_host_ops, 16); | ||
| 195 | if (!cpld_pic_host) { | 194 | if (!cpld_pic_host) { |
| 196 | printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n"); | 195 | printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n"); |
| 197 | goto end; | 196 | goto end; |
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c index a746415c4242..5db5cfb6a4ff 100644 --- a/arch/powerpc/platforms/52xx/media5200.c +++ b/arch/powerpc/platforms/52xx/media5200.c | |||
| @@ -173,15 +173,12 @@ static void __init media5200_init_irq(void) | |||
| 173 | 173 | ||
| 174 | spin_lock_init(&media5200_irq.lock); | 174 | spin_lock_init(&media5200_irq.lock); |
| 175 | 175 | ||
| 176 | media5200_irq.irqhost = irq_alloc_host(fpga_np, IRQ_DOMAIN_MAP_LINEAR, | 176 | media5200_irq.irqhost = irq_domain_add_linear(fpga_np, |
| 177 | MEDIA5200_NUM_IRQS, | 177 | MEDIA5200_NUM_IRQS, &media5200_irq_ops, &media5200_irq); |
| 178 | &media5200_irq_ops, -1); | ||
| 179 | if (!media5200_irq.irqhost) | 178 | if (!media5200_irq.irqhost) |
| 180 | goto out; | 179 | goto out; |
| 181 | pr_debug("%s: allocated irqhost\n", __func__); | 180 | pr_debug("%s: allocated irqhost\n", __func__); |
| 182 | 181 | ||
| 183 | media5200_irq.irqhost->host_data = &media5200_irq; | ||
| 184 | |||
| 185 | irq_set_handler_data(cascade_virq, &media5200_irq); | 182 | irq_set_handler_data(cascade_virq, &media5200_irq); |
| 186 | irq_set_chained_handler(cascade_virq, media5200_irq_cascade); | 183 | irq_set_chained_handler(cascade_virq, media5200_irq_cascade); |
| 187 | 184 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index e90af8fd8413..b53275d12727 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c | |||
| @@ -252,14 +252,12 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) | |||
| 252 | if (!cascade_virq) | 252 | if (!cascade_virq) |
| 253 | return; | 253 | return; |
| 254 | 254 | ||
| 255 | gpt->irqhost = irq_alloc_host(node, IRQ_DOMAIN_MAP_LINEAR, 1, | 255 | gpt->irqhost = irq_domain_add_linear(node, 1, &mpc52xx_gpt_irq_ops, gpt); |
| 256 | &mpc52xx_gpt_irq_ops, -1); | ||
| 257 | if (!gpt->irqhost) { | 256 | if (!gpt->irqhost) { |
| 258 | dev_err(gpt->dev, "irq_alloc_host() failed\n"); | 257 | dev_err(gpt->dev, "irq_domain_add_linear() failed\n"); |
| 259 | return; | 258 | return; |
| 260 | } | 259 | } |
| 261 | 260 | ||
| 262 | gpt->irqhost->host_data = gpt; | ||
| 263 | irq_set_handler_data(cascade_virq, gpt); | 261 | irq_set_handler_data(cascade_virq, gpt); |
| 264 | irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade); | 262 | irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade); |
| 265 | 263 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c index 8c997f1a9122..41fa67126c44 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c | |||
| @@ -444,9 +444,9 @@ void __init mpc52xx_init_irq(void) | |||
| 444 | * As last step, add an irq host to translate the real | 444 | * As last step, add an irq host to translate the real |
| 445 | * hw irq information provided by the ofw to linux virq | 445 | * hw irq information provided by the ofw to linux virq |
| 446 | */ | 446 | */ |
| 447 | mpc52xx_irqhost = irq_alloc_host(picnode, IRQ_DOMAIN_MAP_LINEAR, | 447 | mpc52xx_irqhost = irq_domain_add_linear(picnode, |
| 448 | MPC52xx_IRQ_HIGHTESTHWIRQ, | 448 | MPC52xx_IRQ_HIGHTESTHWIRQ, |
| 449 | &mpc52xx_irqhost_ops, -1); | 449 | &mpc52xx_irqhost_ops, NULL); |
| 450 | 450 | ||
| 451 | if (!mpc52xx_irqhost) | 451 | if (!mpc52xx_irqhost) |
| 452 | panic(__FILE__ ": Cannot allocate the IRQ host\n"); | 452 | panic(__FILE__ ": Cannot allocate the IRQ host\n"); |
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c index bdba174e7b3a..4ef9d6918e23 100644 --- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | |||
| @@ -156,17 +156,13 @@ int __init pq2ads_pci_init_irq(void) | |||
| 156 | out_be32(&priv->regs->mask, ~0); | 156 | out_be32(&priv->regs->mask, ~0); |
| 157 | mb(); | 157 | mb(); |
| 158 | 158 | ||
| 159 | host = irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR, NUM_IRQS, | 159 | host = irq_domain_add_linear(np, NUM_IRQS, &pci_pic_host_ops, priv); |
| 160 | &pci_pic_host_ops, NUM_IRQS); | ||
| 161 | if (!host) { | 160 | if (!host) { |
| 162 | ret = -ENOMEM; | 161 | ret = -ENOMEM; |
| 163 | goto out_unmap_regs; | 162 | goto out_unmap_regs; |
| 164 | } | 163 | } |
| 165 | 164 | ||
| 166 | host->host_data = priv; | ||
| 167 | |||
| 168 | priv->host = host; | 165 | priv->host = host; |
| 169 | host->host_data = priv; | ||
| 170 | irq_set_handler_data(irq, priv); | 166 | irq_set_handler_data(irq, priv); |
| 171 | irq_set_chained_handler(irq, pq2ads_pci_irq_demux); | 167 | irq_set_chained_handler(irq, pq2ads_pci_irq_demux); |
| 172 | 168 | ||
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c index e3ef7c9ed7b1..1092c121adf3 100644 --- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c +++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c | |||
| @@ -280,9 +280,8 @@ void socrates_fpga_pic_init(struct device_node *pic) | |||
| 280 | int i; | 280 | int i; |
| 281 | 281 | ||
| 282 | /* Setup an irq_domain structure */ | 282 | /* Setup an irq_domain structure */ |
| 283 | socrates_fpga_pic_irq_host = irq_alloc_host(pic, IRQ_DOMAIN_MAP_LINEAR, | 283 | socrates_fpga_pic_irq_host = irq_domain_add_linear(pic, |
| 284 | SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, | 284 | SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, NULL); |
| 285 | SOCRATES_FPGA_NUM_IRQS); | ||
| 286 | if (socrates_fpga_pic_irq_host == NULL) { | 285 | if (socrates_fpga_pic_irq_host == NULL) { |
| 287 | pr_err("FPGA PIC: Unable to allocate host\n"); | 286 | pr_err("FPGA PIC: Unable to allocate host\n"); |
| 288 | return; | 287 | return; |
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/platforms/86xx/gef_pic.c index 0cf8af230bcf..126a94b530e4 100644 --- a/arch/powerpc/platforms/86xx/gef_pic.c +++ b/ | |||
