* [PATCH] Make MMCI driver compile without gpiolib
@ 2009-08-26 8:56 Linus Walleij
2009-09-27 15:31 ` Russell King - ARM Linux
0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2009-08-26 8:56 UTC (permalink / raw)
To: linux-arm-kernel
The recent addition of optional gpiolib support to check if a
card was inserted or write protected was really not optional.
It needs this ifdef to become optional so that U300 compiles,
for example.
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/mmc/host/mmci.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 5eb86a8..a923ee2 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -619,6 +619,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
writel(0, host->base + MMCIMASK1);
writel(0xfff, host->base + MMCICLEAR);
+#ifdef CONFIG_GPIOLIB
if (gpio_is_valid(plat->gpio_cd)) {
ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)");
if (ret == 0)
@@ -637,6 +638,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
else if (ret != -ENOSYS)
goto err_gpio_wp;
}
+#endif
ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host);
if (ret)
--
1.6.2.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] Make MMCI driver compile without gpiolib
2009-08-26 8:56 [PATCH] Make MMCI driver compile without gpiolib Linus Walleij
@ 2009-09-27 15:31 ` Russell King - ARM Linux
2009-09-27 19:11 ` Linus Walleij
2009-09-28 19:00 ` Linus Walleij
0 siblings, 2 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2009-09-27 15:31 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Aug 26, 2009 at 10:56:28AM +0200, Linus Walleij wrote:
> The recent addition of optional gpiolib support to check if a
> card was inserted or write protected was really not optional.
> It needs this ifdef to become optional so that U300 compiles,
> for example.
Looking back at this, I don't think this ifdef is required.
Why?
We're using linux/gpio.h, which provides dummy definitions for the
GPIO functions of GENERIC_GPIO is not set. If GENERIC_GPIO is set,
then GPIOs are available, and can be used.
GPIOLIB is entirely a different matter, and doesn't really indicate
whether GPIO support is available or not.
The real problem is that U300 doesn't implement gpio_is_valid() -
which is part of the GPIO API and not specific to GPIOLIB.
Please implement this function, and let's revert this (wrong) patch.
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index 5eb86a8..a923ee2 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -619,6 +619,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
> writel(0, host->base + MMCIMASK1);
> writel(0xfff, host->base + MMCICLEAR);
>
> +#ifdef CONFIG_GPIOLIB
> if (gpio_is_valid(plat->gpio_cd)) {
> ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)");
> if (ret == 0)
> @@ -637,6 +638,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
> else if (ret != -ENOSYS)
> goto err_gpio_wp;
> }
> +#endif
>
> ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host);
> if (ret)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] Make MMCI driver compile without gpiolib
2009-09-27 15:31 ` Russell King - ARM Linux
@ 2009-09-27 19:11 ` Linus Walleij
2009-09-28 19:00 ` Linus Walleij
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2009-09-27 19:11 UTC (permalink / raw)
To: linux-arm-kernel
2009/9/27 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> Looking back at this, I don't think this ifdef is required.
You're righ of course, sorry for that. Fix-up patch just posted,
also in the patch tracker. Reverts these #ifdef:s and fix the root
problem instead.
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Make MMCI driver compile without gpiolib
2009-09-27 15:31 ` Russell King - ARM Linux
2009-09-27 19:11 ` Linus Walleij
@ 2009-09-28 19:00 ` Linus Walleij
2009-09-28 19:18 ` Baruch Siach
2009-09-28 20:03 ` Russell King - ARM Linux
1 sibling, 2 replies; 6+ messages in thread
From: Linus Walleij @ 2009-09-28 19:00 UTC (permalink / raw)
To: linux-arm-kernel
Hm thinking back at this:
2009/9/27 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> The real problem is that U300 doesn't implement gpio_is_valid() -
> which is part of the GPIO API and not specific to GPIOLIB.
None of the GPIO drivers in drivers/gpio implement gpio_is_valid()
though they all select GPIOLIB which in turn selects GENERIC_GPIO.
With one of them being the PL061 this means that the not so
unlikely combination of PL061+PL180 will fail to compile (even
though I'm not aware of such a platform for the time being).
Is it worth taking a run over drivers/gpio and try to fix this or
atleast the PL061 driver? I can have a look at it.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Make MMCI driver compile without gpiolib
2009-09-28 19:00 ` Linus Walleij
@ 2009-09-28 19:18 ` Baruch Siach
2009-09-28 20:03 ` Russell King - ARM Linux
1 sibling, 0 replies; 6+ messages in thread
From: Baruch Siach @ 2009-09-28 19:18 UTC (permalink / raw)
To: linux-arm-kernel
Hi Linus,
On Mon, Sep 28, 2009 at 09:00:01PM +0200, Linus Walleij wrote:
> Hm thinking back at this:
>
> 2009/9/27 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>
> > The real problem is that U300 doesn't implement gpio_is_valid() -
> > which is part of the GPIO API and not specific to GPIOLIB.
>
> None of the GPIO drivers in drivers/gpio implement gpio_is_valid()
> though they all select GPIOLIB which in turn selects GENERIC_GPIO.
>
> With one of them being the PL061 this means that the not so
> unlikely combination of PL061+PL180 will fail to compile (even
> though I'm not aware of such a platform for the time being).
Shouldn't gpio_is_valid() be implemented at the platform code? How should the
generic GPIO driver know the number of valid GPIO lines, or the number of
PL061 blocks for that matter?
> Is it worth taking a run over drivers/gpio and try to fix this or
> atleast the PL061 driver? I can have a look at it.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] Make MMCI driver compile without gpiolib
2009-09-28 19:00 ` Linus Walleij
2009-09-28 19:18 ` Baruch Siach
@ 2009-09-28 20:03 ` Russell King - ARM Linux
1 sibling, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2009-09-28 20:03 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Sep 28, 2009 at 09:00:01PM +0200, Linus Walleij wrote:
> Hm thinking back at this:
>
> 2009/9/27 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>
> > The real problem is that U300 doesn't implement gpio_is_valid() -
> > which is part of the GPIO API and not specific to GPIOLIB.
>
> None of the GPIO drivers in drivers/gpio implement gpio_is_valid()
> though they all select GPIOLIB which in turn selects GENERIC_GPIO.
include/asm-generic/gpio.h:
#ifdef CONFIG_GPIOLIB
...
/* Platforms may implement their GPIO interface with library code,
* at a small performance cost for non-inlined operations and some
* extra memory (for code and for per-GPIO table entries).
*
* While the GPIO programming interface defines valid GPIO numbers
* to be in the range 0..MAX_INT, this library restricts them to the
* smaller range 0..ARCH_NR_GPIOS-1.
*/
#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS 256
#endif
static inline int gpio_is_valid(int number)
{
/* only some non-negative numbers are valid */
return ((unsigned)number) < ARCH_NR_GPIOS;
}
So, with gpiolib enabled, gpio_is_valid() is predefined assuming that
GPIOs between 0..ARCH_NR_GPIOS are valid.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-28 20:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 8:56 [PATCH] Make MMCI driver compile without gpiolib Linus Walleij
2009-09-27 15:31 ` Russell King - ARM Linux
2009-09-27 19:11 ` Linus Walleij
2009-09-28 19:00 ` Linus Walleij
2009-09-28 19:18 ` Baruch Siach
2009-09-28 20:03 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).