* [PATCH] mfd: asic3: fix asic3_gpio_to_irq
@ 2012-04-12 11:33 Dmitry Artamonow
2012-04-16 16:58 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Artamonow @ 2012-04-12 11:33 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Dmitry Artamonow, Paul Parsons, Philipp Zabel, linux-kernel
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>
---
drivers/mfd/asic3.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
For reference: the build failure above can be reproduced
for example when building kernel for some StrongARM
machine, say:
make h3600_defconfig
make menuconfig #enable CONFIG_MFD_ASIC3
make
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 1895cf9..1582c3d 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -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,
--
1.7.5.1.300.gc565c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: asic3: fix asic3_gpio_to_irq
2012-04-12 11:33 [PATCH] mfd: asic3: fix asic3_gpio_to_irq Dmitry Artamonow
@ 2012-04-16 16:58 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2012-04-16 16:58 UTC (permalink / raw)
To: Dmitry Artamonow; +Cc: Paul Parsons, Philipp Zabel, linux-kernel
Hi Dmitry,
On Thu, Apr 12, 2012 at 03:33:34PM +0400, Dmitry Artamonow wrote:
> 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>
> ---
> drivers/mfd/asic3.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
Thanks, I applied this one to my for-linus branch.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-16 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 11:33 [PATCH] mfd: asic3: fix asic3_gpio_to_irq Dmitry Artamonow
2012-04-16 16:58 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®