aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/irq/autoprobe.c4
-rw-r--r--kernel/irq/chip.c3
-rw-r--r--kernel/irq/manage.c14
-rw-r--r--kernel/irq/settings.h58
-rw-r--r--kernel/irq/spurious.c3
5 files changed, 70 insertions, 12 deletions
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index aab64c262726..c8bbc4fabaab 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -45,7 +45,7 @@ unsigned long probe_irq_on(void)
45 */ 45 */
46 for_each_irq_desc_reverse(i, desc) { 46 for_each_irq_desc_reverse(i, desc) {
47 raw_spin_lock_irq(&desc->lock); 47 raw_spin_lock_irq(&desc->lock);
48 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 48 if (!desc->action && irq_settings_can_probe(desc)) {
49 /* 49 /*
50 * An old-style architecture might still have 50 * An old-style architecture might still have
51 * the handle_bad_irq handler there: 51 * the handle_bad_irq handler there:
@@ -74,7 +74,7 @@ unsigned long probe_irq_on(void)
74 */ 74 */
75 for_each_irq_desc_reverse(i, desc) { 75 for_each_irq_desc_reverse(i, desc) {
76 raw_spin_lock_irq(&desc->lock); 76 raw_spin_lock_irq(&desc->lock);
77 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 77 if (!desc->action && irq_settings_can_probe(desc)) {
78 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING; 78 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
79 if (irq_startup(desc)) { 79 if (irq_startup(desc)) {
80 irq_compat_set_pending(desc); 80 irq_compat_set_pending(desc);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 9c9b573a718e..9e9220da4deb 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -674,7 +674,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
674 desc->name = name; 674 desc->name = name;
675 675
676 if (handle != handle_bad_irq && is_chained) { 676 if (handle != handle_bad_irq && is_chained) {
677 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE; 677 irq_settings_set_noprobe(desc);
678 irq_settings_set_norequest(desc);
678 irq_startup(desc); 679 irq_startup(desc);
679 } 680 }
680 raw_spin_unlock_irqrestore(&desc->lock, flags); 681 raw_spin_unlock_irqrestore(&desc->lock, flags);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 9ae758ed8e66..b5de828e58d9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -103,7 +103,7 @@ void irq_set_thread_affinity(struct irq_desc *desc)
103#ifdef CONFIG_GENERIC_PENDING_IRQ 103#ifdef CONFIG_GENERIC_PENDING_IRQ
104static inline bool irq_can_move_pcntxt(struct irq_desc *desc) 104static inline bool irq_can_move_pcntxt(struct irq_desc *desc)
105{ 105{
106 return desc->status & IRQ_MOVE_PCNTXT; 106 return irq_settings_can_move_pcntxt(desc);
107} 107}
108static inline bool irq_move_pending(struct irq_desc *desc) 108static inline bool irq_move_pending(struct irq_desc *desc)
109{ 109{
@@ -411,7 +411,7 @@ void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume)
411 if (desc->istate & IRQS_SUSPENDED) 411 if (desc->istate & IRQS_SUSPENDED)
412 goto err_out; 412 goto err_out;
413 /* Prevent probing on this irq: */ 413 /* Prevent probing on this irq: */
414 desc->status |= IRQ_NOPROBE; 414 irq_settings_set_noprobe(desc);
415 irq_enable(desc); 415 irq_enable(desc);
416 check_irq_resend(desc, irq); 416 check_irq_resend(desc, irq);
417 /* fall-through */ 417 /* fall-through */
@@ -526,7 +526,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
526 if (!desc) 526 if (!desc)
527 return 0; 527 return 0;
528 528
529 if (desc->status & IRQ_NOREQUEST) 529 if (!irq_settings_can_request(desc))
530 return 0; 530 return 0;
531 531
532 raw_spin_lock_irqsave(&desc->lock, flags); 532 raw_spin_lock_irqsave(&desc->lock, flags);
@@ -820,7 +820,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
820 * Check whether the interrupt nests into another interrupt 820 * Check whether the interrupt nests into another interrupt
821 * thread. 821 * thread.
822 */ 822 */
823 nested = desc->status & IRQ_NESTED_THREAD; 823 nested = irq_settings_is_nested_thread(desc);
824 if (nested) { 824 if (nested) {
825 if (!new->thread_fn) 825 if (!new->thread_fn)
826 return -EINVAL; 826 return -EINVAL;
@@ -917,7 +917,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
917 if (new->flags & IRQF_ONESHOT) 917 if (new->flags & IRQF_ONESHOT)
918 desc->istate |= IRQS_ONESHOT; 918 desc->istate |= IRQS_ONESHOT;
919 919
920 if (!(desc->status & IRQ_NOAUTOEN)) 920 if (irq_settings_can_autoenable(desc))
921 irq_startup(desc); 921 irq_startup(desc);
922 else 922 else
923 /* Undo nested disables: */ 923 /* Undo nested disables: */
@@ -1217,7 +1217,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
1217 if (!desc) 1217 if (!desc)
1218 return -EINVAL; 1218 return -EINVAL;
1219 1219
1220 if (desc->status & IRQ_NOREQUEST) 1220 if (!irq_settings_can_request(desc))
1221 return -EINVAL; 1221 return -EINVAL;
1222 1222
1223 if (!handler) { 1223 if (!handler) {
@@ -1292,7 +1292,7 @@ int request_any_context_irq(unsigned int irq, irq_handler_t handler,
1292 if (!desc) 1292 if (!desc)
1293 return -EINVAL; 1293 return -EINVAL;
1294 1294
1295 if (desc->status & IRQ_NESTED_THREAD) { 1295 if (irq_settings_is_nested_thread(desc)) {
1296 ret = request_threaded_irq(irq, NULL, handler, 1296 ret = request_threaded_irq(irq, NULL, handler,
1297 flags, name, dev_id); 1297 flags, name, dev_id);
1298 return !ret ? IRQC_IS_NESTED : ret; 1298 return !ret ? IRQC_IS_NESTED : ret;
diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h
index 2201f2aaa9a0..216b6f200e7c 100644
--- a/kernel/irq/settings.h
+++ b/kernel/irq/settings.h
@@ -6,7 +6,12 @@ enum {
6 _IRQ_DEFAULT_INIT_FLAGS = IRQ_DEFAULT_INIT_FLAGS, 6 _IRQ_DEFAULT_INIT_FLAGS = IRQ_DEFAULT_INIT_FLAGS,
7 _IRQ_PER_CPU = IRQ_PER_CPU, 7 _IRQ_PER_CPU = IRQ_PER_CPU,
8 _IRQ_LEVEL = IRQ_LEVEL, 8 _IRQ_LEVEL = IRQ_LEVEL,
9 _IRQ_NOPROBE = IRQ_NOPROBE,
10 _IRQ_NOREQUEST = IRQ_NOREQUEST,
11 _IRQ_NOAUTOEN = IRQ_NOAUTOEN,
12 _IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT,
9 _IRQ_NO_BALANCING = IRQ_NO_BALANCING, 13 _IRQ_NO_BALANCING = IRQ_NO_BALANCING,
14 _IRQ_NESTED_THREAD = IRQ_NESTED_THREAD,
10 _IRQF_MODIFY_MASK = IRQF_MODIFY_MASK, 15 _IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
11}; 16};
12 17
@@ -34,6 +39,14 @@ enum {
34#define IRQ_AFFINITY_SET GOT_YOU_MORON 39#define IRQ_AFFINITY_SET GOT_YOU_MORON
35#undef IRQ_LEVEL 40#undef IRQ_LEVEL
36#define IRQ_LEVEL GOT_YOU_MORON 41#define IRQ_LEVEL GOT_YOU_MORON
42#undef IRQ_NOPROBE
43#define IRQ_NOPROBE GOT_YOU_MORON
44#undef IRQ_NOREQUEST
45#define IRQ_NOREQUEST GOT_YOU_MORON
46#undef IRQ_NOAUTOEN
47#define IRQ_NOAUTOEN GOT_YOU_MORON
48#undef IRQ_NESTED_THREAD
49#define IRQ_NESTED_THREAD GOT_YOU_MORON
37#undef IRQF_MODIFY_MASK 50#undef IRQF_MODIFY_MASK
38#define IRQF_MODIFY_MASK GOT_YOU_MORON 51#define IRQF_MODIFY_MASK GOT_YOU_MORON
39 52
@@ -90,3 +103,48 @@ static inline void irq_settings_set_level(struct irq_desc *desc)
90{ 103{
91 desc->status |= _IRQ_LEVEL; 104 desc->status |= _IRQ_LEVEL;
92} 105}
106
107static inline bool irq_settings_can_request(struct irq_desc *desc)
108{
109 return !(desc->status & _IRQ_NOREQUEST);
110}
111
112static inline void irq_settings_clr_norequest(struct irq_desc *desc)
113{
114 desc->status &= ~_IRQ_NOREQUEST;
115}
116
117static inline void irq_settings_set_norequest(struct irq_desc *desc)
118{
119 desc->status |= _IRQ_NOREQUEST;
120}
121
122static inline bool irq_settings_can_probe(struct irq_desc *desc)
123{
124 return !(desc->status & _IRQ_NOPROBE);
125}
126
127static inline void irq_settings_clr_noprobe(struct irq_desc *desc)
128{
129 desc->status &= ~_IRQ_NOPROBE;
130}
131
132static inline void irq_settings_set_noprobe(struct irq_desc *desc)
133{
134 desc->status |= _IRQ_NOPROBE;
135}
136
137static inline bool irq_settings_can_move_pcntxt(struct irq_desc *desc)
138{
139 return desc->status & _IRQ_MOVE_PCNTXT;
140}
141
142static inline bool irq_settings_can_autoenable(struct irq_desc *desc)
143{
144 return !(desc->status & _IRQ_NOAUTOEN);
145}
146
147static inline bool irq_settings_is_nested_thread(struct irq_desc *desc)
148{
149 return desc->status & _IRQ_NESTED_THREAD;
150}
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 226ed7d26a84..dd586ebf9c8c 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -68,8 +68,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
68 raw_spin_lock(&desc->lock); 68 raw_spin_lock(&desc->lock);
69 69
70 /* PER_CPU and nested thread interrupts are never polled */ 70 /* PER_CPU and nested thread interrupts are never polled */
71 if (irq_settings_is_per_cpu(desc) || 71 if (irq_settings_is_per_cpu(desc) || irq_settings_is_nested_thread(desc))
72 (desc->status & IRQ_NESTED_THREAD))
73 goto out; 72 goto out;
74 73
75 /* 74 /*