Commit 4b92b4f7 authored by Jiang Liu's avatar Jiang Liu Committed by Thomas Gleixner

x86, irq: Simplify arch_early_irq_init()

Simplify function arch_early_irq_init() and kill static array irq_cfgx[].
Signed-off-by: default avatarJiang 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: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1402302011-23642-21-git-send-email-jiang.liu@linux.intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 95d76acc
...@@ -183,6 +183,7 @@ early_param("noapic", parse_noapic); ...@@ -183,6 +183,7 @@ early_param("noapic", parse_noapic);
static int io_apic_setup_irq_pin(unsigned int irq, int node, static int io_apic_setup_irq_pin(unsigned int irq, int node,
struct io_apic_irq_attr *attr); struct io_apic_irq_attr *attr);
static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node);
/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */
void mp_save_irq(struct mpc_intsrc *m) void mp_save_irq(struct mpc_intsrc *m)
...@@ -214,14 +215,10 @@ static struct irq_pin_list *alloc_irq_pin_list(int node) ...@@ -214,14 +215,10 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node); return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node);
} }
/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
int __init arch_early_irq_init(void) int __init arch_early_irq_init(void)
{ {
struct irq_cfg *cfg; struct irq_cfg *cfg;
int count, node, i; int i, node = cpu_to_node(0);
if (!nr_legacy_irqs()) if (!nr_legacy_irqs())
io_apic_irqs = ~0UL; io_apic_irqs = ~0UL;
...@@ -234,22 +231,14 @@ int __init arch_early_irq_init(void) ...@@ -234,22 +231,14 @@ int __init arch_early_irq_init(void)
pr_err("IOAPIC %d: suspend/resume impossible!\n", i); pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
} }
cfg = irq_cfgx; /*
count = ARRAY_SIZE(irq_cfgx); * For legacy IRQ's, start with assigning irq0 to irq15 to
node = cpu_to_node(0); * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
*/
for (i = 0; i < count; i++) { for (i = 0; i < nr_legacy_irqs(); i++) {
irq_set_chip_data(i, &cfg[i]); cfg = alloc_irq_and_cfg_at(i, node);
zalloc_cpumask_var_node(&cfg[i].domain, GFP_KERNEL, node); cfg->vector = IRQ0_VECTOR + i;
zalloc_cpumask_var_node(&cfg[i].old_domain, GFP_KERNEL, node); cpumask_setall(cfg->domain);
/*
* For legacy IRQ's, start with assigning irq0 to irq15 to
* IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
*/
if (i < nr_legacy_irqs()) {
cfg[i].vector = IRQ0_VECTOR + i;
cpumask_setall(cfg[i].domain);
}
} }
return 0; return 0;
...@@ -3377,7 +3366,7 @@ int __init arch_probe_nr_irqs(void) ...@@ -3377,7 +3366,7 @@ int __init arch_probe_nr_irqs(void)
if (nr < nr_irqs) if (nr < nr_irqs)
nr_irqs = nr; nr_irqs = nr;
return nr_legacy_irqs(); return 0;
} }
int io_apic_set_pci_routing(struct device *dev, int irq, int io_apic_set_pci_routing(struct device *dev, int irq,
......
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