ia64/xen-unstable

changeset 10167:52cec91b7560

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@sous-sol.org>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 24 12:01:25 2006 +0100 (2006-05-24)
parents e336c37b8de0
children ed696467fe64
files linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Wed May 24 11:57:37 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Wed May 24 12:01:25 2006 +0100
     1.3 @@ -54,7 +54,7 @@
     1.4  static DEFINE_SPINLOCK(irq_mapping_update_lock);
     1.5  
     1.6  /* IRQ <-> event-channel mappings. */
     1.7 -static int evtchn_to_irq[NR_EVENT_CHANNELS];
     1.8 +static int evtchn_to_irq[NR_EVENT_CHANNELS] = {[0 ...  NR_EVENT_CHANNELS-1] = -1};
     1.9  
    1.10  /* Packed IRQ information: binding type, sub-type index, and event channel. */
    1.11  static u32 irq_info[NR_IRQS];
    1.12 @@ -91,13 +91,13 @@ static inline unsigned int type_from_irq
    1.13  }
    1.14  
    1.15  /* IRQ <-> VIRQ mapping. */
    1.16 -DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]);
    1.17 +DEFINE_PER_CPU(int, virq_to_irq[NR_VIRQS]) = {[0 ... NR_VIRQS-1] = -1};
    1.18  
    1.19  /* IRQ <-> IPI mapping. */
    1.20  #ifndef NR_IPIS
    1.21  #define NR_IPIS 1
    1.22  #endif
    1.23 -DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
    1.24 +DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]) = {[0 ... NR_IPIS-1] = -1};
    1.25  
    1.26  /* Reference counts for bindings to IRQs. */
    1.27  static int irq_bindcount[NR_IRQS];
    1.28 @@ -751,7 +751,9 @@ void irq_resume(void)
    1.29  		BUG_ON(irq_info[pirq_to_irq(pirq)] != IRQ_UNBOUND);
    1.30  
    1.31  	/* Secondary CPUs must have no VIRQ or IPI bindings. */
    1.32 -	for (cpu = 1; cpu < NR_CPUS; cpu++) {
    1.33 +	for_each_possible_cpu(cpu) {
    1.34 +		if (cpu == 0)
    1.35 +			continue;
    1.36  		for (virq = 0; virq < NR_VIRQS; virq++)
    1.37  			BUG_ON(per_cpu(virq_to_irq, cpu)[virq] != -1);
    1.38  		for (ipi = 0; ipi < NR_IPIS; ipi++)
    1.39 @@ -813,23 +815,12 @@ void irq_resume(void)
    1.40  void __init xen_init_IRQ(void)
    1.41  {
    1.42  	int i;
    1.43 -	int cpu;
    1.44  
    1.45  	init_evtchn_cpu_bindings();
    1.46  
    1.47 -	/* No VIRQ or IPI bindings. */
    1.48 -	for (cpu = 0; cpu < NR_CPUS; cpu++) {
    1.49 -		for (i = 0; i < NR_VIRQS; i++)
    1.50 -			per_cpu(virq_to_irq, cpu)[i] = -1;
    1.51 -		for (i = 0; i < NR_IPIS; i++)
    1.52 -			per_cpu(ipi_to_irq, cpu)[i] = -1;
    1.53 -	}
    1.54 -
    1.55 -	/* No event-channel -> IRQ mappings. */
    1.56 -	for (i = 0; i < NR_EVENT_CHANNELS; i++) {
    1.57 -		evtchn_to_irq[i] = -1;
    1.58 -		mask_evtchn(i); /* No event channels are 'live' right now. */
    1.59 -	}
    1.60 +	/* No event channels are 'live' right now. */
    1.61 +	for (i = 0; i < NR_EVENT_CHANNELS; i++)
    1.62 +		mask_evtchn(i);
    1.63  
    1.64  	/* No IRQ -> event-channel mappings. */
    1.65  	for (i = 0; i < NR_IRQS; i++)