diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-08-28 04:47:54 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-09-13 11:33:20 -0400 |
commit | 52964f87c64e6c6ea671b5bf3030fb1494090a48 (patch) | |
tree | 2e20d81bc05b60b7108733daf5713ea640ad2477 /arch/powerpc/sysdev/mpc8xx_pic.c | |
parent | 0ae0b54565a8dcc2b98de694b998e765de15b713 (diff) |
[POWERPC] Add an optional device_node pointer to the irq_host
The majority of irq_host implementations (3 out of 4) are associated
with a device_node, and need to stash it somewhere. Rather than having
it somewhere different for each host, add an optional device_node pointer
to the irq_host structure.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpc8xx_pic.c')
-rw-r--r-- | arch/powerpc/sysdev/mpc8xx_pic.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c index 2fc2bcd79b5e..f20a4d43d104 100644 --- a/arch/powerpc/sysdev/mpc8xx_pic.c +++ b/arch/powerpc/sysdev/mpc8xx_pic.c | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | extern int cpm_get_irq(struct pt_regs *regs); | 20 | extern int cpm_get_irq(struct pt_regs *regs); |
21 | 21 | ||
22 | static struct device_node *mpc8xx_pic_node; | ||
23 | static struct irq_host *mpc8xx_pic_host; | 22 | static struct irq_host *mpc8xx_pic_host; |
24 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 23 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) |
25 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 24 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; |
@@ -122,7 +121,7 @@ unsigned int mpc8xx_get_irq(void) | |||
122 | 121 | ||
123 | static int mpc8xx_pic_host_match(struct irq_host *h, struct device_node *node) | 122 | static int mpc8xx_pic_host_match(struct irq_host *h, struct device_node *node) |
124 | { | 123 | { |
125 | return mpc8xx_pic_node == node; | 124 | return h->of_node == node; |
126 | } | 125 | } |
127 | 126 | ||
128 | static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq, | 127 | static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq, |
@@ -176,22 +175,24 @@ int mpc8xx_pic_init(void) | |||
176 | return -ENOMEM; | 175 | return -ENOMEM; |
177 | } | 176 | } |
178 | 177 | ||
179 | mpc8xx_pic_node = of_node_get(np); | ||
180 | |||
181 | ret = of_address_to_resource(np, 0, &res); | 178 | ret = of_address_to_resource(np, 0, &res); |
182 | of_node_put(np); | ||
183 | if (ret) | 179 | if (ret) |
184 | return ret; | 180 | goto out; |
185 | 181 | ||
186 | siu_reg = (void *)ioremap(res.start, res.end - res.start + 1); | 182 | siu_reg = (void *)ioremap(res.start, res.end - res.start + 1); |
187 | if (siu_reg == NULL) | 183 | if (siu_reg == NULL) { |
188 | return -EINVAL; | 184 | ret = -EINVAL; |
185 | goto out; | ||
186 | } | ||
189 | 187 | ||
190 | mpc8xx_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &mpc8xx_pic_host_ops, 64); | 188 | mpc8xx_pic_host = irq_alloc_host(of_node_get(np), IRQ_HOST_MAP_LINEAR, |
189 | 64, &mpc8xx_pic_host_ops, 64); | ||
191 | if (mpc8xx_pic_host == NULL) { | 190 | if (mpc8xx_pic_host == NULL) { |
192 | printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); | 191 | printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); |
193 | ret = -ENOMEM; | 192 | ret = -ENOMEM; |
194 | } | 193 | } |
195 | 194 | ||
195 | out: | ||
196 | of_node_put(np); | ||
196 | return ret; | 197 | return ret; |
197 | } | 198 | } |