diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-06-29 05:24:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-29 13:26:21 -0400 |
commit | d1bef4ed5faf7d9872337b33c4269e45ae1bf960 (patch) | |
tree | a88c58e3102396382e9137a25a884af14421f6a6 /kernel | |
parent | cfb9e32f2ff32ef5265c1c80fe68dd1a7f03a604 (diff) |
[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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/irq/autoprobe.c | 10 | ||||
-rw-r--r-- | kernel/irq/handle.c | 14 | ||||
-rw-r--r-- | kernel/irq/manage.c | 24 | ||||
-rw-r--r-- | kernel/irq/migration.c | 8 | ||||
-rw-r--r-- | kernel/irq/proc.c | 6 | ||||
-rw-r--r-- | kernel/irq/spurious.c | 4 |
6 files changed, 33 insertions, 33 deletions
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c index 3467097ca61a..6f1e68a46cbc 100644 --- a/kernel/irq/autoprobe.c +++ b/kernel/irq/autoprobe.c | |||
@@ -41,7 +41,7 @@ unsigned long probe_irq_on(void) | |||
41 | 41 | ||
42 | spin_lock_irq(&desc->lock); | 42 | spin_lock_irq(&desc->lock); |
43 | if (!irq_desc[i].action) | 43 | if (!irq_desc[i].action) |
44 | irq_desc[i].handler->startup(i); | 44 | irq_desc[i].chip->startup(i); |
45 | spin_unlock_irq(&desc->lock); | 45 | spin_unlock_irq(&desc->lock); |
46 | } | 46 | } |
47 | 47 | ||
@@ -59,7 +59,7 @@ unsigned long probe_irq_on(void) | |||
59 | spin_lock_irq(&desc->lock); | 59 | spin_lock_irq(&desc->lock); |
60 | if (!desc->action) { | 60 | if (!desc->action) { |
61 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; | 61 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; |
62 | if (desc->handler->startup(i)) | 62 | if (desc->chip->startup(i)) |
63 | desc->status |= IRQ_PENDING; | 63 | desc->status |= IRQ_PENDING; |
64 | } | 64 | } |
65 | spin_unlock_irq(&desc->lock); | 65 | spin_unlock_irq(&desc->lock); |
@@ -85,7 +85,7 @@ unsigned long probe_irq_on(void) | |||
85 | /* It triggered already - consider it spurious. */ | 85 | /* It triggered already - consider it spurious. */ |
86 | if (!(status & IRQ_WAITING)) { | 86 | if (!(status & IRQ_WAITING)) { |
87 | desc->status = status & ~IRQ_AUTODETECT; | 87 | desc->status = status & ~IRQ_AUTODETECT; |
88 | desc->handler->shutdown(i); | 88 | desc->chip->shutdown(i); |
89 | } else | 89 | } else |
90 | if (i < 32) | 90 | if (i < 32) |
91 | val |= 1 << i; | 91 | val |= 1 << i; |
@@ -128,7 +128,7 @@ unsigned int probe_irq_mask(unsigned long val) | |||
128 | mask |= 1 << i; | 128 | mask |= 1 << i; |
129 | 129 | ||
130 | desc->status = status & ~IRQ_AUTODETECT; | 130 | desc->status = status & ~IRQ_AUTODETECT; |
131 | desc->handler->shutdown(i); | 131 | desc->chip->shutdown(i); |
132 | } | 132 | } |
133 | spin_unlock_irq(&desc->lock); | 133 | spin_unlock_irq(&desc->lock); |
134 | } | 134 | } |
@@ -173,7 +173,7 @@ int probe_irq_off(unsigned long val) | |||
173 | nr_irqs++; | 173 | nr_irqs++; |
174 | } | 174 | } |
175 | desc->status = status & ~IRQ_AUTODETECT; | 175 | desc->status = status & ~IRQ_AUTODETECT; |
176 | desc->handler->shutdown(i); | 176 | desc->chip->shutdown(i); |
177 | } | 177 | } |
178 | spin_unlock_irq(&desc->lock); | 178 | spin_unlock_irq(&desc->lock); |
179 | } | 179 | } |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 0f6530117105..f9d95705a4ac 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -31,7 +31,7 @@ | |||
31 | irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { | 31 | irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { |
32 | [0 ... NR_IRQS-1] = { | 32 | [0 ... NR_IRQS-1] = { |
33 | .status = IRQ_DISABLED, | 33 | .status = IRQ_DISABLED, |
34 | .handler = &no_irq_type, | 34 | .chip = &no_irq_type, |
35 | .lock = SPIN_LOCK_UNLOCKED | 35 | .lock = SPIN_LOCK_UNLOCKED |
36 | } | 36 | } |
37 | }; | 37 | }; |
@@ -118,16 +118,16 @@ fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) | |||
118 | /* | 118 | /* |
119 | * No locking required for CPU-local interrupts: | 119 | * No locking required for CPU-local interrupts: |
120 | */ | 120 | */ |
121 | if (desc->handler->ack) | 121 | if (desc->chip->ack) |
122 | desc->handler->ack(irq); | 122 | desc->chip->ack(irq); |
123 | action_ret = handle_IRQ_event(irq, regs, desc->action); | 123 | action_ret = handle_IRQ_event(irq, regs, desc->action); |
124 | desc->handler->end(irq); | 124 | desc->chip->end(irq); |
125 | return 1; | 125 | return 1; |
126 | } | 126 | } |
127 | 127 | ||
128 | spin_lock(&desc->lock); | 128 | spin_lock(&desc->lock); |
129 | if (desc->handler->ack) | 129 | if (desc->chip->ack) |
130 | desc->handler->ack(irq); | 130 | desc->chip->ack(irq); |
131 | /* | 131 | /* |
132 | * REPLAY is when Linux resends an IRQ that was dropped earlier | 132 | * REPLAY is when Linux resends an IRQ that was dropped earlier |
133 | * WAITING is used by probe to mark irqs that are being tested | 133 | * WAITING is used by probe to mark irqs that are being tested |
@@ -187,7 +187,7 @@ out: | |||
187 | * The ->end() handler has to deal with interrupts which got | 187 | * The ->end() handler has to deal with interrupts which got |
188 | * disabled while the handler was running. | 188 | * disabled while the handler was running. |
189 | */ | 189 | */ |
190 | desc->handler->end(irq); | 190 | desc->chip->end(irq); |
191 | spin_unlock(&desc->lock); | 191 | spin_unlock(&desc->lock); |
192 | 192 | ||
193 | return 1; | 193 | return 1; |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 1279e3499534..31ee1f3bfcf9 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -69,7 +69,7 @@ void disable_irq_nosync(unsigned int irq) | |||
69 | spin_lock_irqsave(&desc->lock, flags); | 69 | spin_lock_irqsave(&desc->lock, flags); |
70 | if (!desc->depth++) { | 70 | if (!desc->depth++) { |
71 | desc->status |= IRQ_DISABLED; | 71 | desc->status |= IRQ_DISABLED; |
72 | desc->handler->disable(irq); | 72 | desc->chip->disable(irq); |
73 | } | 73 | } |
74 | spin_unlock_irqrestore(&desc->lock, flags); | 74 | spin_unlock_irqrestore(&desc->lock, flags); |
75 | } | 75 | } |
@@ -131,9 +131,9 @@ void enable_irq(unsigned int irq) | |||
131 | desc->status = status; | 131 | desc->status = status; |
132 | if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { | 132 | if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { |
133 | desc->status = status | IRQ_REPLAY; | 133 | desc->status = status | IRQ_REPLAY; |
134 | hw_resend_irq(desc->handler,irq); | 134 | hw_resend_irq(desc->chip,irq); |
135 | } | 135 | } |
136 | desc->handler->enable(irq); | 136 | desc->chip->enable(irq); |
137 | /* fall-through */ | 137 | /* fall-through */ |
138 | } | 138 | } |
139 | default: | 139 | default: |
@@ -178,7 +178,7 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
178 | if (irq >= NR_IRQS) | 178 | if (irq >= NR_IRQS) |
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | 180 | ||
181 | if (desc->handler == &no_irq_type) | 181 | if (desc->chip == &no_irq_type) |
182 | return -ENOSYS; | 182 | return -ENOSYS; |
183 | /* | 183 | /* |
184 | * Some drivers like serial.c use request_irq() heavily, | 184 | * Some drivers like serial.c use request_irq() heavily, |
@@ -230,10 +230,10 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
230 | desc->depth = 0; | 230 | desc->depth = 0; |
231 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | | 231 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | |
232 | IRQ_WAITING | IRQ_INPROGRESS); | 232 | IRQ_WAITING | IRQ_INPROGRESS); |
233 | if (desc->handler->startup) | 233 | if (desc->chip->startup) |
234 | desc->handler->startup(irq); | 234 | desc->chip->startup(irq); |
235 | else | 235 | else |
236 | desc->handler->enable(irq); | 236 | desc->chip->enable(irq); |
237 | } | 237 | } |
238 | spin_unlock_irqrestore(&desc->lock,flags); | 238 | spin_unlock_irqrestore(&desc->lock,flags); |
239 | 239 | ||
@@ -295,16 +295,16 @@ void free_irq(unsigned int irq, void *dev_id) | |||
295 | 295 | ||
296 | /* Currently used only by UML, might disappear one day.*/ | 296 | /* Currently used only by UML, might disappear one day.*/ |
297 | #ifdef CONFIG_IRQ_RELEASE_METHOD | 297 | #ifdef CONFIG_IRQ_RELEASE_METHOD |
298 | if (desc->handler->release) | 298 | if (desc->chip->release) |
299 | desc->handler->release(irq, dev_id); | 299 | desc->chip->release(irq, dev_id); |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | if (!desc->action) { | 302 | if (!desc->action) { |
303 | desc->status |= IRQ_DISABLED; | 303 | desc->status |= IRQ_DISABLED; |
304 | if (desc->handler->shutdown) | 304 | if (desc->chip->shutdown) |
305 | desc->handler->shutdown(irq); | 305 | desc->chip->shutdown(irq); |
306 | else | 306 | else |
307 | desc->handler->disable(irq); | 307 | desc->chip->disable(irq); |
308 | } | 308 | } |
309 | spin_unlock_irqrestore(&desc->lock,flags); | 309 | spin_unlock_irqrestore(&desc->lock,flags); |
310 | unregister_handler_proc(irq, action); | 310 | unregister_handler_proc(irq, action); |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index a12d00eb5e7c..d978c87bca93 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c | |||
@@ -33,7 +33,7 @@ void move_native_irq(int irq) | |||
33 | if (unlikely(cpus_empty(pending_irq_cpumask[irq]))) | 33 | if (unlikely(cpus_empty(pending_irq_cpumask[irq]))) |
34 | return; | 34 | return; |
35 | 35 | ||
36 | if (!desc->handler->set_affinity) | 36 | if (!desc->chip->set_affinity) |
37 | return; | 37 | return; |
38 | 38 | ||
39 | assert_spin_locked(&desc->lock); | 39 | assert_spin_locked(&desc->lock); |
@@ -51,12 +51,12 @@ void move_native_irq(int irq) | |||
51 | */ | 51 | */ |
52 | if (likely(!cpus_empty(tmp))) { | 52 | if (likely(!cpus_empty(tmp))) { |
53 | if (likely(!(desc->status & IRQ_DISABLED))) | 53 | if (likely(!(desc->status & IRQ_DISABLED))) |
54 | desc->handler->disable(irq); | 54 | desc->chip->disable(irq); |
55 | 55 | ||
56 | desc->handler->set_affinity(irq,tmp); | 56 | desc->chip->set_affinity(irq,tmp); |
57 | 57 | ||
58 | if (likely(!(desc->status & IRQ_DISABLED))) | 58 | if (likely(!(desc->status & IRQ_DISABLED))) |
59 | desc->handler->enable(irq); | 59 | desc->chip->enable(irq); |
60 | } | 60 | } |
61 | cpus_clear(pending_irq_cpumask[irq]); | 61 | cpus_clear(pending_irq_cpumask[irq]); |
62 | } | 62 | } |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index afacd6f585fa..90fe05f23e69 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -37,7 +37,7 @@ void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) | |||
37 | { | 37 | { |
38 | set_balance_irq_affinity(irq, mask_val); | 38 | set_balance_irq_affinity(irq, mask_val); |
39 | irq_affinity[irq] = mask_val; | 39 | irq_affinity[irq] = mask_val; |
40 | irq_desc[irq].handler->set_affinity(irq, mask_val); | 40 | irq_desc[irq].chip->set_affinity(irq, mask_val); |
41 | } | 41 | } |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -59,7 +59,7 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer, | |||
59 | unsigned int irq = (int)(long)data, full_count = count, err; | 59 | unsigned int irq = (int)(long)data, full_count = count, err; |
60 | cpumask_t new_value, tmp; | 60 | cpumask_t new_value, tmp; |
61 | 61 | ||
62 | if (!irq_desc[irq].handler->set_affinity || no_irq_affinity) | 62 | if (!irq_desc[irq].chip->set_affinity || no_irq_affinity) |
63 | return -EIO; | 63 | return -EIO; |
64 | 64 | ||
65 | err = cpumask_parse(buffer, count, new_value); | 65 | err = cpumask_parse(buffer, count, new_value); |
@@ -122,7 +122,7 @@ void register_irq_proc(unsigned int irq) | |||
122 | char name [MAX_NAMELEN]; | 122 | char name [MAX_NAMELEN]; |
123 | 123 | ||
124 | if (!root_irq_dir || | 124 | if (!root_irq_dir || |
125 | (irq_desc[irq].handler == &no_irq_type) || | 125 | (irq_desc[irq].chip == &no_irq_type) || |
126 | irq_dir[irq]) | 126 | irq_dir[irq]) |
127 | return; | 127 | return; |
128 | 128 | ||
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index b2fb3c18d06b..ea3ceed362da 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -81,7 +81,7 @@ static int misrouted_irq(int irq, struct pt_regs *regs) | |||
81 | * IRQ controller clean up too | 81 | * IRQ controller clean up too |
82 | */ | 82 | */ |
83 | if(work) | 83 | if(work) |
84 | desc->handler->end(i); | 84 | desc->chip->end(i); |
85 | spin_unlock(&desc->lock); | 85 | spin_unlock(&desc->lock); |
86 | } | 86 | } |
87 | /* So the caller can adjust the irq error counts */ | 87 | /* 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, | |||
166 | */ | 166 | */ |
167 | printk(KERN_EMERG "Disabling IRQ #%d\n", irq); | 167 | printk(KERN_EMERG "Disabling IRQ #%d\n", irq); |
168 | desc->status |= IRQ_DISABLED; | 168 | desc->status |= IRQ_DISABLED; |
169 | desc->handler->disable(irq); | 169 | desc->chip->disable(irq); |
170 | } | 170 | } |
171 | desc->irqs_unhandled = 0; | 171 | desc->irqs_unhandled = 0; |
172 | } | 172 | } |