Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212170
b: refs/heads/master
c: 06f6c33
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner committed Oct 12, 2010
1 parent 4471457 commit 4cc1d29
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a98d24b71b6e229965f18dc00d28dc71cb8fe324
refs/heads/master: 06f6c3399e9f9ff6eafc200e80f9226c3cee0eaf
1 change: 1 addition & 0 deletions trunk/include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ static inline struct irq_2_iommu *irq_data_get_iommu(struct irq_data *d)

int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);
void irq_free_descs(unsigned int irq, unsigned int cnt);
int irq_reserve_irqs(unsigned int from, unsigned int cnt);

static inline int irq_alloc_desc(int node)
{
Expand Down
26 changes: 26 additions & 0 deletions trunk/kernel/irq/irqdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,32 @@ irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node)
return ret;
}

/**
* irq_reserve_irqs - mark irqs allocated
* @from: mark from irq number
* @cnt: number of irqs to mark
*
* Returns 0 on success or an appropriate error code
*/
int irq_reserve_irqs(unsigned int from, unsigned int cnt)
{
unsigned long flags;
unsigned int start;
int ret = 0;

if (!cnt || (from + cnt) > nr_irqs)
return -EINVAL;

raw_spin_lock_irqsave(&sparse_irq_lock, flags);
start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0);
if (start == from)
bitmap_set(allocated_irqs, start, cnt);
else
ret = -EEXIST;
raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
return ret;
}

/**
* irq_get_next_irq - get next allocated irq number
* @offset: where to start the search
Expand Down

0 comments on commit 4cc1d29

Please sign in to comment.