diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-10-06 16:14:21 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-10-12 10:53:40 -0400 |
commit | 08c33db6d044d9dc74ddf8d9ee3cb1fa3eca262b (patch) | |
tree | 8fb935dd04e9d65f79aa778de9c29afb21d10814 /arch | |
parent | 6e2fff50a5bd72a3f9e6f3ef6e9137efddb2d580 (diff) |
x86: Implement new allocator functions
Implement new allocator functions which make use of the core changes.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 452f781a042e..065c5dc88b8c 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -199,6 +199,13 @@ out_cfg: | |||
199 | return NULL; | 199 | return NULL; |
200 | } | 200 | } |
201 | 201 | ||
202 | static void free_irq_cfg(struct irq_cfg *cfg) | ||
203 | { | ||
204 | free_cpumask_var(cfg->domain); | ||
205 | free_cpumask_var(cfg->old_domain); | ||
206 | kfree(cfg); | ||
207 | } | ||
208 | |||
202 | int arch_init_chip_data(struct irq_desc *desc, int node) | 209 | int arch_init_chip_data(struct irq_desc *desc, int node) |
203 | { | 210 | { |
204 | struct irq_cfg *cfg; | 211 | struct irq_cfg *cfg; |
@@ -299,13 +306,6 @@ void arch_init_copy_chip_data(struct irq_desc *old_desc, | |||
299 | init_copy_irq_2_pin(old_cfg, cfg, node); | 306 | init_copy_irq_2_pin(old_cfg, cfg, node); |
300 | } | 307 | } |
301 | 308 | ||
302 | static void free_irq_cfg(struct irq_cfg *cfg) | ||
303 | { | ||
304 | free_cpumask_var(cfg->domain); | ||
305 | free_cpumask_var(cfg->old_domain); | ||
306 | kfree(cfg); | ||
307 | } | ||
308 | |||
309 | void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc) | 309 | void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc) |
310 | { | 310 | { |
311 | struct irq_cfg *old_cfg, *cfg; | 311 | struct irq_cfg *old_cfg, *cfg; |
@@ -325,13 +325,53 @@ void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc) | |||
325 | /* end for move_irq_desc */ | 325 | /* end for move_irq_desc */ |
326 | 326 | ||
327 | #else | 327 | #else |
328 | |||
328 | struct irq_cfg *irq_cfg(unsigned int irq) | 329 | struct irq_cfg *irq_cfg(unsigned int irq) |
329 | { | 330 | { |
330 | return irq < nr_irqs ? irq_cfgx + irq : NULL; | 331 | return irq < nr_irqs ? irq_cfgx + irq : NULL; |
331 | } | 332 | } |
332 | 333 | ||
334 | static struct irq_cfg *get_one_free_irq_cfg(unsigned int irq, int node) | ||
335 | { | ||
336 | return irq_cfgx + irq; | ||
337 | } | ||
338 | |||
339 | static inline void free_irq_cfg(struct irq_cfg *cfg) { } | ||
340 | |||
333 | #endif | 341 | #endif |
334 | 342 | ||
343 | static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node) | ||
344 | { | ||
345 | int res = irq_alloc_desc_at(at, node); | ||
346 | struct irq_cfg *cfg; | ||
347 | |||
348 | if (res < 0) { | ||
349 | if (res != -EEXIST) | ||
350 | return NULL; | ||
351 | cfg = get_irq_chip_data(at); | ||
352 | if (cfg) | ||
353 | return cfg; | ||
354 | } | ||
355 | |||
356 | cfg = get_one_free_irq_cfg(node); | ||
357 | if (cfg) | ||
358 | set_irq_chip_data(at, cfg); | ||
359 | else | ||
360 | irq_free_desc(at); | ||
361 | return cfg; | ||
362 | } | ||
363 | |||
364 | static int alloc_irq_from(unsigned int from, int node) | ||
365 | { | ||
366 | return irq_alloc_desc_from(from, node); | ||
367 | } | ||
368 | |||
369 | static void free_irq_at(unsigned int at, struct irq_cfg *cfg) | ||
370 | { | ||
371 | free_irq_cfg(cfg); | ||
372 | irq_free_desc(at); | ||
373 | } | ||
374 | |||
335 | struct io_apic { | 375 | struct io_apic { |
336 | unsigned int index; | 376 | unsigned int index; |
337 | unsigned int unused[3]; | 377 | unsigned int unused[3]; |