diff options
Diffstat (limited to 'kernel/irq/chip.c')
-rw-r--r-- | kernel/irq/chip.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index bba66e098703..76c225cf4b26 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -33,7 +33,7 @@ void dynamic_irq_init(unsigned int irq) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /* Ensure we don't have left over values from a previous use of this irq */ | 35 | /* Ensure we don't have left over values from a previous use of this irq */ |
36 | desc = irq_desc + irq; | 36 | desc = irq_to_desc(irq); |
37 | spin_lock_irqsave(&desc->lock, flags); | 37 | spin_lock_irqsave(&desc->lock, flags); |
38 | desc->status = IRQ_DISABLED; | 38 | desc->status = IRQ_DISABLED; |
39 | desc->chip = &no_irq_chip; | 39 | desc->chip = &no_irq_chip; |
@@ -65,7 +65,7 @@ void dynamic_irq_cleanup(unsigned int irq) | |||
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | 67 | ||
68 | desc = irq_desc + irq; | 68 | desc = irq_to_desc(irq); |
69 | spin_lock_irqsave(&desc->lock, flags); | 69 | spin_lock_irqsave(&desc->lock, flags); |
70 | if (desc->action) { | 70 | if (desc->action) { |
71 | spin_unlock_irqrestore(&desc->lock, flags); | 71 | spin_unlock_irqrestore(&desc->lock, flags); |
@@ -100,7 +100,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip) | |||
100 | if (!chip) | 100 | if (!chip) |
101 | chip = &no_irq_chip; | 101 | chip = &no_irq_chip; |
102 | 102 | ||
103 | desc = irq_desc + irq; | 103 | desc = irq_to_desc(irq); |
104 | spin_lock_irqsave(&desc->lock, flags); | 104 | spin_lock_irqsave(&desc->lock, flags); |
105 | irq_chip_set_defaults(chip); | 105 | irq_chip_set_defaults(chip); |
106 | desc->chip = chip; | 106 | desc->chip = chip; |
@@ -126,7 +126,7 @@ int set_irq_type(unsigned int irq, unsigned int type) | |||
126 | return -ENODEV; | 126 | return -ENODEV; |
127 | } | 127 | } |
128 | 128 | ||
129 | desc = irq_desc + irq; | 129 | desc = irq_to_desc(irq); |
130 | if (type == IRQ_TYPE_NONE) | 130 | if (type == IRQ_TYPE_NONE) |
131 | return 0; | 131 | return 0; |
132 | 132 | ||
@@ -155,7 +155,7 @@ int set_irq_data(unsigned int irq, void *data) | |||
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
158 | desc = irq_desc + irq; | 158 | desc = irq_to_desc(irq); |
159 | spin_lock_irqsave(&desc->lock, flags); | 159 | spin_lock_irqsave(&desc->lock, flags); |
160 | desc->handler_data = data; | 160 | desc->handler_data = data; |
161 | spin_unlock_irqrestore(&desc->lock, flags); | 161 | spin_unlock_irqrestore(&desc->lock, flags); |
@@ -180,7 +180,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) | |||
180 | "Trying to install msi data for IRQ%d\n", irq); | 180 | "Trying to install msi data for IRQ%d\n", irq); |
181 | return -EINVAL; | 181 | return -EINVAL; |
182 | } | 182 | } |
183 | desc = irq_desc + irq; | 183 | desc = irq_to_desc(irq); |
184 | spin_lock_irqsave(&desc->lock, flags); | 184 | spin_lock_irqsave(&desc->lock, flags); |
185 | desc->msi_desc = entry; | 185 | desc->msi_desc = entry; |
186 | if (entry) | 186 | if (entry) |
@@ -198,9 +198,10 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) | |||
198 | */ | 198 | */ |
199 | int set_irq_chip_data(unsigned int irq, void *data) | 199 | int set_irq_chip_data(unsigned int irq, void *data) |
200 | { | 200 | { |
201 | struct irq_desc *desc = irq_desc + irq; | 201 | struct irq_desc *desc; |
202 | unsigned long flags; | 202 | unsigned long flags; |
203 | 203 | ||
204 | desc = irq_to_desc(irq); | ||
204 | if (irq >= nr_irqs || !desc->chip) { | 205 | if (irq >= nr_irqs || !desc->chip) { |
205 | printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq); | 206 | printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq); |
206 | return -EINVAL; | 207 | return -EINVAL; |
@@ -219,8 +220,9 @@ EXPORT_SYMBOL(set_irq_chip_data); | |||
219 | */ | 220 | */ |
220 | static void default_enable(unsigned int irq) | 221 | static void default_enable(unsigned int irq) |
221 | { | 222 | { |
222 | struct irq_desc *desc = irq_desc + irq; | 223 | struct irq_desc *desc; |
223 | 224 | ||
225 | desc = irq_to_desc(irq); | ||
224 | desc->chip->unmask(irq); | 226 | desc->chip->unmask(irq); |
225 | desc->status &= ~IRQ_MASKED; | 227 | desc->status &= ~IRQ_MASKED; |
226 | } | 228 | } |
@@ -237,7 +239,10 @@ static void default_disable(unsigned int irq) | |||
237 | */ | 239 | */ |
238 | static unsigned int default_startup(unsigned int irq) | 240 | static unsigned int default_startup(unsigned int irq) |
239 | { | 241 | { |
240 | irq_desc[irq].chip->enable(irq); | 242 | struct irq_desc *desc; |
243 | |||
244 | desc = irq_to_desc(irq); | ||
245 | desc->chip->enable(irq); | ||
241 | 246 | ||
242 | return 0; | 247 | return 0; |
243 | } | 248 | } |
@@ -247,8 +252,9 @@ static unsigned int default_startup(unsigned int irq) | |||
247 | */ | 252 | */ |
248 | static void default_shutdown(unsigned int irq) | 253 | static void default_shutdown(unsigned int irq) |
249 | { | 254 | { |
250 | struct irq_desc *desc = irq_desc + irq; | 255 | struct irq_desc *desc; |
251 | 256 | ||
257 | desc = irq_to_desc(irq); | ||
252 | desc->chip->mask(irq); | 258 | desc->chip->mask(irq); |
253 | desc->status |= IRQ_MASKED; | 259 | desc->status |= IRQ_MASKED; |
254 | } | 260 | } |
@@ -551,7 +557,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | |||
551 | return; | 557 | return; |
552 | } | 558 | } |
553 | 559 | ||
554 | desc = irq_desc + irq; | 560 | desc = irq_to_desc(irq); |
555 | 561 | ||
556 | if (!handle) | 562 | if (!handle) |
557 | handle = handle_bad_irq; | 563 | handle = handle_bad_irq; |
@@ -616,7 +622,7 @@ void __init set_irq_noprobe(unsigned int irq) | |||
616 | return; | 622 | return; |
617 | } | 623 | } |
618 | 624 | ||
619 | desc = irq_desc + irq; | 625 | desc = irq_to_desc(irq); |
620 | 626 | ||
621 | spin_lock_irqsave(&desc->lock, flags); | 627 | spin_lock_irqsave(&desc->lock, flags); |
622 | desc->status |= IRQ_NOPROBE; | 628 | desc->status |= IRQ_NOPROBE; |
@@ -634,7 +640,7 @@ void __init set_irq_probe(unsigned int irq) | |||
634 | return; | 640 | return; |
635 | } | 641 | } |
636 | 642 | ||
637 | desc = irq_desc + irq; | 643 | desc = irq_to_desc(irq); |
638 | 644 | ||
639 | spin_lock_irqsave(&desc->lock, flags); | 645 | spin_lock_irqsave(&desc->lock, flags); |
640 | desc->status &= ~IRQ_NOPROBE; | 646 | desc->status &= ~IRQ_NOPROBE; |