Skip to contentSkip to conversation

Fix U300 generic GPIO, remove ifdefs from MMCI v2

PATCH New Linus Walleij 3 participants 5 messages Sep 28, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix U300 generic GPIO, remove ifdefs from MMCI v2

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.

---
This version is hopefully correct for the API. Sorry for the mess again and thanks to Russell and Rabin Vincent for pointing me in the right direction on this one.

---
 arch/arm/mach-u300/gpio.c              |   11 +++++++++++
 arch/arm/mach-u300/include/mach/gpio.h |    1 +
 drivers/mmc/host/mmci.c                |    2 --
 3 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-u300/gpio.c +11 -0
index 63c8f27..0d3bbe2 100644
@@ -281,6 +281,17 @@ int gpio_unregister_callback(unsigned gpio)
 }
 EXPORT_SYMBOL(gpio_unregister_callback);
 
+int gpio_is_valid(int number)
+{
+	if (number >= 0 &&
+	    number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
+		/* Non-zero means valid */
+		return 1;
+	/* Else it's invalid, zero */
+	return 0;
+}
+EXPORT_SYMBOL(gpio_is_valid);
+
 int gpio_request(unsigned gpio, const char *label)
 {
 	if (gpio_pin[gpio].users)
arch/arm/mach-u300/include/mach/gpio.h +1 -0
index c817412..7b1fc98 100644
@@ -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);
drivers/mmc/host/mmci.c +0 -2
index 3d1e532..705a589 100644
@@ -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)
Signature · 1 line
1.6.2.1
#1 lore raw

PATCH 1/1 Fix U300 generic GPIO, remove ifdefs from MMCI v2

Quoted 3 lines · Linus Walleij

This version is hopefully correct for the API. Sorry for the mess again and thanks to Russell and Rabin Vincent for pointing me in the right direction on this one.

I feel the comments in the code are too much. Maybe a single comment about the return value above the function would be sufficient?

#2 lore raw

PATCH 1/1 Fix U300 generic GPIO, remove ifdefs from MMCI v2

2009/9/28 Russell King - ARM Linux <[email protected]>:

Quoted 7 lines · Linus Walleij
Quoted 3 lines

This version is hopefully correct for the API. Sorry for the mess again and thanks to Russell and Rabin Vincent for pointing me in the right direction on this one.

I feel the comments in the code are too much. ?Maybe a single comment about the return value above the function would be sufficient?

OK there is a v3 redux version in the patch tracker with a single comment. Thanks Russell!

Linus Walleij

#3 lore raw

PATCH 1/1 Fix U300 generic GPIO, remove ifdefs from MMCI v2

In reply to Linus Walleij

And as a procedural note, can you please avoid immediately throwing the patch into the patch system in unison with posting it to the mailing list for review? Please wait a few days for comments on the review posting before submitting it to the patch system.

#4 lore raw

PATCH 1/1 Fix U300 generic GPIO, remove ifdefs from MMCI v2

2009/9/28 Russell King - ARM Linux <[email protected]>:

Quoted 4 lines

And as a procedural note, can you please avoid immediately throwing the patch into the patch system in unison with posting it to the mailing list for review? ?Please wait a few days for comments on the review posting before submitting it to the patch system.

Yep no problem... I've marked the recent v3 version as "on-hold" in the patch tracker.

Linus Walleij