direct-io.hg

changeset 12795:1bcb97a1b2da

[LINUX] Clean up and clarify find_unbound_irq().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Dec 08 09:19:37 2006 +0000 (2006-12-08)
parents 3859131c0b8b
children 28e883b3933d
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	Thu Dec 07 17:48:35 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Fri Dec 08 09:19:37 2006 +0000
     1.3 @@ -244,24 +244,22 @@ asmlinkage void evtchn_do_upcall(struct 
     1.4  
     1.5  static int find_unbound_irq(void)
     1.6  {
     1.7 -	int irq;
     1.8 -
     1.9 -	/* Only allocate from dynirq range */
    1.10 -	for (irq = DYNIRQ_BASE; irq < NR_IRQS; irq++)
    1.11 -		if (irq_bindcount[irq] == 0)
    1.12 -			break;
    1.13 +	static int warned;
    1.14 +	int dynirq, irq;
    1.15  
    1.16 -	if (irq == NR_IRQS) {
    1.17 -		static int warned;
    1.18 -		if (!warned) {
    1.19 -			warned = 1;
    1.20 -			printk(KERN_WARNING "No available IRQ to bind to: "
    1.21 -			       "increase NR_IRQS!\n");
    1.22 -		}
    1.23 -		return -ENOSPC;
    1.24 +	for (dynirq = 0; dynirq < NR_DYNIRQS; dynirq++) {
    1.25 +		irq = dynirq_to_irq(dynirq);
    1.26 +		if (irq_bindcount[irq] == 0)
    1.27 +			return irq;
    1.28  	}
    1.29  
    1.30 -	return irq;
    1.31 +	if (!warned) {
    1.32 +		warned = 1;
    1.33 +		printk(KERN_WARNING "No available IRQ to bind to: "
    1.34 +		       "increase NR_DYNIRQS.\n");
    1.35 +	}
    1.36 +
    1.37 +	return -ENOSPC;
    1.38  }
    1.39  
    1.40  static int bind_evtchn_to_irq(unsigned int evtchn)