linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix U300 generic GPIO, remove ifdefs from MMCI
@ 2009-09-27 19:08 Linus Walleij
  2009-09-28  1:46 ` Rabin Vincent
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2009-09-27 19:08 UTC (permalink / raw)
  To: linux-arm-kernel

The #ifdefs in the MMCI driver were erroneous and just masking
a bug in the U300 generic GPIO implementation. This removes the
ifdefs and fixes the U300 generic GPIO instead.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
 arch/arm/mach-u300/gpio.c              |    8 ++++++++
 arch/arm/mach-u300/include/mach/gpio.h |    1 +
 drivers/mmc/host/mmci.c                |    2 --
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-u300/gpio.c b/arch/arm/mach-u300/gpio.c
index 63c8f27..ce268ef 100644
--- a/arch/arm/mach-u300/gpio.c
+++ b/arch/arm/mach-u300/gpio.c
@@ -281,6 +281,14 @@ int gpio_unregister_callback(unsigned gpio)
 }
 EXPORT_SYMBOL(gpio_unregister_callback);
 
+int gpio_is_valid(int number)
+{
+	if (number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
+		return 0;
+	return -EINVAL;
+}
+EXPORT_SYMBOL(gpio_is_valid);
+
 int gpio_request(unsigned gpio, const char *label)
 {
 	if (gpio_pin[gpio].users)
diff --git a/arch/arm/mach-u300/include/mach/gpio.h b/arch/arm/mach-u300/include/mach/gpio.h
index c817412..7b1fc98 100644
--- a/arch/arm/mach-u300/include/mach/gpio.h
+++ b/arch/arm/mach-u300/include/mach/gpio.h
@@ -258,6 +258,7 @@
 #define PIN_TO_PORT(val) (val >> 3)
 
 /* These can be found in arch/arm/mach-u300/gpio.c */
+extern int gpio_is_valid(int number);
 extern int gpio_request(unsigned gpio, const char *label);
 extern void gpio_free(unsigned gpio);
 extern int gpio_direction_input(unsigned gpio);
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 3d1e532..705a589 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -678,7 +678,6 @@ 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)
@@ -697,7 +696,6 @@ 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.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] Fix U300 generic GPIO, remove ifdefs from MMCI
  2009-09-27 19:08 [PATCH] Fix U300 generic GPIO, remove ifdefs from MMCI Linus Walleij
@ 2009-09-28  1:46 ` Rabin Vincent
  0 siblings, 0 replies; 2+ messages in thread
From: Rabin Vincent @ 2009-09-28  1:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Sep 27, 2009 at 09:08:21PM +0200, Linus Walleij wrote:
> The #ifdefs in the MMCI driver were erroneous and just masking
> a bug in the U300 generic GPIO implementation. This removes the
> ifdefs and fixes the U300 generic GPIO instead.
> 
> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> ---
>  arch/arm/mach-u300/gpio.c              |    8 ++++++++
>  arch/arm/mach-u300/include/mach/gpio.h |    1 +
>  drivers/mmc/host/mmci.c                |    2 --
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-u300/gpio.c b/arch/arm/mach-u300/gpio.c
> index 63c8f27..ce268ef 100644
> --- a/arch/arm/mach-u300/gpio.c
> +++ b/arch/arm/mach-u300/gpio.c
> @@ -281,6 +281,14 @@ int gpio_unregister_callback(unsigned gpio)
>  }
>  EXPORT_SYMBOL(gpio_unregister_callback);
>  
> +int gpio_is_valid(int number)
> +{
> +	if (number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
> +		return 0;
> +	return -EINVAL;
> +}

gpio_is_valid() should return non-zero if the GPIO is valid, and zero
if it's not.   Also, number may be negative so this function needs to
check for that.

Rabin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-28  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-27 19:08 [PATCH] Fix U300 generic GPIO, remove ifdefs from MMCI Linus Walleij
2009-09-28  1:46 ` Rabin Vincent

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).