aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/chip.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-02 16:41:14 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-19 06:58:10 -0500
commit4699923861513671d3f6ade8efb4e56a9a7ecadf (patch)
tree862cda99b9af6fe96fda955107f24a7b5cc97a18 /kernel/irq/chip.c
parent3b56f0585fd4c02d047dc406668cb40159b2d340 (diff)
genirq: Consolidate startup/shutdown of interrupts
Aside of duplicated code some of the startup/shutdown sites do not handle the MASKED/DISABLED flags and the depth field at all. Move that to a helper function and take care of it there. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20110202212551.787481468@linutronix.de>
Diffstat (limited to 'kernel/irq/chip.c')
-rw-r--r--kernel/irq/chip.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 31258782742c..988fe7a24282 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -192,6 +192,25 @@ void set_irq_nested_thread(unsigned int irq, int nest)
192} 192}
193EXPORT_SYMBOL_GPL(set_irq_nested_thread); 193EXPORT_SYMBOL_GPL(set_irq_nested_thread);
194 194
195int irq_startup(struct irq_desc *desc)
196{
197 desc->status &= ~(IRQ_MASKED | IRQ_DISABLED);
198 desc->depth = 0;
199
200 if (desc->irq_data.chip->irq_startup)
201 return desc->irq_data.chip->irq_startup(&desc->irq_data);
202
203 desc->irq_data.chip->irq_enable(&desc->irq_data);
204 return 0;
205}
206
207void irq_shutdown(struct irq_desc *desc)
208{
209 desc->status |= IRQ_MASKED | IRQ_DISABLED;
210 desc->depth = 1;
211 desc->irq_data.chip->irq_shutdown(&desc->irq_data);
212}
213
195/* 214/*
196 * default enable function 215 * default enable function
197 */ 216 */
@@ -211,17 +230,6 @@ static void default_disable(struct irq_data *data)
211} 230}
212 231
213/* 232/*
214 * default startup function
215 */
216static unsigned int default_startup(struct irq_data *data)
217{
218 struct irq_desc *desc = irq_data_to_desc(data);
219
220 desc->irq_data.chip->irq_enable(data);
221 return 0;
222}
223
224/*
225 * default shutdown function 233 * default shutdown function
226 */ 234 */
227static void default_shutdown(struct irq_data *data) 235static void default_shutdown(struct irq_data *data)
@@ -229,7 +237,6 @@ static void default_shutdown(struct irq_data *data)
229 struct irq_desc *desc = irq_data_to_desc(data); 237 struct irq_desc *desc = irq_data_to_desc(data);
230 238
231 desc->irq_data.chip->irq_mask(&desc->irq_data); 239 desc->irq_data.chip->irq_mask(&desc->irq_data);
232 desc->status |= IRQ_MASKED;
233} 240}
234 241
235#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED 242#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
@@ -337,8 +344,6 @@ void irq_chip_set_defaults(struct irq_chip *chip)
337 chip->irq_enable = default_enable; 344 chip->irq_enable = default_enable;
338 if (!chip->irq_disable) 345 if (!chip->irq_disable)
339 chip->irq_disable = default_disable; 346 chip->irq_disable = default_disable;
340 if (!chip->irq_startup)
341 chip->irq_startup = default_startup;
342 /* 347 /*
343 * We use chip->irq_disable, when the user provided its own. When 348 * We use chip->irq_disable, when the user provided its own. When
344 * we have default_disable set for chip->irq_disable, then we need 349 * we have default_disable set for chip->irq_disable, then we need
@@ -747,10 +752,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
747 desc->name = name; 752 desc->name = name;
748 753
749 if (handle != handle_bad_irq && is_chained) { 754 if (handle != handle_bad_irq && is_chained) {
750 desc->status &= ~IRQ_DISABLED;
751 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE; 755 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
752 desc->depth = 0; 756 irq_startup(desc);
753 desc->irq_data.chip->irq_startup(&desc->irq_data);
754 } 757 }
755 raw_spin_unlock_irqrestore(&desc->lock, flags); 758 raw_spin_unlock_irqrestore(&desc->lock, flags);
756 chip_bus_sync_unlock(desc); 759 chip_bus_sync_unlock(desc);