aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:17 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:51 -0400
commitcb5bc83225a86ca53bbb889ed8439e4fd6cf44ac (patch)
treed2c43413adbc86562ab63498e3ce14e36ba253ed /kernel/irq
parent1d5f6b36c4736af1dac396d6267eb53dcc8c0021 (diff)
x86_64: rename irq_desc/irq_desc_alloc
change names: irq_desc() ==> irq_desc_alloc __irq_desc() ==> irq_desc Also split a few of the uses in lowlevel x86 code. v2: need to check if desc is null in smp_irq_move_cleanup Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/chip.c21
-rw-r--r--kernel/irq/handle.c23
-rw-r--r--kernel/irq/manage.c16
3 files changed, 24 insertions, 36 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index a4bb0da9c88c..9fc5e69213de 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -27,7 +27,8 @@ void dynamic_irq_init(unsigned int irq)
27 struct irq_desc *desc; 27 struct irq_desc *desc;
28 unsigned long flags; 28 unsigned long flags;
29 29
30 desc = irq_to_desc(irq); 30 /* first time to use this irq_desc */
31 desc = irq_to_desc_alloc(irq);
31 if (!desc) { 32 if (!desc) {
32 WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); 33 WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
33 return; 34 return;
@@ -60,7 +61,7 @@ void dynamic_irq_cleanup(unsigned int irq)
60 struct irq_desc *desc; 61 struct irq_desc *desc;
61 unsigned long flags; 62 unsigned long flags;
62 63
63 desc = __irq_to_desc(irq); 64 desc = irq_to_desc(irq);
64 if (!desc) { 65 if (!desc) {
65 WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); 66 WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
66 return; 67 return;
@@ -92,7 +93,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
92 struct irq_desc *desc; 93 struct irq_desc *desc;
93 unsigned long flags; 94 unsigned long flags;
94 95
95 desc = __irq_to_desc(irq); 96 desc = irq_to_desc(irq);
96 if (!desc) { 97 if (!desc) {
97 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); 98 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
98 return -EINVAL; 99 return -EINVAL;
@@ -122,7 +123,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
122 unsigned long flags; 123 unsigned long flags;
123 int ret = -ENXIO; 124 int ret = -ENXIO;
124 125
125 desc = __irq_to_desc(irq); 126 desc = irq_to_desc(irq);
126 if (!desc) { 127 if (!desc) {
127 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); 128 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
128 return -ENODEV; 129 return -ENODEV;
@@ -150,7 +151,7 @@ int set_irq_data(unsigned int irq, void *data)
150 struct irq_desc *desc; 151 struct irq_desc *desc;
151 unsigned long flags; 152 unsigned long flags;
152 153
153 desc = __irq_to_desc(irq); 154 desc = irq_to_desc(irq);
154 if (!desc) { 155 if (!desc) {
155 printk(KERN_ERR 156 printk(KERN_ERR
156 "Trying to install controller data for IRQ%d\n", irq); 157 "Trying to install controller data for IRQ%d\n", irq);
@@ -176,7 +177,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
176 struct irq_desc *desc; 177 struct irq_desc *desc;
177 unsigned long flags; 178 unsigned long flags;
178 179
179 desc = __irq_to_desc(irq); 180 desc = irq_to_desc(irq);
180 if (!desc) { 181 if (!desc) {
181 printk(KERN_ERR 182 printk(KERN_ERR
182 "Trying to install msi data for IRQ%d\n", irq); 183 "Trying to install msi data for IRQ%d\n", irq);
@@ -203,7 +204,7 @@ int set_irq_chip_data(unsigned int irq, void *data)
203 struct irq_desc *desc; 204 struct irq_desc *desc;
204 unsigned long flags; 205 unsigned long flags;
205 206
206 desc = __irq_to_desc(irq); 207 desc = irq_to_desc(irq);
207 if (!desc) { 208 if (!desc) {
208 printk(KERN_ERR 209 printk(KERN_ERR
209 "Trying to install chip data for IRQ%d\n", irq); 210 "Trying to install chip data for IRQ%d\n", irq);
@@ -554,7 +555,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
554 struct irq_desc *desc; 555 struct irq_desc *desc;
555 unsigned long flags; 556 unsigned long flags;
556 557
557 desc = __irq_to_desc(irq); 558 desc = irq_to_desc(irq);
558 if (!desc) { 559 if (!desc) {
559 printk(KERN_ERR 560 printk(KERN_ERR
560 "Trying to install type control for IRQ%d\n", irq); 561 "Trying to install type control for IRQ%d\n", irq);
@@ -618,7 +619,7 @@ void __init set_irq_noprobe(unsigned int irq)
618 struct irq_desc *desc; 619 struct irq_desc *desc;
619 unsigned long flags; 620 unsigned long flags;
620 621
621 desc = __irq_to_desc(irq); 622 desc = irq_to_desc(irq);
622 if (!desc) { 623 if (!desc) {
623 printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); 624 printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
624 625
@@ -635,7 +636,7 @@ void __init set_irq_probe(unsigned int irq)
635 struct irq_desc *desc; 636 struct irq_desc *desc;
636 unsigned long flags; 637 unsigned long flags;
637 638
638 desc = __irq_to_desc(irq); 639 desc = irq_to_desc(irq);
639 if (!desc) { 640 if (!desc) {
640 printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); 641 printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
641 642
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e1d787e9169b..d44e3515eae1 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -151,7 +151,7 @@ early_param("nr_irq_desc", parse_nr_irq_desc);
151struct irq_desc *sparse_irqs; 151struct irq_desc *sparse_irqs;
152DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work); 152DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work);
153 153
154struct irq_desc *__irq_to_desc(unsigned int irq) 154struct irq_desc *irq_to_desc(unsigned int irq)
155{ 155{
156 struct irq_desc *desc; 156 struct irq_desc *desc;
157 157
@@ -169,7 +169,7 @@ struct irq_desc *__irq_to_desc(unsigned int irq)
169 } 169 }
170 return NULL; 170 return NULL;
171} 171}
172struct irq_desc *irq_to_desc(unsigned int irq) 172struct irq_desc *irq_to_desc_alloc(unsigned int irq)
173{ 173{
174 struct irq_desc *desc, *desc_pri; 174 struct irq_desc *desc, *desc_pri;
175 int i; 175 int i;
@@ -186,6 +186,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
186 186
187 if (desc->irq == -1U) { 187 if (desc->irq == -1U) {
188 desc->irq = irq; 188 desc->irq = irq;
189 printk(KERN_DEBUG "found new irq_desc for irq %d\n", desc->irq);
189 return desc; 190 return desc;
190 } 191 }
191 desc_pri = desc; 192 desc_pri = desc;
@@ -236,21 +237,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
236 237
237 desc->irq = irq; 238 desc->irq = irq;
238 desc_pri->next = desc; 239 desc_pri->next = desc;
239 { 240 printk(KERN_DEBUG "1 found new irq_desc for irq %d and pri will be irq %d\n", desc->irq, desc_pri->irq);
240 /* double check if some one mess up the list */
241 struct irq_desc *desc;
242 int count = 0;
243
244 desc = &sparse_irqs[0];
245 while (desc) {
246 printk(KERN_DEBUG "1 found irq_desc for irq %d\n", desc->irq);
247 if (desc->next)
248 printk(KERN_DEBUG "1 found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
249 desc = desc->next;
250 count++;
251 }
252 printk(KERN_DEBUG "1 all preallocted %d\n", count);
253 }
254 241
255 return desc; 242 return desc;
256} 243}
@@ -285,7 +272,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
285 272
286 return NULL; 273 return NULL;
287} 274}
288struct irq_desc *__irq_to_desc(unsigned int irq) 275struct irq_desc *irq_to_desc_alloc(unsigned int irq)
289{ 276{
290 return irq_to_desc(irq); 277 return irq_to_desc(irq);
291} 278}
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c0b4d4df6de2..6df49218632a 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -31,7 +31,7 @@ cpumask_t irq_default_affinity = CPU_MASK_ALL;
31 */ 31 */
32void synchronize_irq(unsigned int irq) 32void synchronize_irq(unsigned int irq)
33{ 33{
34 struct irq_desc *desc = __irq_to_desc(irq); 34 struct irq_desc *desc = irq_to_desc(irq);
35 unsigned int status; 35 unsigned int status;
36 36
37 if (!desc) 37 if (!desc)
@@ -145,7 +145,7 @@ void disable_irq_nosync(unsigned int irq)
145 struct irq_desc *desc; 145 struct irq_desc *desc;
146 unsigned long flags; 146 unsigned long flags;
147 147
148 desc = __irq_to_desc(irq); 148 desc = irq_to_desc(irq);
149 if (!desc) 149 if (!desc)
150 return; 150 return;
151 151
@@ -174,7 +174,7 @@ void disable_irq(unsigned int irq)
174{ 174{
175 struct irq_desc *desc; 175 struct irq_desc *desc;
176 176
177 desc = __irq_to_desc(irq); 177 desc = irq_to_desc(irq);
178 if (!desc) 178 if (!desc)
179 return; 179 return;
180 180
@@ -218,7 +218,7 @@ void enable_irq(unsigned int irq)
218 struct irq_desc *desc; 218 struct irq_desc *desc;
219 unsigned long flags; 219 unsigned long flags;
220 220
221 desc = __irq_to_desc(irq); 221 desc = irq_to_desc(irq);
222 if (!desc) 222 if (!desc)
223 return; 223 return;
224 224
@@ -296,7 +296,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
296 struct irq_desc *desc; 296 struct irq_desc *desc;
297 struct irqaction *action; 297 struct irqaction *action;
298 298
299 desc = __irq_to_desc(irq); 299 desc = irq_to_desc(irq);
300 if (!desc) 300 if (!desc)
301 return 0; 301 return 0;
302 302
@@ -366,7 +366,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
366 int shared = 0; 366 int shared = 0;
367 int ret; 367 int ret;
368 368
369 desc = __irq_to_desc(irq); 369 desc = irq_to_desc(irq);
370 if (!desc) 370 if (!desc)
371 return -EINVAL; 371 return -EINVAL;
372 372
@@ -527,7 +527,7 @@ void free_irq(unsigned int irq, void *dev_id)
527 527
528 WARN_ON(in_interrupt()); 528 WARN_ON(in_interrupt());
529 529
530 desc = __irq_to_desc(irq); 530 desc = irq_to_desc(irq);
531 if (!desc) 531 if (!desc)
532 return; 532 return;
533 533
@@ -644,7 +644,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
644 if ((irqflags & IRQF_SHARED) && !dev_id) 644 if ((irqflags & IRQF_SHARED) && !dev_id)
645 return -EINVAL; 645 return -EINVAL;
646 646
647 desc = __irq_to_desc(irq); 647 desc = irq_to_desc(irq);
648 if (!desc) 648 if (!desc)
649 return -EINVAL; 649 return -EINVAL;
650 650