diff options
Diffstat (limited to 'kernel/irq/chip.c')
-rw-r--r-- | kernel/irq/chip.c | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index d96d6f687c48..4895fde4eb93 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -24,11 +24,9 @@ | |||
24 | */ | 24 | */ |
25 | void dynamic_irq_init(unsigned int irq) | 25 | void dynamic_irq_init(unsigned int irq) |
26 | { | 26 | { |
27 | struct irq_desc *desc; | 27 | struct irq_desc *desc = irq_to_desc(irq); |
28 | unsigned long flags; | 28 | unsigned long flags; |
29 | 29 | ||
30 | /* first time to use this irq_desc */ | ||
31 | desc = irq_to_desc(irq); | ||
32 | if (!desc) { | 30 | if (!desc) { |
33 | WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); | 31 | WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); |
34 | return; | 32 | return; |
@@ -58,10 +56,9 @@ void dynamic_irq_init(unsigned int irq) | |||
58 | */ | 56 | */ |
59 | void dynamic_irq_cleanup(unsigned int irq) | 57 | void dynamic_irq_cleanup(unsigned int irq) |
60 | { | 58 | { |
61 | struct irq_desc *desc; | 59 | struct irq_desc *desc = irq_to_desc(irq); |
62 | unsigned long flags; | 60 | unsigned long flags; |
63 | 61 | ||
64 | desc = irq_to_desc(irq); | ||
65 | if (!desc) { | 62 | if (!desc) { |
66 | WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); | 63 | WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); |
67 | return; | 64 | return; |
@@ -90,10 +87,9 @@ void dynamic_irq_cleanup(unsigned int irq) | |||
90 | */ | 87 | */ |
91 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) | 88 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) |
92 | { | 89 | { |
93 | struct irq_desc *desc; | 90 | struct irq_desc *desc = irq_to_desc(irq); |
94 | unsigned long flags; | 91 | unsigned long flags; |
95 | 92 | ||
96 | desc = irq_to_desc(irq); | ||
97 | if (!desc) { | 93 | if (!desc) { |
98 | WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); | 94 | WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); |
99 | return -EINVAL; | 95 | return -EINVAL; |
@@ -118,11 +114,10 @@ EXPORT_SYMBOL(set_irq_chip); | |||
118 | */ | 114 | */ |
119 | int set_irq_type(unsigned int irq, unsigned int type) | 115 | int set_irq_type(unsigned int irq, unsigned int type) |
120 | { | 116 | { |
121 | struct irq_desc *desc; | 117 | struct irq_desc *desc = irq_to_desc(irq); |
122 | unsigned long flags; | 118 | unsigned long flags; |
123 | int ret = -ENXIO; | 119 | int ret = -ENXIO; |
124 | 120 | ||
125 | desc = irq_to_desc(irq); | ||
126 | if (!desc) { | 121 | if (!desc) { |
127 | printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); | 122 | printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); |
128 | return -ENODEV; | 123 | return -ENODEV; |
@@ -147,10 +142,9 @@ EXPORT_SYMBOL(set_irq_type); | |||
147 | */ | 142 | */ |
148 | int set_irq_data(unsigned int irq, void *data) | 143 | int set_irq_data(unsigned int irq, void *data) |
149 | { | 144 | { |
150 | struct irq_desc *desc; | 145 | struct irq_desc *desc = irq_to_desc(irq); |
151 | unsigned long flags; | 146 | unsigned long flags; |
152 | 147 | ||
153 | desc = irq_to_desc(irq); | ||
154 | if (!desc) { | 148 | if (!desc) { |
155 | printk(KERN_ERR | 149 | printk(KERN_ERR |
156 | "Trying to install controller data for IRQ%d\n", irq); | 150 | "Trying to install controller data for IRQ%d\n", irq); |
@@ -173,10 +167,9 @@ EXPORT_SYMBOL(set_irq_data); | |||
173 | */ | 167 | */ |
174 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) | 168 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) |
175 | { | 169 | { |
176 | struct irq_desc *desc; | 170 | struct irq_desc *desc = irq_to_desc(irq); |
177 | unsigned long flags; | 171 | unsigned long flags; |
178 | 172 | ||
179 | desc = irq_to_desc(irq); | ||
180 | if (!desc) { | 173 | if (!desc) { |
181 | printk(KERN_ERR | 174 | printk(KERN_ERR |
182 | "Trying to install msi data for IRQ%d\n", irq); | 175 | "Trying to install msi data for IRQ%d\n", irq); |
@@ -200,10 +193,9 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) | |||
200 | */ | 193 | */ |
201 | int set_irq_chip_data(unsigned int irq, void *data) | 194 | int set_irq_chip_data(unsigned int irq, void *data) |
202 | { | 195 | { |
203 | struct irq_desc *desc; | 196 | struct irq_desc *desc = irq_to_desc(irq); |
204 | unsigned long flags; | 197 | unsigned long flags; |
205 | 198 | ||
206 | desc = irq_to_desc(irq); | ||
207 | if (!desc) { | 199 | if (!desc) { |
208 | printk(KERN_ERR | 200 | printk(KERN_ERR |
209 | "Trying to install chip data for IRQ%d\n", irq); | 201 | "Trying to install chip data for IRQ%d\n", irq); |
@@ -228,9 +220,8 @@ EXPORT_SYMBOL(set_irq_chip_data); | |||
228 | */ | 220 | */ |
229 | static void default_enable(unsigned int irq) | 221 | static void default_enable(unsigned int irq) |
230 | { | 222 | { |
231 | struct irq_desc *desc; | 223 | struct irq_desc *desc = irq_to_desc(irq); |
232 | 224 | ||
233 | desc = irq_to_desc(irq); | ||
234 | desc->chip->unmask(irq); | 225 | desc->chip->unmask(irq); |
235 | desc->status &= ~IRQ_MASKED; | 226 | desc->status &= ~IRQ_MASKED; |
236 | } | 227 | } |
@@ -247,11 +238,9 @@ static void default_disable(unsigned int irq) | |||
247 | */ | 238 | */ |
248 | static unsigned int default_startup(unsigned int irq) | 239 | static unsigned int default_startup(unsigned int irq) |
249 | { | 240 | { |
250 | struct irq_desc *desc; | 241 | struct irq_desc *desc = irq_to_desc(irq); |
251 | 242 | ||
252 | desc = irq_to_desc(irq); | ||
253 | desc->chip->enable(irq); | 243 | desc->chip->enable(irq); |
254 | |||
255 | return 0; | 244 | return 0; |
256 | } | 245 | } |
257 | 246 | ||
@@ -260,9 +249,8 @@ static unsigned int default_startup(unsigned int irq) | |||
260 | */ | 249 | */ |
261 | static void default_shutdown(unsigned int irq) | 250 | static void default_shutdown(unsigned int irq) |
262 | { | 251 | { |
263 | struct irq_desc *desc; | 252 | struct irq_desc *desc = irq_to_desc(irq); |
264 | 253 | ||
265 | desc = irq_to_desc(irq); | ||
266 | desc->chip->mask(irq); | 254 | desc->chip->mask(irq); |
267 | desc->status |= IRQ_MASKED; | 255 | desc->status |= IRQ_MASKED; |
268 | } | 256 | } |
@@ -550,10 +538,9 @@ void | |||
550 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | 538 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, |
551 | const char *name) | 539 | const char *name) |
552 | { | 540 | { |
553 | struct irq_desc *desc; | 541 | struct irq_desc *desc = irq_to_desc(irq); |
554 | unsigned long flags; | 542 | unsigned long flags; |
555 | 543 | ||
556 | desc = irq_to_desc(irq); | ||
557 | if (!desc) { | 544 | if (!desc) { |
558 | printk(KERN_ERR | 545 | printk(KERN_ERR |
559 | "Trying to install type control for IRQ%d\n", irq); | 546 | "Trying to install type control for IRQ%d\n", irq); |
@@ -614,13 +601,11 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, | |||
614 | 601 | ||
615 | void __init set_irq_noprobe(unsigned int irq) | 602 | void __init set_irq_noprobe(unsigned int irq) |
616 | { | 603 | { |
617 | struct irq_desc *desc; | 604 | struct irq_desc *desc = irq_to_desc(irq); |
618 | unsigned long flags; | 605 | unsigned long flags; |
619 | 606 | ||
620 | desc = irq_to_desc(irq); | ||
621 | if (!desc) { | 607 | if (!desc) { |
622 | printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); | 608 | printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); |
623 | |||
624 | return; | 609 | return; |
625 | } | 610 | } |
626 | 611 | ||
@@ -631,13 +616,11 @@ void __init set_irq_noprobe(unsigned int irq) | |||
631 | 616 | ||
632 | void __init set_irq_probe(unsigned int irq) | 617 | void __init set_irq_probe(unsigned int irq) |
633 | { | 618 | { |
634 | struct irq_desc *desc; | 619 | struct irq_desc *desc = irq_to_desc(irq); |
635 | unsigned long flags; | 620 | unsigned long flags; |
636 | 621 | ||
637 | desc = irq_to_desc(irq); | ||
638 | if (!desc) { | 622 | if (!desc) { |
639 | printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); | 623 | printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); |
640 | |||
641 | return; | 624 | return; |
642 | } | 625 | } |
643 | 626 | ||