blob: b95b74920433415c28cdf2a88f962aef1fb74c4f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IRQ subsystem internal functions and variables:
Thomas Gleixnerdbec07b2011-02-07 20:19:55 +01003 *
4 * Do not ever include this file from anything else than
5 * kernel/irq/. Do not even think about using any information outside
6 * of this file for your non core code.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
Thomas Gleixnere1447102010-10-01 16:03:45 +02008#include <linux/irqdesc.h>
Thomas Gleixner8f945a32014-02-23 21:40:23 +00009#include <linux/kernel_stat.h>
Jon Hunterbe45beb2016-06-07 16:12:29 +010010#include <linux/pm_runtime.h>
Daniel Lezcanob2d3d612017-06-23 16:11:07 +020011#include <linux/sched/clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Thomas Gleixnerc1ee6262011-02-17 17:45:15 +010013#ifdef CONFIG_SPARSE_IRQ
14# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
15#else
16# define IRQ_BITMAP_BITS NR_IRQS
17#endif
18
Thomas Gleixnerdbec07b2011-02-07 20:19:55 +010019#define istate core_internal_state__do_not_mess_with_it
20
Rusty Russell2329abf2012-01-13 09:32:18 +103021extern bool noirqdebug;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Mika Westerberge509bd72015-10-05 13:12:15 +030023extern struct irqaction chained_action;
24
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010025/*
26 * Bits used by threaded handlers:
27 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010028 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
29 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
Thomas Gleixner8d32a302011-02-23 23:52:23 +000030 * IRQTF_FORCED_THREAD - irq action is force threaded
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010031 */
32enum {
33 IRQTF_RUNTHREAD,
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010034 IRQTF_WARNED,
35 IRQTF_AFFINITY,
Thomas Gleixner8d32a302011-02-23 23:52:23 +000036 IRQTF_FORCED_THREAD,
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010037};
38
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010039/*
Jiang Liua2579542014-05-27 16:07:37 +080040 * Bit masks for desc->core_internal_state__do_not_mess_with_it
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010041 *
42 * IRQS_AUTODETECT - autodetection in progress
Thomas Gleixner7acdd532011-02-07 20:40:54 +010043 * IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
44 * detection
Thomas Gleixner6954b752011-02-07 20:55:35 +010045 * IRQS_POLL_INPROGRESS - polling in progress
Thomas Gleixner3d67bae2011-02-07 21:02:10 +010046 * IRQS_ONESHOT - irq is not unmasked in primary handler
Thomas Gleixner163ef302011-02-08 11:39:15 +010047 * IRQS_REPLAY - irq is replayed
48 * IRQS_WAITING - irq is waiting
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +010049 * IRQS_PENDING - irq is pending and replayed later
Thomas Gleixnerc531e832011-02-08 12:44:58 +010050 * IRQS_SUSPENDED - irq is suspended
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010051 */
52enum {
53 IRQS_AUTODETECT = 0x00000001,
Thomas Gleixner7acdd532011-02-07 20:40:54 +010054 IRQS_SPURIOUS_DISABLED = 0x00000002,
Thomas Gleixner6954b752011-02-07 20:55:35 +010055 IRQS_POLL_INPROGRESS = 0x00000008,
Thomas Gleixner3d67bae2011-02-07 21:02:10 +010056 IRQS_ONESHOT = 0x00000020,
Thomas Gleixner163ef302011-02-08 11:39:15 +010057 IRQS_REPLAY = 0x00000040,
58 IRQS_WAITING = 0x00000080,
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +010059 IRQS_PENDING = 0x00000200,
Thomas Gleixnerc531e832011-02-08 12:44:58 +010060 IRQS_SUSPENDED = 0x00000800,
Daniel Lezcanob2d3d612017-06-23 16:11:07 +020061 IRQS_TIMINGS = 0x00001000,
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010062};
63
Thomas Gleixner1ce60682011-02-09 20:44:21 +010064#include "debug.h"
65#include "settings.h"
66
Jiang Liua1ff5412015-06-23 19:47:29 +020067extern int __irq_set_trigger(struct irq_desc *desc, unsigned long flags);
Jiang Liu79ff1cd2015-06-23 19:52:36 +020068extern void __disable_irq(struct irq_desc *desc);
69extern void __enable_irq(struct irq_desc *desc);
David Brownell0c5d1eb2008-10-01 14:46:18 -070070
Thomas Gleixner4cde9c62017-06-20 01:37:49 +020071#define IRQ_RESEND true
72#define IRQ_NORESEND false
73
74#define IRQ_START_FORCE true
75#define IRQ_START_COND false
76
77extern int irq_startup(struct irq_desc *desc, bool resend, bool force);
78
Thomas Gleixner46999232011-02-02 21:41:14 +000079extern void irq_shutdown(struct irq_desc *desc);
Thomas Gleixner87923472011-02-03 12:27:44 +010080extern void irq_enable(struct irq_desc *desc);
81extern void irq_disable(struct irq_desc *desc);
Marc Zyngier31d9d9b2011-09-23 17:03:06 +010082extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
83extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
Thomas Gleixnerd4d5e082011-02-10 13:16:14 +010084extern void mask_irq(struct irq_desc *desc);
85extern void unmask_irq(struct irq_desc *desc);
Thomas Gleixner328a4972014-03-13 19:03:51 +010086extern void unmask_threaded_irq(struct irq_desc *desc);
Thomas Gleixner46999232011-02-02 21:41:14 +000087
Thomas Gleixnerf63b6a02014-05-07 15:44:21 +000088#ifdef CONFIG_SPARSE_IRQ
89static inline void irq_mark_irq(unsigned int irq) { }
90#else
91extern void irq_mark_irq(unsigned int irq);
92#endif
93
Yinghai Lu85ac16d2009-04-27 18:00:38 -070094extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
Mike Travis0fa0ebb2009-01-10 22:24:06 -080095
Keith Buschedd14cf2016-06-17 16:00:20 -060096irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags);
Huang Shijie71f64342015-09-02 10:24:55 +080097irqreturn_t handle_irq_event_percpu(struct irq_desc *desc);
Thomas Gleixner49126092011-02-07 01:08:49 +010098irqreturn_t handle_irq_event(struct irq_desc *desc);
99
Thomas Gleixnere1447102010-10-01 16:03:45 +0200100/* Resending of interrupts :*/
Jiang Liu0798abe2015-06-04 12:13:27 +0800101void check_irq_resend(struct irq_desc *desc);
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100102bool irq_wait_for_poll(struct irq_desc *desc);
Thomas Gleixnera92444c2014-02-15 00:55:19 +0000103void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
Thomas Gleixnere1447102010-10-01 16:03:45 +0200104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105#ifdef CONFIG_PROC_FS
Yinghai Lu2c6927a2008-08-19 20:50:11 -0700106extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
Thomas Gleixner13bfe992010-09-30 02:46:07 +0200107extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108extern void register_handler_proc(unsigned int irq, struct irqaction *action);
109extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
110#else
Yinghai Lu2c6927a2008-08-19 20:50:11 -0700111static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Thomas Gleixner13bfe992010-09-30 02:46:07 +0200112static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113static inline void register_handler_proc(unsigned int irq,
114 struct irqaction *action) { }
115static inline void unregister_handler_proc(unsigned int irq,
116 struct irqaction *action) { }
117#endif
118
Thomas Gleixner9c255582016-07-04 17:39:23 +0900119extern bool irq_can_set_affinity_usr(unsigned int irq);
120
Thomas Gleixnercba42352017-06-20 01:37:21 +0200121extern int irq_select_affinity_usr(unsigned int irq);
Thomas Gleixnerf6d87f42008-11-07 13:18:30 +0100122
Thomas Gleixner591d2fb2009-07-21 11:09:39 +0200123extern void irq_set_thread_affinity(struct irq_desc *desc);
Yinghai Lu57b150c2009-04-27 17:59:53 -0700124
Jiang Liu818b0f32012-03-30 23:11:34 +0800125extern int irq_do_set_affinity(struct irq_data *data,
126 const struct cpumask *dest, bool force);
127
Thomas Gleixner43564bd2017-06-20 01:37:22 +0200128#ifdef CONFIG_SMP
129extern int irq_setup_affinity(struct irq_desc *desc);
130#else
131static inline int irq_setup_affinity(struct irq_desc *desc) { return 0; }
132#endif
133
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200134/* Inline functions for support of irq chips on slow busses */
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000135static inline void chip_bus_lock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200136{
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000137 if (unlikely(desc->irq_data.chip->irq_bus_lock))
138 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200139}
140
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000141static inline void chip_bus_sync_unlock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200142{
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000143 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
144 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200145}
146
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100147#define _IRQ_DESC_CHECK (1 << 0)
148#define _IRQ_DESC_PERCPU (1 << 1)
149
150#define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK)
151#define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU)
152
Daniel Lezcanof944b5a2016-01-14 10:54:13 +0100153#define for_each_action_of_desc(desc, act) \
154 for (act = desc->act; act; act = act->next)
155
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100156struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100157__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
158 unsigned int check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100159void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus);
160
161static inline struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100162irq_get_desc_buslock(unsigned int irq, unsigned long *flags, unsigned int check)
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100163{
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100164 return __irq_get_desc_lock(irq, flags, true, check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100165}
166
167static inline void
168irq_put_desc_busunlock(struct irq_desc *desc, unsigned long flags)
169{
170 __irq_put_desc_unlock(desc, flags, true);
171}
172
173static inline struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100174irq_get_desc_lock(unsigned int irq, unsigned long *flags, unsigned int check)
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100175{
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100176 return __irq_get_desc_lock(irq, flags, false, check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100177}
178
179static inline void
180irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags)
181{
182 __irq_put_desc_unlock(desc, flags, false);
183}
184
Boqun Fengb3542862015-12-29 12:18:48 +0800185#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
186
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200187static inline unsigned int irqd_get(struct irq_data *d)
188{
189 return __irqd_to_state(d);
190}
191
Ingo Molnar43f77752006-06-29 02:24:58 -0700192/*
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100193 * Manipulation functions for irq_data.state
194 */
195static inline void irqd_set_move_pending(struct irq_data *d)
196{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800197 __irqd_to_state(d) |= IRQD_SETAFFINITY_PENDING;
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100198}
199
200static inline void irqd_clr_move_pending(struct irq_data *d)
201{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800202 __irqd_to_state(d) &= ~IRQD_SETAFFINITY_PENDING;
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100203}
Thomas Gleixnera0056772011-02-08 17:11:03 +0100204
Thomas Gleixner54fdf6a2017-06-20 01:37:47 +0200205static inline void irqd_set_managed_shutdown(struct irq_data *d)
206{
207 __irqd_to_state(d) |= IRQD_MANAGED_SHUTDOWN;
208}
209
210static inline void irqd_clr_managed_shutdown(struct irq_data *d)
211{
212 __irqd_to_state(d) &= ~IRQD_MANAGED_SHUTDOWN;
213}
214
Thomas Gleixnera0056772011-02-08 17:11:03 +0100215static inline void irqd_clear(struct irq_data *d, unsigned int mask)
216{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800217 __irqd_to_state(d) &= ~mask;
Thomas Gleixnera0056772011-02-08 17:11:03 +0100218}
219
220static inline void irqd_set(struct irq_data *d, unsigned int mask)
221{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800222 __irqd_to_state(d) |= mask;
Thomas Gleixnera0056772011-02-08 17:11:03 +0100223}
224
Thomas Gleixner2bdd1052011-02-08 17:22:00 +0100225static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
226{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800227 return __irqd_to_state(d) & mask;
Thomas Gleixner2bdd1052011-02-08 17:22:00 +0100228}
Thomas Gleixner8f945a32014-02-23 21:40:23 +0000229
Boqun Fengb3542862015-12-29 12:18:48 +0800230#undef __irqd_to_state
231
Jiang Liub51bf952015-06-04 12:13:25 +0800232static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
Thomas Gleixner8f945a32014-02-23 21:40:23 +0000233{
234 __this_cpu_inc(*desc->kstat_irqs);
235 __this_cpu_inc(kstat.irqs_sum);
236}
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200237
Jiang Liu67830112015-06-01 16:05:13 +0800238static inline int irq_desc_get_node(struct irq_desc *desc)
239{
Jiang Liu449e9ca2015-06-01 16:05:16 +0800240 return irq_common_data_get_node(&desc->irq_common_data);
Jiang Liu67830112015-06-01 16:05:13 +0800241}
242
Grygorii Strashko4717f132015-11-10 11:58:12 +0200243static inline int irq_desc_is_chained(struct irq_desc *desc)
244{
245 return (desc->action && desc->action == &chained_action);
246}
247
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200248#ifdef CONFIG_PM_SLEEP
Thomas Gleixner9ce7a252014-08-29 14:00:16 +0200249bool irq_pm_check_wakeup(struct irq_desc *desc);
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200250void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action);
251void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action);
252#else
Thomas Gleixner9ce7a252014-08-29 14:00:16 +0200253static inline bool irq_pm_check_wakeup(struct irq_desc *desc) { return false; }
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200254static inline void
255irq_pm_install_action(struct irq_desc *desc, struct irqaction *action) { }
256static inline void
257irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action) { }
258#endif
Bartosz Golaszewskif1602032017-05-31 18:06:58 +0200259
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200260#ifdef CONFIG_IRQ_TIMINGS
261
262#define IRQ_TIMINGS_SHIFT 5
263#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT)
264#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1)
265
266/**
267 * struct irq_timings - irq timings storing structure
268 * @values: a circular buffer of u64 encoded <timestamp,irq> values
269 * @count: the number of elements in the array
270 */
271struct irq_timings {
272 u64 values[IRQ_TIMINGS_SIZE];
273 int count;
274};
275
276DECLARE_PER_CPU(struct irq_timings, irq_timings);
277
278static inline void irq_remove_timings(struct irq_desc *desc)
279{
280 desc->istate &= ~IRQS_TIMINGS;
281}
282
283static inline void irq_setup_timings(struct irq_desc *desc, struct irqaction *act)
284{
285 /*
286 * We don't need the measurement because the idle code already
287 * knows the next expiry event.
288 */
289 if (act->flags & __IRQF_TIMER)
290 return;
291
292 desc->istate |= IRQS_TIMINGS;
293}
294
295extern void irq_timings_enable(void);
296extern void irq_timings_disable(void);
297
298DECLARE_STATIC_KEY_FALSE(irq_timing_enabled);
299
300/*
301 * The interrupt number and the timestamp are encoded into a single
302 * u64 variable to optimize the size.
303 * 48 bit time stamp and 16 bit IRQ number is way sufficient.
304 * Who cares an IRQ after 78 hours of idle time?
305 */
306static inline u64 irq_timing_encode(u64 timestamp, int irq)
307{
308 return (timestamp << 16) | irq;
309}
310
311static inline int irq_timing_decode(u64 value, u64 *timestamp)
312{
313 *timestamp = value >> 16;
314 return value & U16_MAX;
315}
316
317/*
318 * The function record_irq_time is only called in one place in the
319 * interrupts handler. We want this function always inline so the code
320 * inside is embedded in the function and the static key branching
321 * code can act at the higher level. Without the explicit
322 * __always_inline we can end up with a function call and a small
323 * overhead in the hotpath for nothing.
324 */
325static __always_inline void record_irq_time(struct irq_desc *desc)
326{
327 if (!static_branch_likely(&irq_timing_enabled))
328 return;
329
330 if (desc->istate & IRQS_TIMINGS) {
331 struct irq_timings *timings = this_cpu_ptr(&irq_timings);
332
333 timings->values[timings->count & IRQ_TIMINGS_MASK] =
334 irq_timing_encode(local_clock(),
335 irq_desc_get_irq(desc));
336
337 timings->count++;
338 }
339}
340#else
341static inline void irq_remove_timings(struct irq_desc *desc) {}
342static inline void irq_setup_timings(struct irq_desc *desc,
343 struct irqaction *act) {};
344static inline void record_irq_time(struct irq_desc *desc) {}
345#endif /* CONFIG_IRQ_TIMINGS */
346
347
Bartosz Golaszewskif1602032017-05-31 18:06:58 +0200348#ifdef CONFIG_GENERIC_IRQ_CHIP
349void irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
350 int num_ct, unsigned int irq_base,
351 void __iomem *reg_base, irq_flow_handler_t handler);
352#else
353static inline void
354irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
355 int num_ct, unsigned int irq_base,
356 void __iomem *reg_base, irq_flow_handler_t handler) { }
357#endif /* CONFIG_GENERIC_IRQ_CHIP */
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200358
Christoph Hellwig137221d2017-06-20 01:37:24 +0200359#ifdef CONFIG_GENERIC_PENDING_IRQ
360static inline bool irq_can_move_pcntxt(struct irq_data *data)
361{
362 return irqd_can_move_in_process_context(data);
363}
364static inline bool irq_move_pending(struct irq_data *data)
365{
366 return irqd_is_setaffinity_pending(data);
367}
368static inline void
369irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask)
370{
371 cpumask_copy(desc->pending_mask, mask);
372}
373static inline void
374irq_get_pending(struct cpumask *mask, struct irq_desc *desc)
375{
376 cpumask_copy(mask, desc->pending_mask);
377}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200378static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc)
379{
380 return desc->pending_mask;
381}
Thomas Gleixner36d84fb2017-06-20 01:37:34 +0200382bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear);
Christoph Hellwig137221d2017-06-20 01:37:24 +0200383#else /* CONFIG_GENERIC_PENDING_IRQ */
384static inline bool irq_can_move_pcntxt(struct irq_data *data)
385{
386 return true;
387}
388static inline bool irq_move_pending(struct irq_data *data)
389{
390 return false;
391}
392static inline void
393irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask)
394{
395}
396static inline void
397irq_get_pending(struct cpumask *mask, struct irq_desc *desc)
398{
399}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200400static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc)
401{
402 return NULL;
403}
Thomas Gleixner36d84fb2017-06-20 01:37:34 +0200404static inline bool irq_fixup_move_pending(struct irq_desc *desc, bool fclear)
405{
406 return false;
407}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200408#endif /* !CONFIG_GENERIC_PENDING_IRQ */
Christoph Hellwig137221d2017-06-20 01:37:24 +0200409
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200410#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
Thomas Gleixnerc2ce34c2017-06-24 11:05:59 +0200411#include <linux/debugfs.h>
412
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200413void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *desc);
Thomas Gleixnerc2ce34c2017-06-24 11:05:59 +0200414static inline void irq_remove_debugfs_entry(struct irq_desc *desc)
415{
416 debugfs_remove(desc->debugfs_file);
417}
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200418# ifdef CONFIG_IRQ_DOMAIN
419void irq_domain_debugfs_init(struct dentry *root);
420# else
421static inline void irq_domain_debugfs_init(struct dentry *root);
422# endif
423#else /* CONFIG_GENERIC_IRQ_DEBUGFS */
424static inline void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *d)
425{
426}
427static inline void irq_remove_debugfs_entry(struct irq_desc *d)
428{
429}
430#endif /* CONFIG_GENERIC_IRQ_DEBUGFS */