From: Grant Likely <grant.likely@secretlab.ca>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Mark Asselstine <mark.asselstine@windriver.com>
Cc: linux-next@vger.kernel.org, openezx-devel@lists.openezx.org,
sameo@linux.intel.com, linux-arm-kernel@lists.infradead.org,
haojian.zhuang@marvell.com
Subject: Re: [PATCH] ARM:mfd: fix ezx-pcap build failure
Date: Fri, 27 Apr 2012 10:09:13 -0600 [thread overview]
Message-ID: <20120427160913.87CE93E1290@localhost> (raw)
In-Reply-To: <20120426215258.GG24211@n2100.arm.linux.org.uk>
On Thu, 26 Apr 2012 22:52:58 +0100, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Wed, Apr 25, 2012 at 11:02:43AM -0400, Mark Asselstine wrote:
> > Attempting to build the ezx_defconfig we get a build failure:
> >
> > drivers/mfd/ezx-pcap.c: In function 'pcap_isr_work':
> > drivers/mfd/ezx-pcap.c:205: error: implicit declaration of function 'irq_to_gpio'
> >
> > Looking at this failure we can find that commit 4929f5a8a99f
> > [ARM:pxa: rename gpio_to_irq and irq_to_gpio] renamed irq_to_gpio()
> > to pxa_irq_to_gpio() but this change was not made in the ezx-pcap
> > driver.
>
> That's because drivers shouldn't have knowledge about the SoC they're
> running on. This driver is not restricted to only being built for PXA,
> and so with your change, this will cause a link error should this be
> built on non-PXA.
>
> However, there's a big problem with code using irq_to_gpio() or any
> variant of that in this manner:
>
> } while (gpio_get_value(irq_to_gpio(pcap->spi->irq)));
>
> What is the effect when the supplied IRQ does not have a mapping to a
> GPIO - or it _does_ by way of a badly coded irq_to_gpio() function
> but that GPIO is not the correct one.
... like if multiple gpios map to the same IRQ.
> There is no prevention against endlessly looping, so it could cause a
> system lockup.
>
> The real answer is to fix SPI et.al. so that its possible to pass the
> _GPIO_ number into this driver (that's what the driver wants for its
> interrupt line after all). To fix that, SPI folk need to get involved
> (added Grant as a first step.)
This doesn't look like a core SPI problem to me. This specific driver
needs a gpio connection to work and therefore it should be passed in
via either the DT binding or platform_data as Mark suggests.
g.
WARNING: multiple messages have this Message-ID (diff)
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM:mfd: fix ezx-pcap build failure
Date: Fri, 27 Apr 2012 10:09:13 -0600 [thread overview]
Message-ID: <20120427160913.87CE93E1290@localhost> (raw)
In-Reply-To: <20120426215258.GG24211@n2100.arm.linux.org.uk>
On Thu, 26 Apr 2012 22:52:58 +0100, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Wed, Apr 25, 2012 at 11:02:43AM -0400, Mark Asselstine wrote:
> > Attempting to build the ezx_defconfig we get a build failure:
> >
> > drivers/mfd/ezx-pcap.c: In function 'pcap_isr_work':
> > drivers/mfd/ezx-pcap.c:205: error: implicit declaration of function 'irq_to_gpio'
> >
> > Looking at this failure we can find that commit 4929f5a8a99f
> > [ARM:pxa: rename gpio_to_irq and irq_to_gpio] renamed irq_to_gpio()
> > to pxa_irq_to_gpio() but this change was not made in the ezx-pcap
> > driver.
>
> That's because drivers shouldn't have knowledge about the SoC they're
> running on. This driver is not restricted to only being built for PXA,
> and so with your change, this will cause a link error should this be
> built on non-PXA.
>
> However, there's a big problem with code using irq_to_gpio() or any
> variant of that in this manner:
>
> } while (gpio_get_value(irq_to_gpio(pcap->spi->irq)));
>
> What is the effect when the supplied IRQ does not have a mapping to a
> GPIO - or it _does_ by way of a badly coded irq_to_gpio() function
> but that GPIO is not the correct one.
... like if multiple gpios map to the same IRQ.
> There is no prevention against endlessly looping, so it could cause a
> system lockup.
>
> The real answer is to fix SPI et.al. so that its possible to pass the
> _GPIO_ number into this driver (that's what the driver wants for its
> interrupt line after all). To fix that, SPI folk need to get involved
> (added Grant as a first step.)
This doesn't look like a core SPI problem to me. This specific driver
needs a gpio connection to work and therefore it should be passed in
via either the DT binding or platform_data as Mark suggests.
g.
next prev parent reply other threads:[~2012-04-27 16:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 15:02 [PATCH] ARM:mfd: fix ezx-pcap build failure Mark Asselstine
2012-04-25 15:02 ` Mark Asselstine
2012-04-26 21:52 ` Russell King - ARM Linux
2012-04-26 21:52 ` Russell King - ARM Linux
2012-04-26 22:04 ` Mark Brown
2012-04-26 22:04 ` Mark Brown
2012-04-27 15:28 ` Mark Asselstine
2012-04-27 15:28 ` Mark Asselstine
2012-04-27 18:02 ` Mark Brown
2012-04-27 18:02 ` Mark Brown
2012-04-30 17:26 ` Mark Asselstine
2012-04-30 17:26 ` Mark Asselstine
2012-04-27 16:09 ` Grant Likely [this message]
2012-04-27 16:09 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120427160913.87CE93E1290@localhost \
--to=grant.likely@secretlab.ca \
--cc=haojian.zhuang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-next@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.asselstine@windriver.com \
--cc=openezx-devel@lists.openezx.org \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.