aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-07 14:25:25 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-19 06:58:15 -0500
commitbd062e7667ac173afef57fbfe9327f3b914a9d4c (patch)
tree29e798cb397311abec53ad45b73efdede1fc37b7 /kernel/irq
parente6bea9c404699223322d7411c6f2ceaec02fa83c (diff)
genirq: Move IRQ_AUTODETECT to internal state
No users outside of core Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/autoprobe.c29
-rw-r--r--kernel/irq/internals.h15
-rw-r--r--kernel/irq/manage.c3
3 files changed, 27 insertions, 20 deletions
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 08947cb61725..916e56e10a2e 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -32,7 +32,6 @@ unsigned long probe_irq_on(void)
32{ 32{
33 struct irq_desc *desc; 33 struct irq_desc *desc;
34 unsigned long mask = 0; 34 unsigned long mask = 0;
35 unsigned int status;
36 int i; 35 int i;
37 36
38 /* 37 /*
@@ -76,7 +75,8 @@ unsigned long probe_irq_on(void)
76 for_each_irq_desc_reverse(i, desc) { 75 for_each_irq_desc_reverse(i, desc) {
77 raw_spin_lock_irq(&desc->lock); 76 raw_spin_lock_irq(&desc->lock);
78 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 77 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
79 desc->status |= IRQ_AUTODETECT | IRQ_WAITING; 78 desc->istate |= IRQS_AUTODETECT;
79 desc->status |= IRQ_WAITING;
80 if (irq_startup(desc)) 80 if (irq_startup(desc))
81 desc->status |= IRQ_PENDING; 81 desc->status |= IRQ_PENDING;
82 } 82 }
@@ -93,12 +93,11 @@ unsigned long probe_irq_on(void)
93 */ 93 */
94 for_each_irq_desc(i, desc) { 94 for_each_irq_desc(i, desc) {
95 raw_spin_lock_irq(&desc->lock); 95 raw_spin_lock_irq(&desc->lock);
96 status = desc->status;
97 96
98 if (status & IRQ_AUTODETECT) { 97 if (desc->istate & IRQS_AUTODETECT) {
99 /* It triggered already - consider it spurious. */ 98 /* It triggered already - consider it spurious. */
100 if (!(status & IRQ_WAITING)) { 99 if (!(desc->status & IRQ_WAITING)) {
101 desc->status = status & ~IRQ_AUTODETECT; 100 desc->istate &= ~IRQS_AUTODETECT;
102 irq_shutdown(desc); 101 irq_shutdown(desc);
103 } else 102 } else
104 if (i < 32) 103 if (i < 32)
@@ -125,19 +124,17 @@ EXPORT_SYMBOL(probe_irq_on);
125 */ 124 */
126unsigned int probe_irq_mask(unsigned long val) 125unsigned int probe_irq_mask(unsigned long val)
127{ 126{
128 unsigned int status, mask = 0; 127 unsigned int mask = 0;
129 struct irq_desc *desc; 128 struct irq_desc *desc;
130 int i; 129 int i;
131 130
132 for_each_irq_desc(i, desc) { 131 for_each_irq_desc(i, desc) {
133 raw_spin_lock_irq(&desc->lock); 132 raw_spin_lock_irq(&desc->lock);
134 status = desc->status; 133 if (desc->istate & IRQS_AUTODETECT) {
135 134 if (i < 16 && !(desc->status & IRQ_WAITING))
136 if (status & IRQ_AUTODETECT) {
137 if (i < 16 && !(status & IRQ_WAITING))
138 mask |= 1 << i; 135 mask |= 1 << i;
139 136
140 desc->status = status & ~IRQ_AUTODETECT; 137 desc->istate &= ~IRQS_AUTODETECT;
141 irq_shutdown(desc); 138 irq_shutdown(desc);
142 } 139 }
143 raw_spin_unlock_irq(&desc->lock); 140 raw_spin_unlock_irq(&desc->lock);
@@ -169,19 +166,17 @@ int probe_irq_off(unsigned long val)
169{ 166{
170 int i, irq_found = 0, nr_of_irqs = 0; 167 int i, irq_found = 0, nr_of_irqs = 0;
171 struct irq_desc *desc; 168 struct irq_desc *desc;
172 unsigned int status;
173 169
174 for_each_irq_desc(i, desc) { 170 for_each_irq_desc(i, desc) {
175 raw_spin_lock_irq(&desc->lock); 171 raw_spin_lock_irq(&desc->lock);
176 status = desc->status;
177 172
178 if (status & IRQ_AUTODETECT) { 173 if (desc->istate & IRQS_AUTODETECT) {
179 if (!(status & IRQ_WAITING)) { 174 if (!(desc->status & IRQ_WAITING)) {
180 if (!nr_of_irqs) 175 if (!nr_of_irqs)
181 irq_found = i; 176 irq_found = i;
182 nr_of_irqs++; 177 nr_of_irqs++;
183 } 178 }
184 desc->status = status & ~IRQ_AUTODETECT; 179 desc->istate &= ~IRQS_AUTODETECT;
185 irq_shutdown(desc); 180 irq_shutdown(desc);
186 } 181 }
187 raw_spin_unlock_irq(&desc->lock); 182 raw_spin_unlock_irq(&desc->lock);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 8f200310a952..7ffd4f439b92 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -33,6 +33,15 @@ enum {
33 IRQTF_AFFINITY, 33 IRQTF_AFFINITY,
34}; 34};
35 35
36/*
37 * Bit masks for desc->state
38 *
39 * IRQS_AUTODETECT - autodetection in progress
40 */
41enum {
42 IRQS_AUTODETECT = 0x00000001,
43};
44
36#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) 45#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
37 46
38/* Set default functions for irq_chip structures: */ 47/* Set default functions for irq_chip structures: */
@@ -98,6 +107,7 @@ static inline void chip_bus_sync_unlock(struct irq_desc *desc)
98#include <linux/kallsyms.h> 107#include <linux/kallsyms.h>
99 108
100#define P(f) if (desc->status & f) printk("%14s set\n", #f) 109#define P(f) if (desc->status & f) printk("%14s set\n", #f)
110#define PS(f) if (desc->istate & f) printk("%14s set\n", #f)
101 111
102static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) 112static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
103{ 113{
@@ -117,7 +127,6 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
117 P(IRQ_DISABLED); 127 P(IRQ_DISABLED);
118 P(IRQ_PENDING); 128 P(IRQ_PENDING);
119 P(IRQ_REPLAY); 129 P(IRQ_REPLAY);
120 P(IRQ_AUTODETECT);
121 P(IRQ_WAITING); 130 P(IRQ_WAITING);
122 P(IRQ_LEVEL); 131 P(IRQ_LEVEL);
123 P(IRQ_MASKED); 132 P(IRQ_MASKED);
@@ -127,7 +136,9 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
127 P(IRQ_NOPROBE); 136 P(IRQ_NOPROBE);
128 P(IRQ_NOREQUEST); 137 P(IRQ_NOREQUEST);
129 P(IRQ_NOAUTOEN); 138 P(IRQ_NOAUTOEN);
139
140 PS(IRQS_AUTODETECT);
130} 141}
131 142
132#undef P 143#undef P
133 144#undef PS
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index dd4e5c21b9e7..abe852c9449d 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -897,8 +897,9 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
897 desc->status |= IRQ_PER_CPU; 897 desc->status |= IRQ_PER_CPU;
898#endif 898#endif
899 899
900 desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING | IRQ_ONESHOT | 900 desc->status &= ~(IRQ_WAITING | IRQ_ONESHOT |
901 IRQ_INPROGRESS | IRQ_SPURIOUS_DISABLED); 901 IRQ_INPROGRESS | IRQ_SPURIOUS_DISABLED);
902 desc->istate &= ~IRQS_AUTODETECT;
902 903
903 if (new->flags & IRQF_ONESHOT) 904 if (new->flags & IRQF_ONESHOT)
904 desc->status |= IRQ_ONESHOT; 905 desc->status |= IRQ_ONESHOT;