Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48558
b: refs/heads/master
c: 771ee3b
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Linus Torvalds committed Feb 16, 2007
1 parent 7c06949 commit 6518119
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 950f4427c2ddc921164088a20f01304cf231437c
refs/heads/master: 771ee3b04eaac6184312825eb600b4c598f027a5
10 changes: 10 additions & 0 deletions trunk/include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,21 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)

#endif /* CONFIG_GENERIC_PENDING_IRQ */

extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
extern int irq_can_set_affinity(unsigned int irq);

#else /* CONFIG_SMP */

#define move_native_irq(x)
#define move_masked_irq(x)

static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
{
return -EINVAL;
}

static inline int irq_can_set_affinity(unsigned int irq) { return 0; }

#endif /* CONFIG_SMP */

#ifdef CONFIG_IRQBALANCE
Expand Down
40 changes: 40 additions & 0 deletions trunk/kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,46 @@ void synchronize_irq(unsigned int irq)
}
EXPORT_SYMBOL(synchronize_irq);

/**
* irq_can_set_affinity - Check if the affinity of a given irq can be set
* @irq: Interrupt to check
*
*/
int irq_can_set_affinity(unsigned int irq)
{
struct irq_desc *desc = irq_desc + irq;

if (CHECK_IRQ_PER_CPU(desc->status) || !desc->chip ||
!desc->chip->set_affinity)
return 0;

return 1;
}

/**
* irq_set_affinity - Set the irq affinity of a given irq
* @irq: Interrupt to set affinity
* @cpumask: cpumask
*
*/
int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
{
struct irq_desc *desc = irq_desc + irq;

if (!desc->chip->set_affinity)
return -EINVAL;

set_balance_irq_affinity(irq, cpumask);

#ifdef CONFIG_GENERIC_PENDING_IRQ
set_pending_irq(irq, cpumask);
#else
desc->affinity = cpumask;
desc->chip->set_affinity(irq, cpumask);
#endif
return 0;
}

#endif

/**
Expand Down
22 changes: 1 addition & 21 deletions trunk/kernel/irq/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,6 @@ static struct proc_dir_entry *root_irq_dir;

#ifdef CONFIG_SMP

#ifdef CONFIG_GENERIC_PENDING_IRQ
void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
{
set_balance_irq_affinity(irq, mask_val);

/*
* Save these away for later use. Re-progam when the
* interrupt is pending
*/
set_pending_irq(irq, mask_val);
}
#else
void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
{
set_balance_irq_affinity(irq, mask_val);
irq_desc[irq].affinity = mask_val;
irq_desc[irq].chip->set_affinity(irq, mask_val);
}
#endif

static int irq_affinity_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
Expand Down Expand Up @@ -73,7 +53,7 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
code to set default SMP affinity. */
return select_smp_affinity(irq) ? -EINVAL : full_count;

proc_set_irq_affinity(irq, new_value);
irq_set_affinity(irq, new_value);

return full_count;
}
Expand Down

0 comments on commit 6518119

Please sign in to comment.