[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Event-channel driver: Use for_each_possible_cpu instead
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 52cec91b75606d6000e09e3c72854adf051ee99b # Parent e336c37b8de02da6a6f561fb54c85d745642f881 Event-channel driver: Use for_each_possible_cpu instead of for_each_cpu , or statically initialize data when possible. Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/core/evtchn.c | 27 ++++++++----------------- 1 files changed, 9 insertions(+), 18 deletions(-) diff -r e336c37b8de0 -r 52cec91b7560 linux-2.6-xen-sparse/drivers/xen/core/evtchn.c --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Wed May 24 11:57:37 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Wed May 24 12:01:25 2006 +0100 @@ -54,7 +54,7 @@ static DEFINE_SPINLOCK(irq_mapping_updat static DEFINE_SPINLOCK(irq_mapping_update_lock); /* IRQ <-> event-channel mappings. */ -static int evtchn_to_irq[NR_EVENT_CHANNELS]; +static int evtchn_to_irq[NR_EVENT_CHANNELS] = {[0 ... NR_EVENT_CHANNELS-1] = -1}; /* Packed IRQ information: binding type, sub-type index, and event channel. */ static u32 irq_info[NR_IRQS]; @@ -91,13 +91,13 @@ static inline unsigned int type_from_irq } /* IRQ <-> VIRQ mapping. */ -DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]); +DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1}; /* IRQ <-> IPI mapping. */ #ifndef NR_IPIS #define NR_IPIS 1 #endif -DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]); +DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]) = {[0 ... NR_IPIS-1] = -1}; /* Reference counts for bindings to IRQs. */ static int irq_bindcount[NR_IRQS]; @@ -751,7 +751,9 @@ void irq_resume(void) BUG_ON(irq_info[pirq_to_irq(pirq)] != IRQ_UNBOUND); /* Secondary CPUs must have no VIRQ or IPI bindings. */ - for (cpu = 1; cpu < NR_CPUS; cpu++) { + for_each_possible_cpu(cpu) { + if (cpu == 0) + continue; for (virq = 0; virq < NR_VIRQS; virq++) BUG_ON(per_cpu(virq_to_irq, cpu)[virq] != -1); for (ipi = 0; ipi < NR_IPIS; ipi++) @@ -813,23 +815,12 @@ void __init xen_init_IRQ(void) void __init xen_init_IRQ(void) { int i; - int cpu; init_evtchn_cpu_bindings(); - /* No VIRQ or IPI bindings. */ - for (cpu = 0; cpu < NR_CPUS; cpu++) { - for (i = 0; i < NR_VIRQS; i++) - per_cpu(virq_to_irq, cpu)[i] = -1; - for (i = 0; i < NR_IPIS; i++) - per_cpu(ipi_to_irq, cpu)[i] = -1; - } - - /* No event-channel -> IRQ mappings. */ - for (i = 0; i < NR_EVENT_CHANNELS; i++) { - evtchn_to_irq[i] = -1; - mask_evtchn(i); /* No event channels are 'live' right now. */ - } + /* No event channels are 'live' right now. */ + for (i = 0; i < NR_EVENT_CHANNELS; i++) + mask_evtchn(i); /* No IRQ -> event-channel mappings. */ for (i = 0; i < NR_IRQS; i++) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |