Skip to content

Commit

Permalink
sparseirq: Change irq_desc_ptrs to static
Browse files Browse the repository at this point in the history
Add replace_irq_desc() instead of poking at the array directly.

-v2: remove unneeded boundary check in replace_irq_desc

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <1265793639-15071-31-git-send-email-yinghai@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Feb 18, 2010
1 parent 773e3eb commit 99558f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 6 additions & 1 deletion kernel/irq/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int node)
*/
DEFINE_RAW_SPINLOCK(sparse_irq_lock);

struct irq_desc **irq_desc_ptrs __read_mostly;
static struct irq_desc **irq_desc_ptrs __read_mostly;

static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
[0 ... NR_IRQS_LEGACY-1] = {
Expand Down Expand Up @@ -192,6 +192,11 @@ struct irq_desc *irq_to_desc(unsigned int irq)
return NULL;
}

void replace_irq_desc(unsigned int irq, struct irq_desc *desc)
{
irq_desc_ptrs[irq] = desc;
}

struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
{
struct irq_desc *desc;
Expand Down
6 changes: 1 addition & 5 deletions kernel/irq/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ extern void clear_kstat_irqs(struct irq_desc *desc);
extern raw_spinlock_t sparse_irq_lock;

#ifdef CONFIG_SPARSE_IRQ
/* irq_desc_ptrs allocated at boot time */
extern struct irq_desc **irq_desc_ptrs;
#else
/* irq_desc_ptrs is a fixed size array */
extern struct irq_desc *irq_desc_ptrs[NR_IRQS];
void replace_irq_desc(unsigned int irq, struct irq_desc *desc);
#endif

#ifdef CONFIG_PROC_FS
Expand Down
4 changes: 2 additions & 2 deletions kernel/irq/numa_migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
raw_spin_lock_irqsave(&sparse_irq_lock, flags);

/* We have to check it to avoid races with another CPU */
desc = irq_desc_ptrs[irq];
desc = irq_to_desc(irq);

if (desc && old_desc != desc)
goto out_unlock;
Expand All @@ -90,7 +90,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
goto out_unlock;
}

irq_desc_ptrs[irq] = desc;
replace_irq_desc(irq, desc);
raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);

/* free the old one */
Expand Down

0 comments on commit 99558f0

Please sign in to comment.