Commit 94964f96 authored by Samuel Ortiz's avatar Samuel Ortiz Committed by Samuel Ortiz

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: default avatarSamuel Ortiz <sameo@openedhand.com>
parent 342d765e
...@@ -180,10 +180,15 @@ static struct completion irq_event; ...@@ -180,10 +180,15 @@ static struct completion irq_event;
static int twl4030_irq_thread(void *data) static int twl4030_irq_thread(void *data)
{ {
long irq = (long)data; long irq = (long)data;
irq_desc_t *desc = irq_desc + irq; struct irq_desc *desc = irq_to_desc(irq);
static unsigned i2c_errors; static unsigned i2c_errors;
const static unsigned max_i2c_errors = 100; const static unsigned max_i2c_errors = 100;
if (!desc) {
pr_err("twl4030: Invalid IRQ: %ld\n", irq);
return -EINVAL;
}
current->flags |= PF_NOFREEZE; current->flags |= PF_NOFREEZE;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
...@@ -215,7 +220,13 @@ static int twl4030_irq_thread(void *data) ...@@ -215,7 +220,13 @@ static int twl4030_irq_thread(void *data)
pih_isr; pih_isr;
pih_isr >>= 1, module_irq++) { pih_isr >>= 1, module_irq++) {
if (pih_isr & 0x1) { if (pih_isr & 0x1) {
irq_desc_t *d = irq_desc + module_irq; struct irq_desc *d = irq_to_desc(module_irq);
if (!d) {
pr_err("twl4030: Invalid SIH IRQ: %d\n",
module_irq);
return -EINVAL;
}
/* These can't be masked ... always warn /* These can't be masked ... always warn
* if we get any surprises. * if we get any surprises.
...@@ -452,10 +463,16 @@ static void twl4030_sih_do_edge(struct work_struct *work) ...@@ -452,10 +463,16 @@ static void twl4030_sih_do_edge(struct work_struct *work)
/* Modify only the bits we know must change */ /* Modify only the bits we know must change */
while (edge_change) { while (edge_change) {
int i = fls(edge_change) - 1; int i = fls(edge_change) - 1;
struct irq_desc *d = irq_desc + i + agent->irq_base; struct irq_desc *d = irq_to_desc(i + agent->irq_base);
int byte = 1 + (i >> 2); int byte = 1 + (i >> 2);
int off = (i & 0x3) * 2; int off = (i & 0x3) * 2;
if (!d) {
pr_err("twl4030: Invalid IRQ: %d\n",
i + agent->irq_base);
return;
}
bytes[byte] &= ~(0x03 << off); bytes[byte] &= ~(0x03 << off);
spin_lock_irq(&d->lock); spin_lock_irq(&d->lock);
...@@ -512,9 +529,14 @@ static void twl4030_sih_unmask(unsigned irq) ...@@ -512,9 +529,14 @@ static void twl4030_sih_unmask(unsigned irq)
static int twl4030_sih_set_type(unsigned irq, unsigned trigger) static int twl4030_sih_set_type(unsigned irq, unsigned trigger)
{ {
struct sih_agent *sih = get_irq_chip_data(irq); struct sih_agent *sih = get_irq_chip_data(irq);
struct irq_desc *desc = irq_desc + irq; struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
if (!desc) {
pr_err("twl4030: Invalid IRQ: %d\n", irq);
return -EINVAL;
}
if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment