diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-01-28 14:52:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 18:50:08 -0500 |
commit | 5b912c108c8b1fcecbfe13d6d9a183db97b682d3 (patch) | |
tree | 0267f65fd9237a41207e4359e09d09e60f6cd754 /kernel/irq | |
parent | 1c659d61cfbd8dc3926688c1bbf12d80f4cfb5c2 (diff) |
msi: Kill the msi_desc array.
We need to be able to get from an irq number to a struct msi_desc.
The msi_desc array in msi.c had several short comings the big one was
that it could not be used outside of msi.c. Using irq_data in struct
irq_desc almost worked except on some architectures irq_data needs to
be used for something else.
So this patch adds a msi_desc pointer to irq_desc, adds the appropriate
wrappers and changes all of the msi code to use them.
The dynamic_irq_init/cleanup code was tweaked to ensure the new
field is left in a well defined state.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/irq')
-rw-r--r-- | kernel/irq/chip.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index d27b25855743..475e8a71bcdc 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -39,6 +39,7 @@ void dynamic_irq_init(unsigned int irq) | |||
39 | desc->chip = &no_irq_chip; | 39 | desc->chip = &no_irq_chip; |
40 | desc->handle_irq = handle_bad_irq; | 40 | desc->handle_irq = handle_bad_irq; |
41 | desc->depth = 1; | 41 | desc->depth = 1; |
42 | desc->msi_desc = NULL; | ||
42 | desc->handler_data = NULL; | 43 | desc->handler_data = NULL; |
43 | desc->chip_data = NULL; | 44 | desc->chip_data = NULL; |
44 | desc->action = NULL; | 45 | desc->action = NULL; |
@@ -74,6 +75,9 @@ void dynamic_irq_cleanup(unsigned int irq) | |||
74 | WARN_ON(1); | 75 | WARN_ON(1); |
75 | return; | 76 | return; |
76 | } | 77 | } |
78 | desc->msi_desc = NULL; | ||
79 | desc->handler_data = NULL; | ||
80 | desc->chip_data = NULL; | ||
77 | desc->handle_irq = handle_bad_irq; | 81 | desc->handle_irq = handle_bad_irq; |
78 | desc->chip = &no_irq_chip; | 82 | desc->chip = &no_irq_chip; |
79 | spin_unlock_irqrestore(&desc->lock, flags); | 83 | spin_unlock_irqrestore(&desc->lock, flags); |
@@ -162,6 +166,30 @@ int set_irq_data(unsigned int irq, void *data) | |||
162 | EXPORT_SYMBOL(set_irq_data); | 166 | EXPORT_SYMBOL(set_irq_data); |
163 | 167 | ||
164 | /** | 168 | /** |
169 | * set_irq_data - set irq type data for an irq | ||
170 | * @irq: Interrupt number | ||
171 | * @data: Pointer to interrupt specific data | ||
172 | * | ||
173 | * Set the hardware irq controller data for an irq | ||
174 | */ | ||
175 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) | ||
176 | { | ||
177 | struct irq_desc *desc; | ||
178 | unsigned long flags; | ||
179 | |||
180 | if (irq >= NR_IRQS) { | ||
181 | printk(KERN_ERR | ||
182 | "Trying to install msi data for IRQ%d\n", irq); | ||
183 | return -EINVAL; | ||
184 | } | ||
185 | desc = irq_desc + irq; | ||
186 | spin_lock_irqsave(&desc->lock, flags); | ||
187 | desc->msi_desc = entry; | ||
188 | spin_unlock_irqrestore(&desc->lock, flags); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | /** | ||
165 | * set_irq_chip_data - set irq chip data for an irq | 193 | * set_irq_chip_data - set irq chip data for an irq |
166 | * @irq: Interrupt number | 194 | * @irq: Interrupt number |
167 | * @data: Pointer to chip specific data | 195 | * @data: Pointer to chip specific data |