Skip to content

Commit

Permalink
Merge branch 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/linux-2.6-tip

* 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sparseirq: move __weak symbols into separate compilation unit
  sparseirq: work around __weak alias bug
  sparseirq: fix hang with !SPARSE_IRQ
  sparseirq: set lock_class for legacy irq when sparse_irq is selected
  sparseirq: work around compiler optimizing away __weak functions
  sparseirq: fix desc->lock init
  sparseirq: do not printk when migrating IRQ descriptors
  sparseirq: remove duplicated arch_early_irq_init()
  irq: simplify for_each_irq_desc() usage
  proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
  irq: for_each_irq_desc() move to irqnr.h
  hrtimer: remove #include <linux/irq.h>
  • Loading branch information
Linus Torvalds committed Dec 31, 2008
2 parents ec270e5 + 43a2563 commit db200df
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 109 deletions.
18 changes: 6 additions & 12 deletions arch/x86/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = {
[15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
};

void __init arch_early_irq_init(void)
int __init arch_early_irq_init(void)
{
struct irq_cfg *cfg;
struct irq_desc *desc;
Expand All @@ -184,6 +184,8 @@ void __init arch_early_irq_init(void)
desc = irq_to_desc(i);
desc->chip_data = &cfg[i];
}

return 0;
}

#ifdef CONFIG_SPARSE_IRQ
Expand Down Expand Up @@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)
return cfg;
}

void arch_init_chip_data(struct irq_desc *desc, int cpu)
int arch_init_chip_data(struct irq_desc *desc, int cpu)
{
struct irq_cfg *cfg;

Expand All @@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)
BUG_ON(1);
}
}

return 0;
}

#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
Expand Down Expand Up @@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)

/* Mark the inuse vectors */
for_each_irq_desc(irq, desc) {
if (!desc)
continue;
cfg = desc->chip_data;
if (!cpu_isset(cpu, cfg->domain))
continue;
Expand Down Expand Up @@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)
for_each_irq_desc(irq, desc) {
struct irq_pin_list *entry;

if (!desc)
continue;
cfg = desc->chip_data;
entry = cfg->irq_2_pin;
if (!entry)
Expand Down Expand Up @@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)
struct irq_desc *desc;

for_each_irq_desc(irq, desc) {
if (!desc)
continue;

if (desc->status & IRQ_MOVE_PENDING) {
unsigned long flags;

Expand Down Expand Up @@ -2670,9 +2667,6 @@ static inline void init_IO_APIC_traps(void)
* 0x80, because int 0x80 is hm, kind of importantish. ;)
*/
for_each_irq_desc(irq, desc) {
if (!desc)
continue;

cfg = desc->chip_data;
if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
/*
Expand Down
3 changes: 0 additions & 3 deletions drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)

/* By default all event channels notify CPU#0. */
for_each_irq_desc(i, desc) {
if (!desc)
continue;

desc->affinity = cpumask_of_cpu(0);
}
#endif
Expand Down
11 changes: 1 addition & 10 deletions fs/proc/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/irqnr.h>
#include <asm/cputime.h>

#ifndef arch_irq_stat_cpu
Expand Down Expand Up @@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v)
steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
for_each_irq_nr(j) {
#ifdef CONFIG_SPARSE_IRQ
if (!irq_to_desc(j))
continue;
#endif
sum += kstat_irqs_cpu(j, i);
}
sum += arch_irq_stat_cpu(i);
Expand Down Expand Up @@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)
/* sum again ? it could be updated? */
for_each_irq_nr(j) {
per_irq_sum = 0;
#ifdef CONFIG_SPARSE_IRQ
if (!irq_to_desc(j)) {
seq_printf(p, " %u", per_irq_sum);
continue;
}
#endif
for_each_possible_cpu(i)
per_irq_sum += kstat_irqs_cpu(j, i);

Expand Down
6 changes: 6 additions & 0 deletions include/linux/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,10 @@ static inline void init_irq_proc(void)

int show_interrupts(struct seq_file *p, void *v);

struct irq_desc;

extern int early_irq_init(void);
extern int arch_early_irq_init(void);
extern int arch_init_chip_data(struct irq_desc *desc, int cpu);

#endif
27 changes: 4 additions & 23 deletions include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,42 +193,23 @@ struct irq_desc {
const char *name;
} ____cacheline_internodealigned_in_smp;

extern void early_irq_init(void);
extern void arch_early_irq_init(void);
extern void arch_init_chip_data(struct irq_desc *desc, int cpu);
extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
struct irq_desc *desc, int cpu);
extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);

#ifndef CONFIG_SPARSE_IRQ
extern struct irq_desc irq_desc[NR_IRQS];

static inline struct irq_desc *irq_to_desc(unsigned int irq)
{
return (irq < NR_IRQS) ? irq_desc + irq : NULL;
}
static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
{
return irq_to_desc(irq);
}

#else

extern struct irq_desc *irq_to_desc(unsigned int irq);
extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
#else /* CONFIG_SPARSE_IRQ */
extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);

# define for_each_irq_desc(irq, desc) \
for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq))
# define for_each_irq_desc_reverse(irq, desc) \
for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq))

#define kstat_irqs_this_cpu(DESC) \
((DESC)->kstat_irqs[smp_processor_id()])
#define kstat_incr_irqs_this_cpu(irqno, DESC) \
((DESC)->kstat_irqs[smp_processor_id()]++)

#endif
#endif /* CONFIG_SPARSE_IRQ */

extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);

static inline struct irq_desc *
irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
Expand Down
23 changes: 13 additions & 10 deletions include/linux/irqnr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@

# define for_each_irq_desc_reverse(irq, desc) \
for (irq = nr_irqs - 1; irq >= 0; irq--)
#else
#else /* CONFIG_GENERIC_HARDIRQS */

extern int nr_irqs;
extern struct irq_desc *irq_to_desc(unsigned int irq);

#ifndef CONFIG_SPARSE_IRQ
# define for_each_irq_desc(irq, desc) \
for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
irq++, desc = irq_to_desc(irq)) \
if (desc)

struct irq_desc;
# define for_each_irq_desc(irq, desc) \
for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
# define for_each_irq_desc_reverse(irq, desc) \
for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \
irq >= 0; irq--, desc--)
#endif
#endif

# define for_each_irq_desc_reverse(irq, desc) \
for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
irq--, desc = irq_to_desc(irq)) \
if (desc)

#endif /* CONFIG_GENERIC_HARDIRQS */

#define for_each_irq_nr(irq) \
for (irq = 0; irq < nr_irqs; irq++)
Expand Down
9 changes: 0 additions & 9 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,6 @@ void __init __weak thread_info_cache_init(void)
{
}

void __init __weak arch_early_irq_init(void)
{
}

void __init __weak early_irq_init(void)
{
arch_early_irq_init();
}

asmlinkage void __init start_kernel(void)
{
char * command_line;
Expand Down
1 change: 0 additions & 1 deletion kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*/

#include <linux/cpu.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/percpu.h>
#include <linux/hrtimer.h>
Expand Down
15 changes: 0 additions & 15 deletions kernel/irq/autoprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)
* flush such a longstanding irq before considering it as spurious.
*/
for_each_irq_desc_reverse(i, desc) {
if (!desc)
continue;

spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
/*
Expand Down Expand Up @@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)
* happened in the previous stage, it may have masked itself)
*/
for_each_irq_desc_reverse(i, desc) {
if (!desc)
continue;

spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
Expand All @@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)
* Now filter out any obviously spurious interrupts
*/
for_each_irq_desc(i, desc) {
if (!desc)
continue;

spin_lock_irq(&desc->lock);
status = desc->status;

Expand Down Expand Up @@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)
int i;

for_each_irq_desc(i, desc) {
if (!desc)
continue;

spin_lock_irq(&desc->lock);
status = desc->status;

Expand Down Expand Up @@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)
unsigned int status;

for_each_irq_desc(i, desc) {
if (!desc)
continue;

spin_lock_irq(&desc->lock);
status = desc->status;

Expand Down
48 changes: 32 additions & 16 deletions kernel/irq/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
int nr_irqs = NR_IRQS;
EXPORT_SYMBOL_GPL(nr_irqs);

void __init __attribute__((weak)) arch_early_irq_init(void)
{
}

#ifdef CONFIG_SPARSE_IRQ
static struct irq_desc irq_desc_init = {
.irq = -1,
Expand Down Expand Up @@ -90,13 +86,11 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
desc->kstat_irqs = (unsigned int *)ptr;
}

void __attribute__((weak)) arch_init_chip_data(struct irq_desc *desc, int cpu)
{
}

static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
{
memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));

spin_lock_init(&desc->lock);
desc->irq = irq;
#ifdef CONFIG_SMP
desc->cpu = cpu;
Expand Down Expand Up @@ -134,7 +128,7 @@ static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_sm
/* FIXME: use bootmem alloc ...*/
static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];

void __init early_irq_init(void)
int __init early_irq_init(void)
{
struct irq_desc *desc;
int legacy_count;
Expand All @@ -146,14 +140,15 @@ void __init early_irq_init(void)
for (i = 0; i < legacy_count; i++) {
desc[i].irq = i;
desc[i].kstat_irqs = kstat_irqs_legacy[i];
lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);

irq_desc_ptrs[i] = desc + i;
}

for (i = legacy_count; i < NR_IRQS; i++)
irq_desc_ptrs[i] = NULL;

arch_early_irq_init();
return arch_early_irq_init();
}

struct irq_desc *irq_to_desc(unsigned int irq)
Expand Down Expand Up @@ -203,7 +198,7 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
return desc;
}

#else
#else /* !CONFIG_SPARSE_IRQ */

struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
[0 ... NR_IRQS-1] = {
Expand All @@ -218,7 +213,31 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
}
};

#endif
int __init early_irq_init(void)
{
struct irq_desc *desc;
int count;
int i;

desc = irq_desc;
count = ARRAY_SIZE(irq_desc);

for (i = 0; i < count; i++)
desc[i].irq = i;

return arch_early_irq_init();
}

struct irq_desc *irq_to_desc(unsigned int irq)
{
return (irq < NR_IRQS) ? irq_desc + irq : NULL;
}

struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
{
return irq_to_desc(irq);
}
#endif /* !CONFIG_SPARSE_IRQ */

/*
* What should we do if we get a hw irq event on an illegal vector?
Expand Down Expand Up @@ -428,9 +447,6 @@ void early_init_irq_lock_class(void)
int i;

for_each_irq_desc(i, desc) {
if (!desc)
continue;

lockdep_set_class(&desc->lock, &irq_desc_lock_class);
}
}
Expand All @@ -439,7 +455,7 @@ void early_init_irq_lock_class(void)
unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
{
struct irq_desc *desc = irq_to_desc(irq);
return desc->kstat_irqs[cpu];
return desc ? desc->kstat_irqs[cpu] : 0;
}
#endif
EXPORT_SYMBOL(kstat_irqs_cpu);
Expand Down
Loading

0 comments on commit db200df

Please sign in to comment.