blob: baa5c4acad83cc4bd9efad28719d054afc960012 [file] [log] [blame]
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -07001/*
2 * linux/kernel/irq/chip.c
3 *
4 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
5 * Copyright (C) 2005-2006, Thomas Gleixner, Russell King
6 *
7 * This file contains the core interrupt handling code, for irq-chip
8 * based architectures.
9 *
10 * Detailed information is available in Documentation/DocBook/genericirq
11 */
12
13#include <linux/irq.h>
Michael Ellerman7fe37302007-04-18 19:39:21 +100014#include <linux/msi.h>
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070015#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
18
19#include "internals.h"
20
Eric W. Biederman3a16d712006-10-04 02:16:37 -070021/**
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070022 * set_irq_chip - set the irq chip for an irq
23 * @irq: irq number
24 * @chip: pointer to irq chip description structure
25 */
26int set_irq_chip(unsigned int irq, struct irq_chip *chip)
27{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +020028 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070029 unsigned long flags;
30
Yinghai Lu7d94f7c2008-08-19 20:50:14 -070031 if (!desc) {
Arjan van de Ven261c40c2008-07-25 19:45:37 -070032 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070033 return -EINVAL;
34 }
35
36 if (!chip)
37 chip = &no_irq_chip;
38
Thomas Gleixner239007b2009-11-17 16:46:45 +010039 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070040 irq_chip_set_defaults(chip);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020041 desc->irq_data.chip = chip;
Thomas Gleixner239007b2009-11-17 16:46:45 +010042 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070043
44 return 0;
45}
46EXPORT_SYMBOL(set_irq_chip);
47
48/**
David Brownell0c5d1eb2008-10-01 14:46:18 -070049 * set_irq_type - set the irq trigger type for an irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070050 * @irq: irq number
David Brownell0c5d1eb2008-10-01 14:46:18 -070051 * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070052 */
53int set_irq_type(unsigned int irq, unsigned int type)
54{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +020055 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070056 unsigned long flags;
57 int ret = -ENXIO;
58
Yinghai Lu7d94f7c2008-08-19 20:50:14 -070059 if (!desc) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070060 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
61 return -ENODEV;
62 }
63
David Brownellf2b662d2008-12-01 14:31:38 -080064 type &= IRQ_TYPE_SENSE_MASK;
David Brownell0c5d1eb2008-10-01 14:46:18 -070065 if (type == IRQ_TYPE_NONE)
66 return 0;
67
Thomas Gleixner239007b2009-11-17 16:46:45 +010068 raw_spin_lock_irqsave(&desc->lock, flags);
Chris Friesen0b3682b2008-10-20 12:41:58 -060069 ret = __irq_set_trigger(desc, irq, type);
Thomas Gleixner239007b2009-11-17 16:46:45 +010070 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070071 return ret;
72}
73EXPORT_SYMBOL(set_irq_type);
74
75/**
76 * set_irq_data - set irq type data for an irq
77 * @irq: Interrupt number
78 * @data: Pointer to interrupt specific data
79 *
80 * Set the hardware irq controller data for an irq
81 */
82int set_irq_data(unsigned int irq, void *data)
83{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +020084 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070085 unsigned long flags;
86
Yinghai Lu7d94f7c2008-08-19 20:50:14 -070087 if (!desc) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070088 printk(KERN_ERR
89 "Trying to install controller data for IRQ%d\n", irq);
90 return -EINVAL;
91 }
92
Thomas Gleixner239007b2009-11-17 16:46:45 +010093 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020094 desc->irq_data.handler_data = data;
Thomas Gleixner239007b2009-11-17 16:46:45 +010095 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070096 return 0;
97}
98EXPORT_SYMBOL(set_irq_data);
99
100/**
Liuweni24b26d42009-11-04 20:11:05 +0800101 * set_irq_msi - set MSI descriptor data for an irq
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700102 * @irq: Interrupt number
Randy Dunlap472900b2007-02-16 01:28:25 -0800103 * @entry: Pointer to MSI descriptor data
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700104 *
Liuweni24b26d42009-11-04 20:11:05 +0800105 * Set the MSI descriptor entry for an irq
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700106 */
107int set_irq_msi(unsigned int irq, struct msi_desc *entry)
108{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200109 struct irq_desc *desc = irq_to_desc(irq);
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700110 unsigned long flags;
111
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700112 if (!desc) {
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700113 printk(KERN_ERR
114 "Trying to install msi data for IRQ%d\n", irq);
115 return -EINVAL;
116 }
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700117
Thomas Gleixner239007b2009-11-17 16:46:45 +0100118 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200119 desc->irq_data.msi_desc = entry;
Michael Ellerman7fe37302007-04-18 19:39:21 +1000120 if (entry)
121 entry->irq = irq;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100122 raw_spin_unlock_irqrestore(&desc->lock, flags);
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700123 return 0;
124}
125
126/**
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700127 * set_irq_chip_data - set irq chip data for an irq
128 * @irq: Interrupt number
129 * @data: Pointer to chip specific data
130 *
131 * Set the hardware irq chip data for an irq
132 */
133int set_irq_chip_data(unsigned int irq, void *data)
134{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200135 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700136 unsigned long flags;
137
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700138 if (!desc) {
139 printk(KERN_ERR
140 "Trying to install chip data for IRQ%d\n", irq);
141 return -EINVAL;
142 }
143
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200144 if (!desc->irq_data.chip) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700145 printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
146 return -EINVAL;
147 }
148
Thomas Gleixner239007b2009-11-17 16:46:45 +0100149 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200150 desc->irq_data.chip_data = data;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100151 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700152
153 return 0;
154}
155EXPORT_SYMBOL(set_irq_chip_data);
156
Thomas Gleixnerf303a6d2010-09-28 17:34:01 +0200157struct irq_data *irq_get_irq_data(unsigned int irq)
158{
159 struct irq_desc *desc = irq_to_desc(irq);
160
161 return desc ? &desc->irq_data : NULL;
162}
163EXPORT_SYMBOL_GPL(irq_get_irq_data);
164
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200165/**
166 * set_irq_nested_thread - Set/Reset the IRQ_NESTED_THREAD flag of an irq
167 *
168 * @irq: Interrupt number
169 * @nest: 0 to clear / 1 to set the IRQ_NESTED_THREAD flag
170 *
171 * The IRQ_NESTED_THREAD flag indicates that on
172 * request_threaded_irq() no separate interrupt thread should be
173 * created for the irq as the handler are called nested in the
174 * context of a demultiplexing interrupt handler thread.
175 */
176void set_irq_nested_thread(unsigned int irq, int nest)
177{
178 struct irq_desc *desc = irq_to_desc(irq);
179 unsigned long flags;
180
181 if (!desc)
182 return;
183
Thomas Gleixner239007b2009-11-17 16:46:45 +0100184 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200185 if (nest)
186 desc->status |= IRQ_NESTED_THREAD;
187 else
188 desc->status &= ~IRQ_NESTED_THREAD;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100189 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200190}
191EXPORT_SYMBOL_GPL(set_irq_nested_thread);
192
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700193/*
194 * default enable function
195 */
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000196static void default_enable(struct irq_data *data)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700197{
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000198 struct irq_desc *desc = irq_data_to_desc(data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700199
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000200 desc->irq_data.chip->irq_unmask(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700201 desc->status &= ~IRQ_MASKED;
202}
203
204/*
205 * default disable function
206 */
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000207static void default_disable(struct irq_data *data)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700208{
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700209}
210
211/*
212 * default startup function
213 */
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000214static unsigned int default_startup(struct irq_data *data)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700215{
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000216 struct irq_desc *desc = irq_data_to_desc(data);
Yinghai Lu08678b02008-08-19 20:50:05 -0700217
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000218 desc->irq_data.chip->irq_enable(data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700219 return 0;
220}
221
222/*
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100223 * default shutdown function
224 */
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000225static void default_shutdown(struct irq_data *data)
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100226{
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000227 struct irq_desc *desc = irq_data_to_desc(data);
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100228
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000229 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100230 desc->status |= IRQ_MASKED;
231}
232
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200233#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000234/* Temporary migration helpers */
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000235static void compat_irq_mask(struct irq_data *data)
236{
237 data->chip->mask(data->irq);
238}
239
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000240static void compat_irq_unmask(struct irq_data *data)
241{
242 data->chip->unmask(data->irq);
243}
244
Thomas Gleixner22a49162010-09-27 12:44:47 +0000245static void compat_irq_ack(struct irq_data *data)
246{
247 data->chip->ack(data->irq);
248}
249
Thomas Gleixner9205e312010-09-27 12:44:50 +0000250static void compat_irq_mask_ack(struct irq_data *data)
251{
252 data->chip->mask_ack(data->irq);
253}
254
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000255static void compat_irq_eoi(struct irq_data *data)
256{
257 data->chip->eoi(data->irq);
258}
259
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000260static void compat_irq_enable(struct irq_data *data)
261{
262 data->chip->enable(data->irq);
263}
264
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000265static void compat_irq_disable(struct irq_data *data)
266{
267 data->chip->disable(data->irq);
268}
269
270static void compat_irq_shutdown(struct irq_data *data)
271{
272 data->chip->shutdown(data->irq);
273}
274
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000275static unsigned int compat_irq_startup(struct irq_data *data)
276{
277 return data->chip->startup(data->irq);
278}
279
Thomas Gleixnerc96b3b32010-09-27 12:45:41 +0000280static int compat_irq_set_affinity(struct irq_data *data,
281 const struct cpumask *dest, bool force)
282{
283 return data->chip->set_affinity(data->irq, dest);
284}
285
Thomas Gleixnerb2ba2c32010-09-27 12:45:47 +0000286static int compat_irq_set_type(struct irq_data *data, unsigned int type)
287{
288 return data->chip->set_type(data->irq, type);
289}
290
Thomas Gleixner2f7e99b2010-09-27 12:45:50 +0000291static int compat_irq_set_wake(struct irq_data *data, unsigned int on)
292{
293 return data->chip->set_wake(data->irq, on);
294}
295
Thomas Gleixner21e2b8c2010-09-27 12:45:53 +0000296static int compat_irq_retrigger(struct irq_data *data)
297{
298 return data->chip->retrigger(data->irq);
299}
300
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000301static void compat_bus_lock(struct irq_data *data)
302{
303 data->chip->bus_lock(data->irq);
304}
305
306static void compat_bus_sync_unlock(struct irq_data *data)
307{
308 data->chip->bus_sync_unlock(data->irq);
309}
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200310#endif
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000311
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100312/*
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700313 * Fixup enable/disable function pointers
314 */
315void irq_chip_set_defaults(struct irq_chip *chip)
316{
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200317#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000318 /*
319 * Compat fixup functions need to be before we set the
320 * defaults for enable/disable/startup/shutdown
321 */
322 if (chip->enable)
323 chip->irq_enable = compat_irq_enable;
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000324 if (chip->disable)
325 chip->irq_disable = compat_irq_disable;
326 if (chip->shutdown)
327 chip->irq_shutdown = compat_irq_shutdown;
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000328 if (chip->startup)
329 chip->irq_startup = compat_irq_startup;
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200330#endif
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000331 /*
332 * The real defaults
333 */
334 if (!chip->irq_enable)
335 chip->irq_enable = default_enable;
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000336 if (!chip->irq_disable)
337 chip->irq_disable = default_disable;
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000338 if (!chip->irq_startup)
339 chip->irq_startup = default_startup;
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100340 /*
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000341 * We use chip->irq_disable, when the user provided its own. When
342 * we have default_disable set for chip->irq_disable, then we need
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100343 * to use default_shutdown, otherwise the irq line is not
344 * disabled on free_irq():
345 */
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000346 if (!chip->irq_shutdown)
347 chip->irq_shutdown = chip->irq_disable != default_disable ?
348 chip->irq_disable : default_shutdown;
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200349
350#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
Zhang, Yanminb86432b2006-11-16 01:19:10 -0800351 if (!chip->end)
352 chip->end = dummy_irq_chip.end;
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000353
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000354 /*
355 * Now fix up the remaining compat handlers
356 */
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000357 if (chip->bus_lock)
358 chip->irq_bus_lock = compat_bus_lock;
359 if (chip->bus_sync_unlock)
360 chip->irq_bus_sync_unlock = compat_bus_sync_unlock;
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000361 if (chip->mask)
362 chip->irq_mask = compat_irq_mask;
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000363 if (chip->unmask)
364 chip->irq_unmask = compat_irq_unmask;
Thomas Gleixner22a49162010-09-27 12:44:47 +0000365 if (chip->ack)
366 chip->irq_ack = compat_irq_ack;
Thomas Gleixner9205e312010-09-27 12:44:50 +0000367 if (chip->mask_ack)
368 chip->irq_mask_ack = compat_irq_mask_ack;
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000369 if (chip->eoi)
370 chip->irq_eoi = compat_irq_eoi;
Thomas Gleixnerc96b3b32010-09-27 12:45:41 +0000371 if (chip->set_affinity)
372 chip->irq_set_affinity = compat_irq_set_affinity;
Thomas Gleixnerb2ba2c32010-09-27 12:45:47 +0000373 if (chip->set_type)
374 chip->irq_set_type = compat_irq_set_type;
Thomas Gleixner2f7e99b2010-09-27 12:45:50 +0000375 if (chip->set_wake)
376 chip->irq_set_wake = compat_irq_set_wake;
Thomas Gleixner21e2b8c2010-09-27 12:45:53 +0000377 if (chip->retrigger)
378 chip->irq_retrigger = compat_irq_retrigger;
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200379#endif
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700380}
381
Thomas Gleixner9205e312010-09-27 12:44:50 +0000382static inline void mask_ack_irq(struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700383{
Thomas Gleixner9205e312010-09-27 12:44:50 +0000384 if (desc->irq_data.chip->irq_mask_ack)
385 desc->irq_data.chip->irq_mask_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700386 else {
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000387 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner22a49162010-09-27 12:44:47 +0000388 if (desc->irq_data.chip->irq_ack)
389 desc->irq_data.chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700390 }
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100391 desc->status |= IRQ_MASKED;
392}
393
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000394static inline void mask_irq(struct irq_desc *desc)
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100395{
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000396 if (desc->irq_data.chip->irq_mask) {
397 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100398 desc->status |= IRQ_MASKED;
399 }
400}
401
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000402static inline void unmask_irq(struct irq_desc *desc)
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100403{
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000404 if (desc->irq_data.chip->irq_unmask) {
405 desc->irq_data.chip->irq_unmask(&desc->irq_data);
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100406 desc->status &= ~IRQ_MASKED;
407 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700408}
409
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200410/*
411 * handle_nested_irq - Handle a nested irq from a irq thread
412 * @irq: the interrupt number
413 *
414 * Handle interrupts which are nested into a threaded interrupt
415 * handler. The handler function is called inside the calling
416 * threads context.
417 */
418void handle_nested_irq(unsigned int irq)
419{
420 struct irq_desc *desc = irq_to_desc(irq);
421 struct irqaction *action;
422 irqreturn_t action_ret;
423
424 might_sleep();
425
Thomas Gleixner239007b2009-11-17 16:46:45 +0100426 raw_spin_lock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200427
428 kstat_incr_irqs_this_cpu(irq, desc);
429
430 action = desc->action;
431 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
432 goto out_unlock;
433
434 desc->status |= IRQ_INPROGRESS;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100435 raw_spin_unlock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200436
437 action_ret = action->thread_fn(action->irq, action->dev_id);
438 if (!noirqdebug)
439 note_interrupt(irq, desc, action_ret);
440
Thomas Gleixner239007b2009-11-17 16:46:45 +0100441 raw_spin_lock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200442 desc->status &= ~IRQ_INPROGRESS;
443
444out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100445 raw_spin_unlock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200446}
447EXPORT_SYMBOL_GPL(handle_nested_irq);
448
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700449/**
450 * handle_simple_irq - Simple and software-decoded IRQs.
451 * @irq: the interrupt number
452 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700453 *
454 * Simple interrupts are either sent from a demultiplexing interrupt
455 * handler or come from hardware, where no interrupt hardware control
456 * is necessary.
457 *
458 * Note: The caller is expected to handle the ack, clear, mask and
459 * unmask issues if necessary.
460 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800461void
David Howells7d12e782006-10-05 14:55:46 +0100462handle_simple_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700463{
464 struct irqaction *action;
465 irqreturn_t action_ret;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700466
Thomas Gleixner239007b2009-11-17 16:46:45 +0100467 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700468
469 if (unlikely(desc->status & IRQ_INPROGRESS))
470 goto out_unlock;
Steven Rostedt971e5b35f2007-12-18 18:05:58 +0100471 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200472 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700473
474 action = desc->action;
Steven Rostedt971e5b35f2007-12-18 18:05:58 +0100475 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700476 goto out_unlock;
477
478 desc->status |= IRQ_INPROGRESS;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100479 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700480
David Howells7d12e782006-10-05 14:55:46 +0100481 action_ret = handle_IRQ_event(irq, action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700482 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100483 note_interrupt(irq, desc, action_ret);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700484
Thomas Gleixner239007b2009-11-17 16:46:45 +0100485 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700486 desc->status &= ~IRQ_INPROGRESS;
487out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100488 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700489}
490
491/**
492 * handle_level_irq - Level type irq handler
493 * @irq: the interrupt number
494 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700495 *
496 * Level type interrupts are active as long as the hardware line has
497 * the active level. This may require to mask the interrupt and unmask
498 * it after the associated handler has acknowledged the device, so the
499 * interrupt line is back to inactive.
500 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800501void
David Howells7d12e782006-10-05 14:55:46 +0100502handle_level_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700503{
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700504 struct irqaction *action;
505 irqreturn_t action_ret;
506
Thomas Gleixner239007b2009-11-17 16:46:45 +0100507 raw_spin_lock(&desc->lock);
Thomas Gleixner9205e312010-09-27 12:44:50 +0000508 mask_ack_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700509
510 if (unlikely(desc->status & IRQ_INPROGRESS))
Ingo Molnar86998aa2006-09-19 11:14:34 +0200511 goto out_unlock;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700512 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200513 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700514
515 /*
516 * If its disabled or no action available
517 * keep it masked and get out of here
518 */
519 action = desc->action;
Thomas Gleixner49663422007-08-12 15:46:34 +0000520 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
Ingo Molnar86998aa2006-09-19 11:14:34 +0200521 goto out_unlock;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700522
523 desc->status |= IRQ_INPROGRESS;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100524 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700525
David Howells7d12e782006-10-05 14:55:46 +0100526 action_ret = handle_IRQ_event(irq, action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700527 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100528 note_interrupt(irq, desc, action_ret);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700529
Thomas Gleixner239007b2009-11-17 16:46:45 +0100530 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700531 desc->status &= ~IRQ_INPROGRESS;
Thomas Gleixnerb25c3402009-08-13 12:17:22 +0200532
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100533 if (!(desc->status & (IRQ_DISABLED | IRQ_ONESHOT)))
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000534 unmask_irq(desc);
Ingo Molnar86998aa2006-09-19 11:14:34 +0200535out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100536 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700537}
Ingo Molnar14819ea2009-01-14 12:34:21 +0100538EXPORT_SYMBOL_GPL(handle_level_irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700539
540/**
Ingo Molnar47c2a3a2006-06-29 02:25:03 -0700541 * handle_fasteoi_irq - irq handler for transparent controllers
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700542 * @irq: the interrupt number
543 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700544 *
Ingo Molnar47c2a3a2006-06-29 02:25:03 -0700545 * Only a single callback will be issued to the chip: an ->eoi()
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700546 * call when the interrupt has been serviced. This enables support
547 * for modern forms of interrupt handlers, which handle the flow
548 * details in hardware, transparently.
549 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800550void
David Howells7d12e782006-10-05 14:55:46 +0100551handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700552{
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700553 struct irqaction *action;
554 irqreturn_t action_ret;
555
Thomas Gleixner239007b2009-11-17 16:46:45 +0100556 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700557
558 if (unlikely(desc->status & IRQ_INPROGRESS))
559 goto out;
560
561 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200562 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700563
564 /*
565 * If its disabled or no action available
Ingo Molnar76d21602007-02-16 01:28:24 -0800566 * then mask it and get out of here:
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700567 */
568 action = desc->action;
Benjamin Herrenschmidt98bb2442006-06-29 02:25:01 -0700569 if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
570 desc->status |= IRQ_PENDING;
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000571 mask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700572 goto out;
Benjamin Herrenschmidt98bb2442006-06-29 02:25:01 -0700573 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700574
575 desc->status |= IRQ_INPROGRESS;
Benjamin Herrenschmidt98bb2442006-06-29 02:25:01 -0700576 desc->status &= ~IRQ_PENDING;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100577 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700578
David Howells7d12e782006-10-05 14:55:46 +0100579 action_ret = handle_IRQ_event(irq, action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700580 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100581 note_interrupt(irq, desc, action_ret);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700582
Thomas Gleixner239007b2009-11-17 16:46:45 +0100583 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700584 desc->status &= ~IRQ_INPROGRESS;
585out:
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000586 desc->irq_data.chip->irq_eoi(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700587
Thomas Gleixner239007b2009-11-17 16:46:45 +0100588 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700589}
590
591/**
592 * handle_edge_irq - edge type IRQ handler
593 * @irq: the interrupt number
594 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700595 *
596 * Interrupt occures on the falling and/or rising edge of a hardware
597 * signal. The occurence is latched into the irq controller hardware
598 * and must be acked in order to be reenabled. After the ack another
599 * interrupt can happen on the same source even before the first one
Uwe Kleine-Königdfff0612010-02-12 21:58:11 +0100600 * is handled by the associated event handler. If this happens it
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700601 * might be necessary to disable (mask) the interrupt depending on the
602 * controller hardware. This requires to reenable the interrupt inside
603 * of the loop which handles the interrupts which have arrived while
604 * the handler was running. If all pending interrupts are handled, the
605 * loop is left.
606 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800607void
David Howells7d12e782006-10-05 14:55:46 +0100608handle_edge_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700609{
Thomas Gleixner239007b2009-11-17 16:46:45 +0100610 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700611
612 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
613
614 /*
615 * If we're currently running this IRQ, or its disabled,
616 * we shouldn't process the IRQ. Mark it pending, handle
617 * the necessary masking and go out
618 */
619 if (unlikely((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
620 !desc->action)) {
621 desc->status |= (IRQ_PENDING | IRQ_MASKED);
Thomas Gleixner9205e312010-09-27 12:44:50 +0000622 mask_ack_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700623 goto out_unlock;
624 }
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200625 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700626
627 /* Start handling the irq */
Thomas Gleixner22a49162010-09-27 12:44:47 +0000628 desc->irq_data.chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700629
630 /* Mark the IRQ currently in progress.*/
631 desc->status |= IRQ_INPROGRESS;
632
633 do {
634 struct irqaction *action = desc->action;
635 irqreturn_t action_ret;
636
637 if (unlikely(!action)) {
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000638 mask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700639 goto out_unlock;
640 }
641
642 /*
643 * When another irq arrived while we were handling
644 * one, we could have masked the irq.
645 * Renable it, if it was not disabled in meantime.
646 */
647 if (unlikely((desc->status &
648 (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) ==
649 (IRQ_PENDING | IRQ_MASKED))) {
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000650 unmask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700651 }
652
653 desc->status &= ~IRQ_PENDING;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100654 raw_spin_unlock(&desc->lock);
David Howells7d12e782006-10-05 14:55:46 +0100655 action_ret = handle_IRQ_event(irq, action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700656 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100657 note_interrupt(irq, desc, action_ret);
Thomas Gleixner239007b2009-11-17 16:46:45 +0100658 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700659
660 } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
661
662 desc->status &= ~IRQ_INPROGRESS;
663out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100664 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700665}
666
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700667/**
Liuweni24b26d42009-11-04 20:11:05 +0800668 * handle_percpu_irq - Per CPU local irq handler
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700669 * @irq: the interrupt number
670 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700671 *
672 * Per CPU interrupts on SMP machines without locking requirements
673 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800674void
David Howells7d12e782006-10-05 14:55:46 +0100675handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700676{
677 irqreturn_t action_ret;
678
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200679 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700680
Thomas Gleixner22a49162010-09-27 12:44:47 +0000681 if (desc->irq_data.chip->irq_ack)
682 desc->irq_data.chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700683
David Howells7d12e782006-10-05 14:55:46 +0100684 action_ret = handle_IRQ_event(irq, desc->action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700685 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100686 note_interrupt(irq, desc, action_ret);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700687
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000688 if (desc->irq_data.chip->irq_eoi)
689 desc->irq_data.chip->irq_eoi(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700690}
691
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700692void
Ingo Molnara460e742006-10-17 00:10:03 -0700693__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
694 const char *name)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700695{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200696 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700697 unsigned long flags;
698
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700699 if (!desc) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700700 printk(KERN_ERR
701 "Trying to install type control for IRQ%d\n", irq);
702 return;
703 }
704
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700705 if (!handle)
706 handle = handle_bad_irq;
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200707 else if (desc->irq_data.chip == &no_irq_chip) {
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100708 printk(KERN_WARNING "Trying to install %sinterrupt handler "
Geert Uytterhoevenb039db82006-12-20 15:59:48 +0100709 "for IRQ%d\n", is_chained ? "chained " : "", irq);
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100710 /*
711 * Some ARM implementations install a handler for really dumb
712 * interrupt hardware without setting an irq_chip. This worked
713 * with the ARM no_irq_chip but the check in setup_irq would
714 * prevent us to setup the interrupt at all. Switch it to
715 * dummy_irq_chip for easy transition.
716 */
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200717 desc->irq_data.chip = &dummy_irq_chip;
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100718 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700719
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000720 chip_bus_lock(desc);
Thomas Gleixner239007b2009-11-17 16:46:45 +0100721 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700722
723 /* Uninstall? */
724 if (handle == handle_bad_irq) {
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200725 if (desc->irq_data.chip != &no_irq_chip)
Thomas Gleixner9205e312010-09-27 12:44:50 +0000726 mask_ack_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700727 desc->status |= IRQ_DISABLED;
728 desc->depth = 1;
729 }
730 desc->handle_irq = handle;
Ingo Molnara460e742006-10-17 00:10:03 -0700731 desc->name = name;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700732
733 if (handle != handle_bad_irq && is_chained) {
734 desc->status &= ~IRQ_DISABLED;
735 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
736 desc->depth = 0;
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000737 desc->irq_data.chip->irq_startup(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700738 }
Thomas Gleixner239007b2009-11-17 16:46:45 +0100739 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000740 chip_bus_sync_unlock(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700741}
Ingo Molnar14819ea2009-01-14 12:34:21 +0100742EXPORT_SYMBOL_GPL(__set_irq_handler);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700743
744void
745set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
David Howells57a58a92006-10-05 13:06:34 +0100746 irq_flow_handler_t handle)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700747{
748 set_irq_chip(irq, chip);
Ingo Molnara460e742006-10-17 00:10:03 -0700749 __set_irq_handler(irq, handle, 0, NULL);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700750}
751
Ingo Molnara460e742006-10-17 00:10:03 -0700752void
753set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
754 irq_flow_handler_t handle, const char *name)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700755{
Ingo Molnara460e742006-10-17 00:10:03 -0700756 set_irq_chip(irq, chip);
757 __set_irq_handler(irq, handle, 0, name);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700758}
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800759
Thomas Gleixner44247182010-09-28 10:40:18 +0200760void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800761{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200762 struct irq_desc *desc = irq_to_desc(irq);
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800763 unsigned long flags;
764
Thomas Gleixner44247182010-09-28 10:40:18 +0200765 if (!desc)
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800766 return;
Thomas Gleixner44247182010-09-28 10:40:18 +0200767
768 /* Sanitize flags */
769 set &= IRQF_MODIFY_MASK;
770 clr &= IRQF_MODIFY_MASK;
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800771
Thomas Gleixner239007b2009-11-17 16:46:45 +0100772 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner44247182010-09-28 10:40:18 +0200773 desc->status &= ~clr;
774 desc->status |= set;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100775 raw_spin_unlock_irqrestore(&desc->lock, flags);
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800776}