On 09/30/2010 04:15 PM, Thomas Gleixner wrote: ...... > --- > include/linux/irq.h | 25 +++++ > kernel/irq/irqdesc.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 243 insertions(+), 8 deletions(-) > > Index: linux-2.6-tip/include/linux/irq.h > =================================================================== > --- linux-2.6-tip.orig/include/linux/irq.h > +++ linux-2.6-tip/include/linux/irq.h > @@ -276,6 +276,31 @@ static inline struct irq_desc *move_irq_ > > extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); > > +int irq_alloc_descs(unsigned int irq, unsigned int from, unsigned int cnt, int node); > + > +static inline int irq_alloc_desc(int node) > +{ > + return irq_alloc_descs(0, 0, 1, node); > +} > + > +static inline int > +irq_alloc_desc_at(unsigned int at, int node) > +{ > + return irq_alloc_descs(at, 0, 1, node); need to change to return irq_alloc_descs(at, at, 1, node); > +} > + ... > Index: linux-2.6-tip/kernel/irq/irqdesc.c > =================================================================== > --- linux-2.6-tip.orig/kernel/irq/irqdesc.c > +++ linux-2.6-tip/kernel/irq/irqdesc.c ... > +/** > + * irq_alloc_descs - allocate and initialize a range of irq descriptors > + * @irq: Allocate for specific irq number if irq > 0 > + * @from: Start the search from this irq number > + * @cnt: Number of consecutive irqs to allocate. > + * @node: Preferred node on which the irq descriptor should be allocated > + * > + * Returns the first irq number or error code > + */ > +int __ref > +irq_alloc_descs(unsigned int irq, unsigned int from, unsigned int cnt, int node) > +{ > + unsigned long flags; > + int start, ret; > + > + if (!cnt) > + return -EINVAL; > + > + raw_spin_lock_irqsave(&sparse_irq_lock, flags); > + or add if (irq) from = irq; here. > + start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0); > + ret = -EEXIST; > + if (irq && start != irq) > + goto err; > + > + ret = -ENOMEM; > + if (start >= nr_irqs) > + goto err; > + > + bitmap_set(allocated_irqs, start, cnt); > + raw_spin_unlock_irqrestore(&sparse_irq_lock, flags); > + return alloc_descs(start, cnt, node); > + > +err: > + raw_spin_unlock_irqrestore(&sparse_irq_lock, flags); > + return ret; > +} Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html