omap_hsmmc: Check wp and cd GPIO for -1
PATCH 1/1 omap_hsmmc: Check wp and cd GPIO for -1
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.
--- drivers/mmc/omap_hsmmc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mmc/omap_hsmmc.c +10 -2
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 1/1 omap_hsmmc: Check wp and cd GPIO for -1
drivers/mmc/omap_hsmmc.c static int omap_mmc_setup_gpio_in(int gpio, const char *label) · line 77
Quoted 4 lines · Tom Rini
int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;drivers/mmc/omap_hsmmc.c +2
-1-return gpio_get_value (cd_gpio); + +if (cd_gpio >=0 )
What about using gpio_is_valid(cd_gpio) ?
drivers/mmc/omap_hsmmc.c static int omap_mmc_setup_gpio_in(int gpio, const char *label) · line 80
Quoted 3 lines
drivers/mmc/omap_hsmmc.c +3
-0+return gpio_get_value (cd_gpio); + else + return -1;
What about -EINVAL?
PATCH 1/1 omap_hsmmc: Check wp and cd GPIO for -1
Quoted 8 lines · Fabio Estevam
drivers/mmc/omap_hsmmc.c static int omap_mmc_setup_gpio_in(int gpio, const char *label) · line 77
Quoted 4 lines · Tom Rini
int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;drivers/mmc/omap_hsmmc.c +2
-1-return gpio_get_value (cd_gpio); + +if (cd_gpio >=0 )What about using
gpio_is_valid(cd_gpio)?
OK, good point.
Quoted 5 lines
drivers/mmc/omap_hsmmc.c static int omap_mmc_setup_gpio_in(int gpio, const char *label) · line 80
Quoted 3 lines
drivers/mmc/omap_hsmmc.c +3
-0+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!
Signature · 8 lines
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>