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>
This commit is contained in:
Samuel Ortiz 2008-12-18 11:38:02 +01:00 committed by Samuel Ortiz
parent 342d765e01
commit 94964f96a6

View file

@ -180,10 +180,15 @@ static struct completion irq_event;
static int twl4030_irq_thread(void *data)
{
long irq = (long)data;
irq_desc_t *desc = irq_desc + irq;
struct irq_desc *desc = irq_to_desc(irq);
static unsigned i2c_errors;
const static unsigned max_i2c_errors = 100;
if (!desc) {
pr_err("twl4030: Invalid IRQ: %ld\n", irq);
return -EINVAL;
}
current->flags |= PF_NOFREEZE;
while (!kthread_should_stop()) {
@ -215,7 +220,13 @@ static int twl4030_irq_thread(void *data)
pih_isr;
pih_isr >>= 1, module_irq++) {
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
* if we get any surprises.
@ -452,10 +463,16 @@ static void twl4030_sih_do_edge(struct work_struct *work)
/* Modify only the bits we know must change */
while (edge_change) {
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 off = (i & 0x3) * 2;
if (!d) {
pr_err("twl4030: Invalid IRQ: %d\n",
i + agent->irq_base);
return;
}
bytes[byte] &= ~(0x03 << off);
spin_lock_irq(&d->lock);
@ -512,9 +529,14 @@ static void twl4030_sih_unmask(unsigned irq)
static int twl4030_sih_set_type(unsigned irq, unsigned trigger)
{
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;
if (!desc) {
pr_err("twl4030: Invalid IRQ: %d\n", irq);
return -EINVAL;
}
if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
return -EINVAL;