Commit 19fc65b5 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

powerpc: Fix irq_alloc_host() reference counting and callers

When I changed irq_alloc_host() to take an of_node
(52964f87: "Add an optional
device_node pointer to the irq_host"), I botched the reference
counting semantics.

Stephen pointed out that it's irq_alloc_host()'s business if
it needs to take an additional reference to the device_node,
the caller shouldn't need to care.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 2272a55f
...@@ -498,7 +498,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node, ...@@ -498,7 +498,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
host->revmap_type = revmap_type; host->revmap_type = revmap_type;
host->inval_irq = inval_irq; host->inval_irq = inval_irq;
host->ops = ops; host->ops = ops;
host->of_node = of_node; host->of_node = of_node_get(of_node);
if (host->ops->match == NULL) if (host->ops->match == NULL)
host->ops->match = default_irq_host_match; host->ops->match = default_irq_host_match;
......
...@@ -365,7 +365,7 @@ static int axon_msi_probe(struct of_device *device, ...@@ -365,7 +365,7 @@ static int axon_msi_probe(struct of_device *device,
goto out_free_fifo; goto out_free_fifo;
} }
msic->irq_host = irq_alloc_host(of_node_get(dn), IRQ_HOST_MAP_NOMAP, msic->irq_host = irq_alloc_host(dn, IRQ_HOST_MAP_NOMAP,
NR_IRQS, &msic_host_ops, 0); NR_IRQS, &msic_host_ops, 0);
if (!msic->irq_host) { if (!msic->irq_host) {
printk(KERN_ERR "axon_msi: couldn't allocate irq_host for %s\n", printk(KERN_ERR "axon_msi: couldn't allocate irq_host for %s\n",
......
...@@ -300,7 +300,7 @@ static void __init spider_init_one(struct device_node *of_node, int chip, ...@@ -300,7 +300,7 @@ static void __init spider_init_one(struct device_node *of_node, int chip,
panic("spider_pic: can't map registers !"); panic("spider_pic: can't map registers !");
/* Allocate a host */ /* Allocate a host */
pic->host = irq_alloc_host(of_node_get(of_node), IRQ_HOST_MAP_LINEAR, pic->host = irq_alloc_host(of_node, IRQ_HOST_MAP_LINEAR,
SPIDER_SRC_COUNT, &spider_host_ops, SPIDER_SRC_COUNT, &spider_host_ops,
SPIDER_IRQ_INVALID); SPIDER_IRQ_INVALID);
if (pic->host == NULL) if (pic->host == NULL)
......
...@@ -159,7 +159,7 @@ unsigned int cpm_pic_init(void) ...@@ -159,7 +159,7 @@ unsigned int cpm_pic_init(void)
out_be32(&cpic_reg->cpic_cimr, 0); out_be32(&cpic_reg->cpic_cimr, 0);
cpm_pic_host = irq_alloc_host(of_node_get(np), IRQ_HOST_MAP_LINEAR, cpm_pic_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR,
64, &cpm_pic_host_ops, 64); 64, &cpm_pic_host_ops, 64);
if (cpm_pic_host == NULL) { if (cpm_pic_host == NULL) {
printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
......
...@@ -266,7 +266,7 @@ void cpm2_pic_init(struct device_node *node) ...@@ -266,7 +266,7 @@ void cpm2_pic_init(struct device_node *node)
out_be32(&cpm2_intctl->ic_scprrl, 0x05309770); out_be32(&cpm2_intctl->ic_scprrl, 0x05309770);
/* create a legacy host */ /* create a legacy host */
cpm2_pic_host = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LINEAR, cpm2_pic_host = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
64, &cpm2_pic_host_ops, 64); 64, &cpm2_pic_host_ops, 64);
if (cpm2_pic_host == NULL) { if (cpm2_pic_host == NULL) {
printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
......
...@@ -276,7 +276,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr) ...@@ -276,7 +276,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
spin_unlock_irqrestore(&i8259_lock, flags); spin_unlock_irqrestore(&i8259_lock, flags);
/* create a legacy host */ /* create a legacy host */
i8259_host = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LEGACY, i8259_host = irq_alloc_host(node, IRQ_HOST_MAP_LEGACY,
0, &i8259_host_ops, 0); 0, &i8259_host_ops, 0);
if (i8259_host == NULL) { if (i8259_host == NULL) {
printk(KERN_ERR "i8259: failed to allocate irq host !\n"); printk(KERN_ERR "i8259: failed to allocate irq host !\n");
......
...@@ -735,13 +735,11 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) ...@@ -735,13 +735,11 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
memset(ipic, 0, sizeof(struct ipic)); memset(ipic, 0, sizeof(struct ipic));
ipic->irqhost = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LINEAR, ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
NR_IPIC_INTS, NR_IPIC_INTS,
&ipic_host_ops, 0); &ipic_host_ops, 0);
if (ipic->irqhost == NULL) { if (ipic->irqhost == NULL)
of_node_put(node);
return NULL; return NULL;
}
ipic->regs = ioremap(res.start, res.end - res.start + 1); ipic->regs = ioremap(res.start, res.end - res.start + 1);
......
...@@ -1016,13 +1016,11 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1016,13 +1016,11 @@ struct mpic * __init mpic_alloc(struct device_node *node,
memset(mpic, 0, sizeof(struct mpic)); memset(mpic, 0, sizeof(struct mpic));
mpic->name = name; mpic->name = name;
mpic->irqhost = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LINEAR, mpic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
isu_size, &mpic_host_ops, isu_size, &mpic_host_ops,
flags & MPIC_LARGE_VECTORS ? 2048 : 256); flags & MPIC_LARGE_VECTORS ? 2048 : 256);
if (mpic->irqhost == NULL) { if (mpic->irqhost == NULL)
of_node_put(node);
return NULL; return NULL;
}
mpic->irqhost->host_data = mpic; mpic->irqhost->host_data = mpic;
mpic->hc_irq = mpic_irq_chip; mpic->hc_irq = mpic_irq_chip;
......
...@@ -339,12 +339,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, ...@@ -339,12 +339,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags,
memset(qe_ic, 0, sizeof(struct qe_ic)); memset(qe_ic, 0, sizeof(struct qe_ic));
qe_ic->irqhost = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LINEAR, qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
NR_QE_IC_INTS, &qe_ic_host_ops, 0); NR_QE_IC_INTS, &qe_ic_host_ops, 0);
if (qe_ic->irqhost == NULL) { if (qe_ic->irqhost == NULL)
of_node_put(node);
return; return;
}
qe_ic->regs = ioremap(res.start, res.end - res.start + 1); qe_ic->regs = ioremap(res.start, res.end - res.start + 1);
......
...@@ -426,11 +426,10 @@ void __init tsi108_pci_int_init(struct device_node *node) ...@@ -426,11 +426,10 @@ void __init tsi108_pci_int_init(struct device_node *node)
{ {
DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); DBG("Tsi108_pci_int_init: initializing PCI interrupts\n");
pci_irq_host = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LEGACY, pci_irq_host = irq_alloc_host(node, IRQ_HOST_MAP_LEGACY,
0, &pci_irq_host_ops, 0); 0, &pci_irq_host_ops, 0);
if (pci_irq_host == NULL) { if (pci_irq_host == NULL) {
printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n"); printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n");
of_node_put(node);
return; return;
} }
......
...@@ -280,12 +280,10 @@ static struct uic * __init uic_init_one(struct device_node *node) ...@@ -280,12 +280,10 @@ static struct uic * __init uic_init_one(struct device_node *node)
} }
uic->dcrbase = *dcrreg; uic->dcrbase = *dcrreg;
uic->irqhost = irq_alloc_host(of_node_get(node), IRQ_HOST_MAP_LINEAR, uic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
NR_UIC_INTS, &uic_host_ops, -1); NR_UIC_INTS, &uic_host_ops, -1);
if (! uic->irqhost) { if (! uic->irqhost)
of_node_put(node);
return NULL; /* FIXME: panic? */ return NULL; /* FIXME: panic? */
}
uic->irqhost->host_data = uic; uic->irqhost->host_data = uic;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment