blob: 9c9b573a718e091489f2d44e991e56eb09f6a597 [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 Gleixnera0cd9ca2011-02-10 11:36:33 +010022 * irq_set_chip - set the irq chip for an irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070023 * @irq: irq number
24 * @chip: pointer to irq chip description structure
25 */
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010026int irq_set_chip(unsigned int irq, struct irq_chip *chip)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070027{
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}
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010046EXPORT_SYMBOL(irq_set_chip);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070047
48/**
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010049 * irq_set_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 */
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010053int irq_set_irq_type(unsigned int irq, unsigned int type)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070054{
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 Gleixner43abe432011-02-12 12:10:49 +010068 chip_bus_lock(desc);
Thomas Gleixner239007b2009-11-17 16:46:45 +010069 raw_spin_lock_irqsave(&desc->lock, flags);
Chris Friesen0b3682ba32008-10-20 12:41:58 -060070 ret = __irq_set_trigger(desc, irq, type);
Thomas Gleixner239007b2009-11-17 16:46:45 +010071 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixner43abe432011-02-12 12:10:49 +010072 chip_bus_sync_unlock(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070073 return ret;
74}
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010075EXPORT_SYMBOL(irq_set_irq_type);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070076
77/**
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010078 * irq_set_handler_data - set irq handler data for an irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070079 * @irq: Interrupt number
80 * @data: Pointer to interrupt specific data
81 *
82 * Set the hardware irq controller data for an irq
83 */
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +010084int irq_set_handler_data(unsigned int irq, void *data)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070085{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +020086 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070087 unsigned long flags;
88
Yinghai Lu7d94f7c2008-08-19 20:50:14 -070089 if (!desc) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070090 printk(KERN_ERR
91 "Trying to install controller data for IRQ%d\n", irq);
92 return -EINVAL;
93 }
94
Thomas Gleixner239007b2009-11-17 16:46:45 +010095 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +020096 desc->irq_data.handler_data = data;
Thomas Gleixner239007b2009-11-17 16:46:45 +010097 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -070098 return 0;
99}
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100100EXPORT_SYMBOL(irq_set_handler_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700101
102/**
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100103 * irq_set_msi_desc - set MSI descriptor data for an irq
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700104 * @irq: Interrupt number
Randy Dunlap472900b2007-02-16 01:28:25 -0800105 * @entry: Pointer to MSI descriptor data
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700106 *
Liuweni24b26d42009-11-04 20:11:05 +0800107 * Set the MSI descriptor entry for an irq
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700108 */
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100109int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700110{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200111 struct irq_desc *desc = irq_to_desc(irq);
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700112 unsigned long flags;
113
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700114 if (!desc) {
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700115 printk(KERN_ERR
116 "Trying to install msi data for IRQ%d\n", irq);
117 return -EINVAL;
118 }
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700119
Thomas Gleixner239007b2009-11-17 16:46:45 +0100120 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200121 desc->irq_data.msi_desc = entry;
Michael Ellerman7fe37302007-04-18 19:39:21 +1000122 if (entry)
123 entry->irq = irq;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100124 raw_spin_unlock_irqrestore(&desc->lock, flags);
Eric W. Biederman5b912c12007-01-28 12:52:03 -0700125 return 0;
126}
127
128/**
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100129 * irq_set_chip_data - set irq chip data for an irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700130 * @irq: Interrupt number
131 * @data: Pointer to chip specific data
132 *
133 * Set the hardware irq chip data for an irq
134 */
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100135int irq_set_chip_data(unsigned int irq, void *data)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700136{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200137 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700138 unsigned long flags;
139
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700140 if (!desc) {
141 printk(KERN_ERR
142 "Trying to install chip data for IRQ%d\n", irq);
143 return -EINVAL;
144 }
145
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200146 if (!desc->irq_data.chip) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700147 printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
148 return -EINVAL;
149 }
150
Thomas Gleixner239007b2009-11-17 16:46:45 +0100151 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200152 desc->irq_data.chip_data = data;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100153 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700154
155 return 0;
156}
Thomas Gleixnera0cd9ca2011-02-10 11:36:33 +0100157EXPORT_SYMBOL(irq_set_chip_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700158
Thomas Gleixnerf303a6d2010-09-28 17:34:01 +0200159struct irq_data *irq_get_irq_data(unsigned int irq)
160{
161 struct irq_desc *desc = irq_to_desc(irq);
162
163 return desc ? &desc->irq_data : NULL;
164}
165EXPORT_SYMBOL_GPL(irq_get_irq_data);
166
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100167static void irq_state_clr_disabled(struct irq_desc *desc)
168{
169 desc->istate &= ~IRQS_DISABLED;
170 irq_compat_clr_disabled(desc);
171}
172
173static void irq_state_set_disabled(struct irq_desc *desc)
174{
175 desc->istate |= IRQS_DISABLED;
176 irq_compat_set_disabled(desc);
177}
178
Thomas Gleixner6e402622011-02-08 12:36:06 +0100179static void irq_state_clr_masked(struct irq_desc *desc)
180{
181 desc->istate &= ~IRQS_MASKED;
182 irq_compat_clr_masked(desc);
183}
184
185static void irq_state_set_masked(struct irq_desc *desc)
186{
187 desc->istate |= IRQS_MASKED;
188 irq_compat_set_masked(desc);
189}
190
Thomas Gleixner46999232011-02-02 21:41:14 +0000191int irq_startup(struct irq_desc *desc)
192{
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100193 irq_state_clr_disabled(desc);
Thomas Gleixner46999232011-02-02 21:41:14 +0000194 desc->depth = 0;
195
Thomas Gleixner3aae9942011-02-04 10:17:52 +0100196 if (desc->irq_data.chip->irq_startup) {
197 int ret = desc->irq_data.chip->irq_startup(&desc->irq_data);
Thomas Gleixner6e402622011-02-08 12:36:06 +0100198 irq_state_clr_masked(desc);
Thomas Gleixner3aae9942011-02-04 10:17:52 +0100199 return ret;
200 }
Thomas Gleixner46999232011-02-02 21:41:14 +0000201
Thomas Gleixner87923472011-02-03 12:27:44 +0100202 irq_enable(desc);
Thomas Gleixner46999232011-02-02 21:41:14 +0000203 return 0;
204}
205
206void irq_shutdown(struct irq_desc *desc)
207{
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100208 irq_state_set_disabled(desc);
Thomas Gleixner46999232011-02-02 21:41:14 +0000209 desc->depth = 1;
Thomas Gleixner50f7c032011-02-03 13:23:54 +0100210 if (desc->irq_data.chip->irq_shutdown)
211 desc->irq_data.chip->irq_shutdown(&desc->irq_data);
212 if (desc->irq_data.chip->irq_disable)
213 desc->irq_data.chip->irq_disable(&desc->irq_data);
214 else
215 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner6e402622011-02-08 12:36:06 +0100216 irq_state_set_masked(desc);
Thomas Gleixner46999232011-02-02 21:41:14 +0000217}
218
Thomas Gleixner87923472011-02-03 12:27:44 +0100219void irq_enable(struct irq_desc *desc)
220{
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100221 irq_state_clr_disabled(desc);
Thomas Gleixner50f7c032011-02-03 13:23:54 +0100222 if (desc->irq_data.chip->irq_enable)
223 desc->irq_data.chip->irq_enable(&desc->irq_data);
224 else
225 desc->irq_data.chip->irq_unmask(&desc->irq_data);
Thomas Gleixner6e402622011-02-08 12:36:06 +0100226 irq_state_clr_masked(desc);
Thomas Gleixner87923472011-02-03 12:27:44 +0100227}
228
229void irq_disable(struct irq_desc *desc)
230{
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100231 irq_state_set_disabled(desc);
Thomas Gleixner50f7c032011-02-03 13:23:54 +0100232 if (desc->irq_data.chip->irq_disable) {
233 desc->irq_data.chip->irq_disable(&desc->irq_data);
Thomas Gleixner50f7c032011-02-03 13:23:54 +0100234 }
Thomas Gleixner6e402622011-02-08 12:36:06 +0100235 irq_state_set_masked(desc);
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100236}
237
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200238#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000239/* Temporary migration helpers */
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000240static void compat_irq_mask(struct irq_data *data)
241{
242 data->chip->mask(data->irq);
243}
244
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000245static void compat_irq_unmask(struct irq_data *data)
246{
247 data->chip->unmask(data->irq);
248}
249
Thomas Gleixner22a49162010-09-27 12:44:47 +0000250static void compat_irq_ack(struct irq_data *data)
251{
252 data->chip->ack(data->irq);
253}
254
Thomas Gleixner9205e312010-09-27 12:44:50 +0000255static void compat_irq_mask_ack(struct irq_data *data)
256{
257 data->chip->mask_ack(data->irq);
258}
259
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000260static void compat_irq_eoi(struct irq_data *data)
261{
262 data->chip->eoi(data->irq);
263}
264
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000265static void compat_irq_enable(struct irq_data *data)
266{
267 data->chip->enable(data->irq);
268}
269
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000270static void compat_irq_disable(struct irq_data *data)
271{
272 data->chip->disable(data->irq);
273}
274
275static void compat_irq_shutdown(struct irq_data *data)
276{
277 data->chip->shutdown(data->irq);
278}
279
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000280static unsigned int compat_irq_startup(struct irq_data *data)
281{
282 return data->chip->startup(data->irq);
283}
284
Thomas Gleixnerc96b3b32010-09-27 12:45:41 +0000285static int compat_irq_set_affinity(struct irq_data *data,
286 const struct cpumask *dest, bool force)
287{
288 return data->chip->set_affinity(data->irq, dest);
289}
290
Thomas Gleixnerb2ba2c32010-09-27 12:45:47 +0000291static int compat_irq_set_type(struct irq_data *data, unsigned int type)
292{
293 return data->chip->set_type(data->irq, type);
294}
295
Thomas Gleixner2f7e99b2010-09-27 12:45:50 +0000296static int compat_irq_set_wake(struct irq_data *data, unsigned int on)
297{
298 return data->chip->set_wake(data->irq, on);
299}
300
Thomas Gleixner21e2b8c2010-09-27 12:45:53 +0000301static int compat_irq_retrigger(struct irq_data *data)
302{
303 return data->chip->retrigger(data->irq);
304}
305
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000306static void compat_bus_lock(struct irq_data *data)
307{
308 data->chip->bus_lock(data->irq);
309}
310
311static void compat_bus_sync_unlock(struct irq_data *data)
312{
313 data->chip->bus_sync_unlock(data->irq);
314}
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200315#endif
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000316
Thomas Gleixner89d694b2008-02-18 18:25:17 +0100317/*
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700318 * Fixup enable/disable function pointers
319 */
320void irq_chip_set_defaults(struct irq_chip *chip)
321{
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200322#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
Thomas Gleixnerc5f75632010-09-27 12:44:56 +0000323 if (chip->enable)
324 chip->irq_enable = compat_irq_enable;
Thomas Gleixnerbc310dd2010-09-27 12:45:02 +0000325 if (chip->disable)
326 chip->irq_disable = compat_irq_disable;
327 if (chip->shutdown)
328 chip->irq_shutdown = compat_irq_shutdown;
Thomas Gleixner37e12df2010-09-27 12:45:38 +0000329 if (chip->startup)
330 chip->irq_startup = compat_irq_startup;
Zhang, Yanminb86432b2006-11-16 01:19:10 -0800331 if (!chip->end)
332 chip->end = dummy_irq_chip.end;
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000333 if (chip->bus_lock)
334 chip->irq_bus_lock = compat_bus_lock;
335 if (chip->bus_sync_unlock)
336 chip->irq_bus_sync_unlock = compat_bus_sync_unlock;
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000337 if (chip->mask)
338 chip->irq_mask = compat_irq_mask;
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000339 if (chip->unmask)
340 chip->irq_unmask = compat_irq_unmask;
Thomas Gleixner22a49162010-09-27 12:44:47 +0000341 if (chip->ack)
342 chip->irq_ack = compat_irq_ack;
Thomas Gleixner9205e312010-09-27 12:44:50 +0000343 if (chip->mask_ack)
344 chip->irq_mask_ack = compat_irq_mask_ack;
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000345 if (chip->eoi)
346 chip->irq_eoi = compat_irq_eoi;
Thomas Gleixnerc96b3b32010-09-27 12:45:41 +0000347 if (chip->set_affinity)
348 chip->irq_set_affinity = compat_irq_set_affinity;
Thomas Gleixnerb2ba2c32010-09-27 12:45:47 +0000349 if (chip->set_type)
350 chip->irq_set_type = compat_irq_set_type;
Thomas Gleixner2f7e99b2010-09-27 12:45:50 +0000351 if (chip->set_wake)
352 chip->irq_set_wake = compat_irq_set_wake;
Thomas Gleixner21e2b8c2010-09-27 12:45:53 +0000353 if (chip->retrigger)
354 chip->irq_retrigger = compat_irq_retrigger;
Thomas Gleixnerbd151412010-10-01 15:17:14 +0200355#endif
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700356}
357
Thomas Gleixner9205e312010-09-27 12:44:50 +0000358static inline void mask_ack_irq(struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700359{
Thomas Gleixner9205e312010-09-27 12:44:50 +0000360 if (desc->irq_data.chip->irq_mask_ack)
361 desc->irq_data.chip->irq_mask_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700362 else {
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000363 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner22a49162010-09-27 12:44:47 +0000364 if (desc->irq_data.chip->irq_ack)
365 desc->irq_data.chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700366 }
Thomas Gleixner6e402622011-02-08 12:36:06 +0100367 irq_state_set_masked(desc);
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100368}
369
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000370static inline void mask_irq(struct irq_desc *desc)
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100371{
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000372 if (desc->irq_data.chip->irq_mask) {
373 desc->irq_data.chip->irq_mask(&desc->irq_data);
Thomas Gleixner6e402622011-02-08 12:36:06 +0100374 irq_state_set_masked(desc);
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100375 }
376}
377
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000378static inline void unmask_irq(struct irq_desc *desc)
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100379{
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000380 if (desc->irq_data.chip->irq_unmask) {
381 desc->irq_data.chip->irq_unmask(&desc->irq_data);
Thomas Gleixner6e402622011-02-08 12:36:06 +0100382 irq_state_clr_masked(desc);
Thomas Gleixner0b1adaa2010-03-09 19:45:54 +0100383 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700384}
385
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200386/*
387 * handle_nested_irq - Handle a nested irq from a irq thread
388 * @irq: the interrupt number
389 *
390 * Handle interrupts which are nested into a threaded interrupt
391 * handler. The handler function is called inside the calling
392 * threads context.
393 */
394void handle_nested_irq(unsigned int irq)
395{
396 struct irq_desc *desc = irq_to_desc(irq);
397 struct irqaction *action;
398 irqreturn_t action_ret;
399
400 might_sleep();
401
Thomas Gleixner239007b2009-11-17 16:46:45 +0100402 raw_spin_lock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200403
404 kstat_incr_irqs_this_cpu(irq, desc);
405
406 action = desc->action;
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100407 if (unlikely(!action || (desc->istate & IRQS_DISABLED)))
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200408 goto out_unlock;
409
Thomas Gleixner009b4c32011-02-07 21:48:49 +0100410 irq_compat_set_progress(desc);
411 desc->istate |= IRQS_INPROGRESS;
Thomas Gleixner239007b2009-11-17 16:46:45 +0100412 raw_spin_unlock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200413
414 action_ret = action->thread_fn(action->irq, action->dev_id);
415 if (!noirqdebug)
416 note_interrupt(irq, desc, action_ret);
417
Thomas Gleixner239007b2009-11-17 16:46:45 +0100418 raw_spin_lock_irq(&desc->lock);
Thomas Gleixner009b4c32011-02-07 21:48:49 +0100419 desc->istate &= ~IRQS_INPROGRESS;
420 irq_compat_clr_progress(desc);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200421
422out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100423 raw_spin_unlock_irq(&desc->lock);
Thomas Gleixner399b5da2009-08-13 13:21:38 +0200424}
425EXPORT_SYMBOL_GPL(handle_nested_irq);
426
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100427static bool irq_check_poll(struct irq_desc *desc)
428{
Thomas Gleixner6954b752011-02-07 20:55:35 +0100429 if (!(desc->istate & IRQS_POLL_INPROGRESS))
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100430 return false;
431 return irq_wait_for_poll(desc);
432}
433
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700434/**
435 * handle_simple_irq - Simple and software-decoded IRQs.
436 * @irq: the interrupt number
437 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700438 *
439 * Simple interrupts are either sent from a demultiplexing interrupt
440 * handler or come from hardware, where no interrupt hardware control
441 * is necessary.
442 *
443 * Note: The caller is expected to handle the ack, clear, mask and
444 * unmask issues if necessary.
445 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800446void
David Howells7d12e782006-10-05 14:55:46 +0100447handle_simple_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700448{
Thomas Gleixner239007b2009-11-17 16:46:45 +0100449 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700450
Thomas Gleixner009b4c32011-02-07 21:48:49 +0100451 if (unlikely(desc->istate & IRQS_INPROGRESS))
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100452 if (!irq_check_poll(desc))
453 goto out_unlock;
454
Thomas Gleixner163ef302011-02-08 11:39:15 +0100455 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200456 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700457
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100458 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700459 goto out_unlock;
460
Thomas Gleixner107781e2011-02-07 01:21:02 +0100461 handle_irq_event(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700462
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700463out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100464 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700465}
466
467/**
468 * handle_level_irq - Level type irq handler
469 * @irq: the interrupt number
470 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700471 *
472 * Level type interrupts are active as long as the hardware line has
473 * the active level. This may require to mask the interrupt and unmask
474 * it after the associated handler has acknowledged the device, so the
475 * interrupt line is back to inactive.
476 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800477void
David Howells7d12e782006-10-05 14:55:46 +0100478handle_level_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700479{
Thomas Gleixner239007b2009-11-17 16:46:45 +0100480 raw_spin_lock(&desc->lock);
Thomas Gleixner9205e312010-09-27 12:44:50 +0000481 mask_ack_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700482
Thomas Gleixner009b4c32011-02-07 21:48:49 +0100483 if (unlikely(desc->istate & IRQS_INPROGRESS))
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100484 if (!irq_check_poll(desc))
485 goto out_unlock;
486
Thomas Gleixner163ef302011-02-08 11:39:15 +0100487 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200488 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700489
490 /*
491 * If its disabled or no action available
492 * keep it masked and get out of here
493 */
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100494 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
Ingo Molnar86998aa2006-09-19 11:14:34 +0200495 goto out_unlock;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700496
Thomas Gleixner15298662011-02-07 01:22:17 +0100497 handle_irq_event(desc);
Thomas Gleixnerb25c3402009-08-13 12:17:22 +0200498
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100499 if (!(desc->istate & (IRQS_DISABLED | IRQS_ONESHOT)))
Thomas Gleixner0eda58b2010-09-27 12:44:44 +0000500 unmask_irq(desc);
Ingo Molnar86998aa2006-09-19 11:14:34 +0200501out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100502 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700503}
Ingo Molnar14819ea2009-01-14 12:34:21 +0100504EXPORT_SYMBOL_GPL(handle_level_irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700505
506/**
Ingo Molnar47c2a3a2006-06-29 02:25:03 -0700507 * handle_fasteoi_irq - irq handler for transparent controllers
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700508 * @irq: the interrupt number
509 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700510 *
Ingo Molnar47c2a3a2006-06-29 02:25:03 -0700511 * Only a single callback will be issued to the chip: an ->eoi()
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700512 * call when the interrupt has been serviced. This enables support
513 * for modern forms of interrupt handlers, which handle the flow
514 * details in hardware, transparently.
515 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800516void
David Howells7d12e782006-10-05 14:55:46 +0100517handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700518{
Thomas Gleixner239007b2009-11-17 16:46:45 +0100519 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700520
Thomas Gleixner009b4c32011-02-07 21:48:49 +0100521 if (unlikely(desc->istate & IRQS_INPROGRESS))
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100522 if (!irq_check_poll(desc))
523 goto out;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700524
Thomas Gleixner163ef302011-02-08 11:39:15 +0100525 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200526 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700527
528 /*
529 * If its disabled or no action available
Ingo Molnar76d21602007-02-16 01:28:24 -0800530 * then mask it and get out of here:
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700531 */
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100532 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +0100533 irq_compat_set_pending(desc);
534 desc->istate |= IRQS_PENDING;
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000535 mask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700536 goto out;
Benjamin Herrenschmidt98bb2442006-06-29 02:25:01 -0700537 }
Thomas Gleixnera7ae4de2011-02-07 01:23:07 +0100538 handle_irq_event(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700539out:
Thomas Gleixner0c5c1552010-09-27 12:44:53 +0000540 desc->irq_data.chip->irq_eoi(&desc->irq_data);
Thomas Gleixner239007b2009-11-17 16:46:45 +0100541 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700542}
543
544/**
545 * handle_edge_irq - edge type IRQ handler
546 * @irq: the interrupt number
547 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700548 *
549 * Interrupt occures on the falling and/or rising edge of a hardware
550 * signal. The occurence is latched into the irq controller hardware
551 * and must be acked in order to be reenabled. After the ack another
552 * interrupt can happen on the same source even before the first one
Uwe Kleine-Königdfff0612010-02-12 21:58:11 +0100553 * is handled by the associated event handler. If this happens it
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700554 * might be necessary to disable (mask) the interrupt depending on the
555 * controller hardware. This requires to reenable the interrupt inside
556 * of the loop which handles the interrupts which have arrived while
557 * the handler was running. If all pending interrupts are handled, the
558 * loop is left.
559 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800560void
David Howells7d12e782006-10-05 14:55:46 +0100561handle_edge_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700562{
Thomas Gleixner239007b2009-11-17 16:46:45 +0100563 raw_spin_lock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700564
Thomas Gleixner163ef302011-02-08 11:39:15 +0100565 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700566 /*
567 * If we're currently running this IRQ, or its disabled,
568 * we shouldn't process the IRQ. Mark it pending, handle
569 * the necessary masking and go out
570 */
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100571 if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
572 !desc->action))) {
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100573 if (!irq_check_poll(desc)) {
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +0100574 irq_compat_set_pending(desc);
575 desc->istate |= IRQS_PENDING;
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100576 mask_ack_irq(desc);
577 goto out_unlock;
578 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700579 }
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200580 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700581
582 /* Start handling the irq */
Thomas Gleixner22a49162010-09-27 12:44:47 +0000583 desc->irq_data.chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700584
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700585 do {
Thomas Gleixnera60a5dc2011-02-07 01:24:07 +0100586 if (unlikely(!desc->action)) {
Thomas Gleixnere2c0f8f2010-09-27 12:44:42 +0000587 mask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700588 goto out_unlock;
589 }
590
591 /*
592 * When another irq arrived while we were handling
593 * one, we could have masked the irq.
594 * Renable it, if it was not disabled in meantime.
595 */
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +0100596 if (unlikely(desc->istate & IRQS_PENDING)) {
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100597 if (!(desc->istate & IRQS_DISABLED) &&
Thomas Gleixner6e402622011-02-08 12:36:06 +0100598 (desc->istate & IRQS_MASKED))
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100599 unmask_irq(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700600 }
601
Thomas Gleixnera60a5dc2011-02-07 01:24:07 +0100602 handle_irq_event(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700603
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +0100604 } while ((desc->istate & IRQS_PENDING) &&
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100605 !(desc->istate & IRQS_DISABLED));
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700606
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700607out_unlock:
Thomas Gleixner239007b2009-11-17 16:46:45 +0100608 raw_spin_unlock(&desc->lock);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700609}
610
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700611/**
Liuweni24b26d42009-11-04 20:11:05 +0800612 * handle_percpu_irq - Per CPU local irq handler
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700613 * @irq: the interrupt number
614 * @desc: the interrupt description structure for this irq
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700615 *
616 * Per CPU interrupts on SMP machines without locking requirements
617 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800618void
David Howells7d12e782006-10-05 14:55:46 +0100619handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700620{
Thomas Gleixner35e857c2011-02-10 12:20:23 +0100621 struct irq_chip *chip = irq_desc_get_chip(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700622
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200623 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700624
Thomas Gleixner849f0612011-02-07 01:25:41 +0100625 if (chip->irq_ack)
626 chip->irq_ack(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700627
Thomas Gleixner849f0612011-02-07 01:25:41 +0100628 handle_irq_event_percpu(desc, desc->action);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700629
Thomas Gleixner849f0612011-02-07 01:25:41 +0100630 if (chip->irq_eoi)
631 chip->irq_eoi(&desc->irq_data);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700632}
633
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700634void
Ingo Molnara460e742006-10-17 00:10:03 -0700635__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
636 const char *name)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700637{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200638 struct irq_desc *desc = irq_to_desc(irq);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700639 unsigned long flags;
640
Yinghai Lu7d94f7c2008-08-19 20:50:14 -0700641 if (!desc) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700642 printk(KERN_ERR
643 "Trying to install type control for IRQ%d\n", irq);
644 return;
645 }
646
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700647 if (!handle)
648 handle = handle_bad_irq;
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200649 else if (desc->irq_data.chip == &no_irq_chip) {
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100650 printk(KERN_WARNING "Trying to install %sinterrupt handler "
Geert Uytterhoevenb039db82006-12-20 15:59:48 +0100651 "for IRQ%d\n", is_chained ? "chained " : "", irq);
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100652 /*
653 * Some ARM implementations install a handler for really dumb
654 * interrupt hardware without setting an irq_chip. This worked
655 * with the ARM no_irq_chip but the check in setup_irq would
656 * prevent us to setup the interrupt at all. Switch it to
657 * dummy_irq_chip for easy transition.
658 */
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200659 desc->irq_data.chip = &dummy_irq_chip;
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100660 }
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700661
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000662 chip_bus_lock(desc);
Thomas Gleixner239007b2009-11-17 16:46:45 +0100663 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700664
665 /* Uninstall? */
666 if (handle == handle_bad_irq) {
Thomas Gleixner6b8ff312010-10-01 12:58:38 +0200667 if (desc->irq_data.chip != &no_irq_chip)
Thomas Gleixner9205e312010-09-27 12:44:50 +0000668 mask_ack_irq(desc);
Thomas Gleixnerc1594b72011-02-07 22:11:30 +0100669 irq_compat_set_disabled(desc);
670 desc->istate |= IRQS_DISABLED;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700671 desc->depth = 1;
672 }
673 desc->handle_irq = handle;
Ingo Molnara460e742006-10-17 00:10:03 -0700674 desc->name = name;
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700675
676 if (handle != handle_bad_irq && is_chained) {
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700677 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
Thomas Gleixner46999232011-02-02 21:41:14 +0000678 irq_startup(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700679 }
Thomas Gleixner239007b2009-11-17 16:46:45 +0100680 raw_spin_unlock_irqrestore(&desc->lock, flags);
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000681 chip_bus_sync_unlock(desc);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700682}
Ingo Molnar14819ea2009-01-14 12:34:21 +0100683EXPORT_SYMBOL_GPL(__set_irq_handler);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700684
685void
686set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
David Howells57a58a92006-10-05 13:06:34 +0100687 irq_flow_handler_t handle)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700688{
Thomas Gleixner35e857c2011-02-10 12:20:23 +0100689 irq_set_chip(irq, chip);
Ingo Molnara460e742006-10-17 00:10:03 -0700690 __set_irq_handler(irq, handle, 0, NULL);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700691}
692
Ingo Molnara460e742006-10-17 00:10:03 -0700693void
694set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
695 irq_flow_handler_t handle, const char *name)
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700696{
Thomas Gleixner35e857c2011-02-10 12:20:23 +0100697 irq_set_chip(irq, chip);
Ingo Molnara460e742006-10-17 00:10:03 -0700698 __set_irq_handler(irq, handle, 0, name);
Thomas Gleixnerdd87eb32006-06-29 02:24:53 -0700699}
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800700
Thomas Gleixner44247182010-09-28 10:40:18 +0200701void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800702{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200703 struct irq_desc *desc = irq_to_desc(irq);
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800704 unsigned long flags;
705
Thomas Gleixner44247182010-09-28 10:40:18 +0200706 if (!desc)
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800707 return;
Thomas Gleixner44247182010-09-28 10:40:18 +0200708
Thomas Gleixner239007b2009-11-17 16:46:45 +0100709 raw_spin_lock_irqsave(&desc->lock, flags);
Thomas Gleixnera0056772011-02-08 17:11:03 +0100710
711 irq_settings_clr_and_set(desc, clr, set);
712
Thomas Gleixner876dbd42011-02-08 17:28:12 +0100713 irqd_clear(&desc->irq_data, IRQD_NO_BALANCING | IRQD_PER_CPU |
714 IRQD_TRIGGER_MASK | IRQD_LEVEL);
Thomas Gleixnera0056772011-02-08 17:11:03 +0100715 if (irq_settings_has_no_balance_set(desc))
716 irqd_set(&desc->irq_data, IRQD_NO_BALANCING);
717 if (irq_settings_is_per_cpu(desc))
718 irqd_set(&desc->irq_data, IRQD_PER_CPU);
719
Thomas Gleixner876dbd42011-02-08 17:28:12 +0100720 irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
721
Thomas Gleixner239007b2009-11-17 16:46:45 +0100722 raw_spin_unlock_irqrestore(&desc->lock, flags);
Ralf Baechle46f4f8f2008-02-08 04:22:01 -0800723}