Skip to content

Commit

Permalink
mfd: Fix asic3_gpio_to_irq
Browse files Browse the repository at this point in the history
Assumption that irq numbers of asic3 gpios start at
IRQ_BOARD_START is certainly wrong - driver may as well
use any other base for its irqs (consider for example
the imaginary case of two ASIC3 chips onboard)

Furthermore, some platforms even don't have IRQ_BOARD_START
defined, so driver will fail to build on them:
-------------------------------------------------------
drivers/mfd/asic3.c: In function 'asic3_gpio_to_irq':
drivers/mfd/asic3.c:530: error: 'IRQ_BOARD_START' undeclared (first use in this function)
drivers/mfd/asic3.c:530: error: (Each undeclared identifier is reported only once
drivers/mfd/asic3.c:530: error: for each function it appears in.)
-------------------------------------------------------

Fix it by using irq_base from driver data.

Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Dmitry Artamonow authored and Samuel Ortiz committed Apr 16, 2012
1 parent 1fcb57d commit 02269ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mfd/asic3.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip,

static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO;
struct asic3 *asic = container_of(chip, struct asic3, gpio);

return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO;
}

static __init int asic3_gpio_probe(struct platform_device *pdev,
Expand Down

0 comments on commit 02269ab

Please sign in to comment.