diff options
author | Yinghai Lu <yinghai@kernel.org> | 2014-10-27 04:11:55 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-12-16 08:08:16 -0500 |
commit | a178b87b20803aa1cf991f39616e51f4939fbcaf (patch) | |
tree | b1e0894540d7adf477cc4875901429ee241e467a | |
parent | 25d0d35ed7d4ded4ba90e6311c80f2eca65d12f0 (diff) |
x86, irq: Convert irq_2_pin list to generic list
Use generic list to replace private list implementation so we can use
the existing helper functions.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Grant Likely <grant.likely@linaro.org>
Link: http://lkml.kernel.org/r/1414397531-28254-5-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Joerg Roedel <joro@8bytes.org>
-rw-r--r-- | arch/x86/include/asm/hw_irq.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 28 |
2 files changed, 12 insertions, 18 deletions
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index b12c45c5d8ec..66e59e646deb 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -138,7 +138,7 @@ struct irq_2_irte { | |||
138 | * Most irqs are mapped 1:1 with pins. | 138 | * Most irqs are mapped 1:1 with pins. |
139 | */ | 139 | */ |
140 | struct irq_cfg { | 140 | struct irq_cfg { |
141 | struct irq_pin_list *irq_2_pin; | 141 | struct list_head irq_2_pin; |
142 | cpumask_var_t domain; | 142 | cpumask_var_t domain; |
143 | cpumask_var_t old_domain; | 143 | cpumask_var_t old_domain; |
144 | u8 vector; | 144 | u8 vector; |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 447186a0eeee..11978401d0cb 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -74,7 +74,7 @@ | |||
74 | for_each_pin((idx), (pin)) | 74 | for_each_pin((idx), (pin)) |
75 | 75 | ||
76 | #define for_each_irq_pin(entry, head) \ | 76 | #define for_each_irq_pin(entry, head) \ |
77 | for (entry = head; entry; entry = entry->next) | 77 | list_for_each_entry(entry, &head, list) |
78 | 78 | ||
79 | /* | 79 | /* |
80 | * Is the SiS APIC rmw bug present ? | 80 | * Is the SiS APIC rmw bug present ? |
@@ -229,8 +229,8 @@ void mp_save_irq(struct mpc_intsrc *m) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | struct irq_pin_list { | 231 | struct irq_pin_list { |
232 | struct list_head list; | ||
232 | int apic, pin; | 233 | int apic, pin; |
233 | struct irq_pin_list *next; | ||
234 | }; | 234 | }; |
235 | 235 | ||
236 | static struct irq_pin_list *alloc_irq_pin_list(int node) | 236 | static struct irq_pin_list *alloc_irq_pin_list(int node) |
@@ -297,6 +297,7 @@ static struct irq_cfg *alloc_irq_cfg(unsigned int irq, int node) | |||
297 | goto out_cfg; | 297 | goto out_cfg; |
298 | if (!zalloc_cpumask_var_node(&cfg->old_domain, GFP_KERNEL, node)) | 298 | if (!zalloc_cpumask_var_node(&cfg->old_domain, GFP_KERNEL, node)) |
299 | goto out_domain; | 299 | goto out_domain; |
300 | INIT_LIST_HEAD(&cfg->irq_2_pin); | ||
300 | return cfg; | 301 | return cfg; |
301 | out_domain: | 302 | out_domain: |
302 | free_cpumask_var(cfg->domain); | 303 | free_cpumask_var(cfg->domain); |
@@ -460,15 +461,12 @@ static void ioapic_mask_entry(int apic, int pin) | |||
460 | */ | 461 | */ |
461 | static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) | 462 | static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) |
462 | { | 463 | { |
463 | struct irq_pin_list **last, *entry; | 464 | struct irq_pin_list *entry; |
464 | 465 | ||
465 | /* don't allow duplicates */ | 466 | /* don't allow duplicates */ |
466 | last = &cfg->irq_2_pin; | 467 | for_each_irq_pin(entry, cfg->irq_2_pin) |
467 | for_each_irq_pin(entry, cfg->irq_2_pin) { | ||
468 | if (entry->apic == apic && entry->pin == pin) | 468 | if (entry->apic == apic && entry->pin == pin) |
469 | return 0; | 469 | return 0; |
470 | last = &entry->next; | ||
471 | } | ||
472 | 470 | ||
473 | entry = alloc_irq_pin_list(node); | 471 | entry = alloc_irq_pin_list(node); |
474 | if (!entry) { | 472 | if (!entry) { |
@@ -479,22 +477,19 @@ static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pi | |||
479 | entry->apic = apic; | 477 | entry->apic = apic; |
480 | entry->pin = pin; | 478 | entry->pin = pin; |
481 | 479 | ||
482 | *last = entry; | 480 | list_add_tail(&entry->list, &cfg->irq_2_pin); |
483 | return 0; | 481 | return 0; |
484 | } | 482 | } |
485 | 483 | ||
486 | static void __remove_pin_from_irq(struct irq_cfg *cfg, int apic, int pin) | 484 | static void __remove_pin_from_irq(struct irq_cfg *cfg, int apic, int pin) |
487 | { | 485 | { |
488 | struct irq_pin_list **last, *entry; | 486 | struct irq_pin_list *tmp, *entry; |
489 | 487 | ||
490 | last = &cfg->irq_2_pin; | 488 | list_for_each_entry_safe(entry, tmp, &cfg->irq_2_pin, list) |
491 | for_each_irq_pin(entry, cfg->irq_2_pin) | ||
492 | if (entry->apic == apic && entry->pin == pin) { | 489 | if (entry->apic == apic && entry->pin == pin) { |
493 | *last = entry->next; | 490 | list_del(&entry->list); |
494 | kfree(entry); | 491 | kfree(entry); |
495 | return; | 492 | return; |
496 | } else { | ||
497 | last = &entry->next; | ||
498 | } | 493 | } |
499 | } | 494 | } |
500 | 495 | ||
@@ -1739,8 +1734,7 @@ __apicdebuginit(void) print_IO_APICs(void) | |||
1739 | cfg = irq_cfg(irq); | 1734 | cfg = irq_cfg(irq); |
1740 | if (!cfg) | 1735 | if (!cfg) |
1741 | continue; | 1736 | continue; |
1742 | entry = cfg->irq_2_pin; | 1737 | if (list_empty(&cfg->irq_2_pin)) |
1743 | if (!entry) | ||
1744 | continue; | 1738 | continue; |
1745 | printk(KERN_DEBUG "IRQ%d ", irq); | 1739 | printk(KERN_DEBUG "IRQ%d ", irq); |
1746 | for_each_irq_pin(entry, cfg->irq_2_pin) | 1740 | for_each_irq_pin(entry, cfg->irq_2_pin) |
@@ -4076,7 +4070,7 @@ void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq) | |||
4076 | 4070 | ||
4077 | ioapic_mask_entry(ioapic, pin); | 4071 | ioapic_mask_entry(ioapic, pin); |
4078 | __remove_pin_from_irq(cfg, ioapic, pin); | 4072 | __remove_pin_from_irq(cfg, ioapic, pin); |
4079 | WARN_ON(cfg->irq_2_pin != NULL); | 4073 | WARN_ON(!list_empty(&cfg->irq_2_pin)); |
4080 | arch_teardown_hwirq(virq); | 4074 | arch_teardown_hwirq(virq); |
4081 | } | 4075 | } |
4082 | 4076 | ||