Re: [PATCH] mfd: da9052-core: Fix request_threaded_irq() parameter

From: Arnd Bergmann
Date: Thu Sep 27 2012 - 10:34:44 EST


On Thursday 27 September 2012, Mark Brown wrote:
> On Thu, Sep 27, 2012 at 12:55:35AM -0300, Fabio Estevam wrote:
> > From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> >
> > On a mx53qsb dt-kernel the da9052-core driver fails to probe:
> >
> > da9052 1-0048: DA9052 ADC IRQ failed ret=-22
> >
> > In request_threaded_irq() the first parameter is missing the da9052->irq_base.
> >
> > Fix it and avoid the error.
>
> The driver shouldn't be relying on irq_base at all, it should use
> regmap_get_virq() to look up the interrupt number. If it relies on
> irq_base then the user is forced to assign one (or rely on automatic
> assignment, which is a bit erratic. Otherwise it can use a linear
> domain which doesn't rely on being able to allocate a big block of
> interrupt numbers.

For all I can tell, the driver implements the automatic assignment
correctly, but I was also going to ask for removing the da9052->irq_base
variable and using the linear domain instead.

We don't have any platforms actually setting the irq_base in the
mainline kernel (I assume some of out tree platforms do this), but there
are a few drivers that need to be adapted to use regmap_irq_get_virq
or irq_to_desc(irq)->hw_irq, respectively:

drivers/gpio/gpio-da9052.c: return da9052->irq_base + DA9052_IRQ_GPI0 + offset;
drivers/input/touchscreen/da9052_tsi.c: tsi->irq_pendwn = da9052->irq_base + irq_pendwn;
drivers/input/touchscreen/da9052_tsi.c: tsi->irq_datardy = da9052->irq_base + irq_datardy;
drivers/power/da9052-battery.c: irq -= bat->da9052->irq_base;
drivers/power/da9052-battery.c: ret = request_threaded_irq(bat->da9052->irq_base + irq,
drivers/power/da9052-battery.c: free_irq(bat->da9052->irq_base + irq, bat);
drivers/power/da9052-battery.c: free_irq(bat->da9052->irq_base + irq, bat);

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/