diff options
author | Samuel Ortiz <sameo@openedhand.com> | 2008-12-18 05:38:02 -0500 |
---|---|---|
committer | Samuel Ortiz <samuel@sortiz.org> | 2009-01-04 06:17:42 -0500 |
commit | 94964f96a6b7018d68b7386cd8c0b8505d3cf69f (patch) | |
tree | cee94e998a901ffb9da336637cbade691bc0167f /drivers/mfd/twl4030-irq.c | |
parent | 342d765e011f9cbe4292119a9164f76ccf0b922a (diff) |
mfd: Use irq_to_desc in twl4030 code
The global irq_desc array is soon going to be accessible only with
!CONFIG_SPARSE_IRQ. We should start using the generic irq_to_desc()
routines instead.
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers/mfd/twl4030-irq.c')
-rw-r--r-- | drivers/mfd/twl4030-irq.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index fae868a8d499..b10876036983 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
@@ -180,10 +180,15 @@ static struct completion irq_event; | |||
180 | static int twl4030_irq_thread(void *data) | 180 | static int twl4030_irq_thread(void *data) |
181 | { | 181 | { |
182 | long irq = (long)data; | 182 | long irq = (long)data; |
183 | irq_desc_t *desc = irq_desc + irq; | 183 | struct irq_desc *desc = irq_to_desc(irq); |
184 | static unsigned i2c_errors; | 184 | static unsigned i2c_errors; |
185 | const static unsigned max_i2c_errors = 100; | 185 | const static unsigned max_i2c_errors = 100; |
186 | 186 | ||
187 | if (!desc) { | ||
188 | pr_err("twl4030: Invalid IRQ: %ld\n", irq); | ||
189 | return -EINVAL; | ||
190 | } | ||
191 | |||
187 | current->flags |= PF_NOFREEZE; | 192 | current->flags |= PF_NOFREEZE; |
188 | 193 | ||
189 | while (!kthread_should_stop()) { | 194 | while (!kthread_should_stop()) { |
@@ -215,7 +220,13 @@ static int twl4030_irq_thread(void *data) | |||
215 | pih_isr; | 220 | pih_isr; |
216 | pih_isr >>= 1, module_irq++) { | 221 | pih_isr >>= 1, module_irq++) { |
217 | if (pih_isr & 0x1) { | 222 | if (pih_isr & 0x1) { |
218 | irq_desc_t *d = irq_desc + module_irq; | 223 | struct irq_desc *d = irq_to_desc(module_irq); |
224 | |||
225 | if (!d) { | ||
226 | pr_err("twl4030: Invalid SIH IRQ: %d\n", | ||
227 | module_irq); | ||
228 | return -EINVAL; | ||
229 | } | ||
219 | 230 | ||
220 | /* These can't be masked ... always warn | 231 | /* These can't be masked ... always warn |
221 | * if we get any surprises. | 232 | * if we get any surprises. |
@@ -452,10 +463,16 @@ static void twl4030_sih_do_edge(struct work_struct *work) | |||
452 | /* Modify only the bits we know must change */ | 463 | /* Modify only the bits we know must change */ |
453 | while (edge_change) { | 464 | while (edge_change) { |
454 | int i = fls(edge_change) - 1; | 465 | int i = fls(edge_change) - 1; |
455 | struct irq_desc *d = irq_desc + i + agent->irq_base; | 466 | struct irq_desc *d = irq_to_desc(i + agent->irq_base); |
456 | int byte = 1 + (i >> 2); | 467 | int byte = 1 + (i >> 2); |
457 | int off = (i & 0x3) * 2; | 468 | int off = (i & 0x3) * 2; |
458 | 469 | ||
470 | if (!d) { | ||
471 | pr_err("twl4030: Invalid IRQ: %d\n", | ||
472 | i + agent->irq_base); | ||
473 | return; | ||
474 | } | ||
475 | |||
459 | bytes[byte] &= ~(0x03 << off); | 476 | bytes[byte] &= ~(0x03 << off); |
460 | 477 | ||
461 | spin_lock_irq(&d->lock); | 478 | spin_lock_irq(&d->lock); |
@@ -512,9 +529,14 @@ static void twl4030_sih_unmask(unsigned irq) | |||
512 | static int twl4030_sih_set_type(unsigned irq, unsigned trigger) | 529 | static int twl4030_sih_set_type(unsigned irq, unsigned trigger) |
513 | { | 530 | { |
514 | struct sih_agent *sih = get_irq_chip_data(irq); | 531 | struct sih_agent *sih = get_irq_chip_data(irq); |
515 | struct irq_desc *desc = irq_desc + irq; | 532 | struct irq_desc *desc = irq_to_desc(irq); |
516 | unsigned long flags; | 533 | unsigned long flags; |
517 | 534 | ||
535 | if (!desc) { | ||
536 | pr_err("twl4030: Invalid IRQ: %d\n", irq); | ||
537 | return -EINVAL; | ||
538 | } | ||
539 | |||
518 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 540 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
519 | return -EINVAL; | 541 | return -EINVAL; |
520 | 542 | ||