[PATCH] genirq: rename desc->handler to desc->chip

This patch-queue improves the generic IRQ layer to be truly generic, by adding
various abstractions and features to it, without impacting existing
functionality.

While the queue can be best described as "fix and improve everything in the
generic IRQ layer that we could think of", and thus it consists of many
smaller features and lots of cleanups, the one feature that stands out most is
the new 'irq chip' abstraction.

The irq-chip abstraction is about describing and coding and IRQ controller
driver by mapping its raw hardware capabilities [and quirks, if needed] in a
straightforward way, without having to think about "IRQ flow"
(level/edge/etc.) type of details.

This stands in contrast with the current 'irq-type' model of genirq
architectures, which 'mixes' raw hardware capabilities with 'flow' details.
The patchset supports both types of irq controller designs at once, and
converts i386 and x86_64 to the new irq-chip design.

As a bonus side-effect of the irq-chip approach, chained interrupt controllers
(master/slave PIC constructs, etc.) are now supported by design as well.

The end result of this patchset intends to be simpler architecture-level code
and more consolidation between architectures.

We reused many bits of code and many concepts from Russell King's ARM IRQ
layer, the merging of which was one of the motivations for this patchset.

This patch:

rename desc->handler to desc->chip.

Originally i did not want to do this, because it's a big patch.  But having
both "desc->handler", "desc->handle_irq" and "action->handler" caused a
large degree of confusion and made the code appear alot less clean than it
truly is.

I have also attempted a dual approach as well by introducing a
desc->chip alias - but that just wasnt robust enough and broke
frequently.

So lets get over with this quickly.  The conversion was done automatically
via scripts and converts all the code in the kernel.

This renaming patch is the first one amongst the patches, so that the
remaining patches can stay flexible and can be merged and split up
without having some big monolithic patch act as a merge barrier.

[akpm@osdl.org: build fix]
[akpm@osdl.org: another build fix]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Ingo Molnar
2006-06-29 02:24:36 -07:00
committed by Linus Torvalds
parent cfb9e32f2f
commit d1bef4ed5f
151 changed files with 384 additions and 380 deletions

View File

@ -41,7 +41,7 @@ unsigned long probe_irq_on(void)
spin_lock_irq(&desc->lock);
if (!irq_desc[i].action)
irq_desc[i].handler->startup(i);
irq_desc[i].chip->startup(i);
spin_unlock_irq(&desc->lock);
}
@ -59,7 +59,7 @@ unsigned long probe_irq_on(void)
spin_lock_irq(&desc->lock);
if (!desc->action) {
desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
if (desc->handler->startup(i))
if (desc->chip->startup(i))
desc->status |= IRQ_PENDING;
}
spin_unlock_irq(&desc->lock);
@ -85,7 +85,7 @@ unsigned long probe_irq_on(void)
/* It triggered already - consider it spurious. */
if (!(status & IRQ_WAITING)) {
desc->status = status & ~IRQ_AUTODETECT;
desc->handler->shutdown(i);
desc->chip->shutdown(i);
} else
if (i < 32)
val |= 1 << i;
@ -128,7 +128,7 @@ unsigned int probe_irq_mask(unsigned long val)
mask |= 1 << i;
desc->status = status & ~IRQ_AUTODETECT;
desc->handler->shutdown(i);
desc->chip->shutdown(i);
}
spin_unlock_irq(&desc->lock);
}
@ -173,7 +173,7 @@ int probe_irq_off(unsigned long val)
nr_irqs++;
}
desc->status = status & ~IRQ_AUTODETECT;
desc->handler->shutdown(i);
desc->chip->shutdown(i);
}
spin_unlock_irq(&desc->lock);
}

View File

@ -31,7 +31,7 @@
irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
[0 ... NR_IRQS-1] = {
.status = IRQ_DISABLED,
.handler = &no_irq_type,
.chip = &no_irq_type,
.lock = SPIN_LOCK_UNLOCKED
}
};
@ -118,16 +118,16 @@ fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs)
/*
* No locking required for CPU-local interrupts:
*/
if (desc->handler->ack)
desc->handler->ack(irq);
if (desc->chip->ack)
desc->chip->ack(irq);
action_ret = handle_IRQ_event(irq, regs, desc->action);
desc->handler->end(irq);
desc->chip->end(irq);
return 1;
}
spin_lock(&desc->lock);
if (desc->handler->ack)
desc->handler->ack(irq);
if (desc->chip->ack)
desc->chip->ack(irq);
/*
* REPLAY is when Linux resends an IRQ that was dropped earlier
* WAITING is used by probe to mark irqs that are being tested
@ -187,7 +187,7 @@ out:
* The ->end() handler has to deal with interrupts which got
* disabled while the handler was running.
*/
desc->handler->end(irq);
desc->chip->end(irq);
spin_unlock(&desc->lock);
return 1;

View File

@ -69,7 +69,7 @@ void disable_irq_nosync(unsigned int irq)
spin_lock_irqsave(&desc->lock, flags);
if (!desc->depth++) {
desc->status |= IRQ_DISABLED;
desc->handler->disable(irq);
desc->chip->disable(irq);
}
spin_unlock_irqrestore(&desc->lock, flags);
}
@ -131,9 +131,9 @@ void enable_irq(unsigned int irq)
desc->status = status;
if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
desc->status = status | IRQ_REPLAY;
hw_resend_irq(desc->handler,irq);
hw_resend_irq(desc->chip,irq);
}
desc->handler->enable(irq);
desc->chip->enable(irq);
/* fall-through */
}
default:
@ -178,7 +178,7 @@ int setup_irq(unsigned int irq, struct irqaction * new)
if (irq >= NR_IRQS)
return -EINVAL;
if (desc->handler == &no_irq_type)
if (desc->chip == &no_irq_type)
return -ENOSYS;
/*
* Some drivers like serial.c use request_irq() heavily,
@ -230,10 +230,10 @@ int setup_irq(unsigned int irq, struct irqaction * new)
desc->depth = 0;
desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT |
IRQ_WAITING | IRQ_INPROGRESS);
if (desc->handler->startup)
desc->handler->startup(irq);
if (desc->chip->startup)
desc->chip->startup(irq);
else
desc->handler->enable(irq);
desc->chip->enable(irq);
}
spin_unlock_irqrestore(&desc->lock,flags);
@ -295,16 +295,16 @@ void free_irq(unsigned int irq, void *dev_id)
/* Currently used only by UML, might disappear one day.*/
#ifdef CONFIG_IRQ_RELEASE_METHOD
if (desc->handler->release)
desc->handler->release(irq, dev_id);
if (desc->chip->release)
desc->chip->release(irq, dev_id);
#endif
if (!desc->action) {
desc->status |= IRQ_DISABLED;
if (desc->handler->shutdown)
desc->handler->shutdown(irq);
if (desc->chip->shutdown)
desc->chip->shutdown(irq);
else
desc->handler->disable(irq);
desc->chip->disable(irq);
}
spin_unlock_irqrestore(&desc->lock,flags);
unregister_handler_proc(irq, action);

View File

@ -33,7 +33,7 @@ void move_native_irq(int irq)
if (unlikely(cpus_empty(pending_irq_cpumask[irq])))
return;
if (!desc->handler->set_affinity)
if (!desc->chip->set_affinity)
return;
assert_spin_locked(&desc->lock);
@ -51,12 +51,12 @@ void move_native_irq(int irq)
*/
if (likely(!cpus_empty(tmp))) {
if (likely(!(desc->status & IRQ_DISABLED)))
desc->handler->disable(irq);
desc->chip->disable(irq);
desc->handler->set_affinity(irq,tmp);
desc->chip->set_affinity(irq,tmp);
if (likely(!(desc->status & IRQ_DISABLED)))
desc->handler->enable(irq);
desc->chip->enable(irq);
}
cpus_clear(pending_irq_cpumask[irq]);
}

View File

@ -37,7 +37,7 @@ void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
{
set_balance_irq_affinity(irq, mask_val);
irq_affinity[irq] = mask_val;
irq_desc[irq].handler->set_affinity(irq, mask_val);
irq_desc[irq].chip->set_affinity(irq, mask_val);
}
#endif
@ -59,7 +59,7 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
unsigned int irq = (int)(long)data, full_count = count, err;
cpumask_t new_value, tmp;
if (!irq_desc[irq].handler->set_affinity || no_irq_affinity)
if (!irq_desc[irq].chip->set_affinity || no_irq_affinity)
return -EIO;
err = cpumask_parse(buffer, count, new_value);
@ -122,7 +122,7 @@ void register_irq_proc(unsigned int irq)
char name [MAX_NAMELEN];
if (!root_irq_dir ||
(irq_desc[irq].handler == &no_irq_type) ||
(irq_desc[irq].chip == &no_irq_type) ||
irq_dir[irq])
return;

View File

@ -81,7 +81,7 @@ static int misrouted_irq(int irq, struct pt_regs *regs)
* IRQ controller clean up too
*/
if(work)
desc->handler->end(i);
desc->chip->end(i);
spin_unlock(&desc->lock);
}
/* So the caller can adjust the irq error counts */
@ -166,7 +166,7 @@ void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret,
*/
printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
desc->status |= IRQ_DISABLED;
desc->handler->disable(irq);
desc->chip->disable(irq);
}
desc->irqs_unhandled = 0;
}