* [U-Boot] [PATCH] omap_hsmmc: Check wp and cd GPIO for -1
@ 2013-03-20 18:32 Tom Rini
2013-03-20 18:37 ` Fabio Estevam
0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2013-03-20 18:32 UTC (permalink / raw)
To: u-boot
When we cannot check write protect or card change via GPIO (and have
been passed -1 in omap_mmc_init), only even try the GPIO if >= 0. This
prevents invalid GPIO messages from being seen on the console when doing
MMC operations.
Signed-off-by: Tom Rini <trini@ti.com>
---
drivers/mmc/omap_hsmmc.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 67cfcc2..5a63918 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -73,13 +73,21 @@ static int omap_mmc_setup_gpio_in(int gpio, const char *label)
static int omap_mmc_getcd(struct mmc *mmc)
{
int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
- return gpio_get_value(cd_gpio);
+
+ if (cd_gpio >= 0)
+ return gpio_get_value(cd_gpio);
+ else
+ return -1;
}
static int omap_mmc_getwp(struct mmc *mmc)
{
int wp_gpio = ((struct omap_hsmmc_data *)mmc->priv)->wp_gpio;
- return gpio_get_value(wp_gpio);
+
+ if (wp_gpio >= 0)
+ return gpio_get_value(wp_gpio);
+ else
+ return -1;
}
#else
static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] omap_hsmmc: Check wp and cd GPIO for -1
2013-03-20 18:32 [U-Boot] [PATCH] omap_hsmmc: Check wp and cd GPIO for -1 Tom Rini
@ 2013-03-20 18:37 ` Fabio Estevam
2013-03-20 18:41 ` Tom Rini
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2013-03-20 18:37 UTC (permalink / raw)
To: u-boot
On Wed, Mar 20, 2013 at 3:32 PM, Tom Rini <trini@ti.com> wrote:
> int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
> - return gpio_get_value(cd_gpio);
> +
> + if (cd_gpio >= 0)
What about using gpio_is_valid(cd_gpio) ?
> + return gpio_get_value(cd_gpio);
> + else
> + return -1;
What about -EINVAL?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] omap_hsmmc: Check wp and cd GPIO for -1
2013-03-20 18:37 ` Fabio Estevam
@ 2013-03-20 18:41 ` Tom Rini
0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2013-03-20 18:41 UTC (permalink / raw)
To: u-boot
On Wed, Mar 20, 2013 at 03:37:10PM -0300, Fabio Estevam wrote:
> On Wed, Mar 20, 2013 at 3:32 PM, Tom Rini <trini@ti.com> wrote:
>
> > int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
> > - return gpio_get_value(cd_gpio);
> > +
> > + if (cd_gpio >= 0)
>
> What about using gpio_is_valid(cd_gpio) ?
OK, good point.
> > + return gpio_get_value(cd_gpio);
> > + else
> > + return -1;
>
> What about -EINVAL?
Not consistent with the rest of the driver, so I'll do that in a 2/2.
Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130320/fc3bc287/attachment.pgp>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-20 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 18:32 [U-Boot] [PATCH] omap_hsmmc: Check wp and cd GPIO for -1 Tom Rini
2013-03-20 18:37 ` Fabio Estevam
2013-03-20 18:41 ` Tom Rini
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.