summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-04-22 17:03:17 +0200
committerHans de Goede <hdegoede@redhat.com>2015-05-04 16:51:52 +0200
commit90641f82f1700553640103bf58017c303be4e604 (patch)
tree3bda43e4e97ffc1053d6623eaa6e9f1aa53916be /drivers/mmc
parent8b2db32a9f368672e51e90e46f5cba0dae8cbd52 (diff)
downloadblackbird-obmc-uboot-90641f82f1700553640103bf58017c303be4e604.tar.gz
blackbird-obmc-uboot-90641f82f1700553640103bf58017c303be4e604.zip
sunxi: mmc: Fix card-detect gpio handling to work with the driver-model
The driver-model gpio functions may return another value then -1 as error, make the sunxi mmc code properly handle this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/sunxi_mmc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 1c234e2eda..c4300f25fd 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
+#include <errno.h>
#include <malloc.h>
#include <mmc.h>
#include <asm/io.h>
@@ -37,7 +38,7 @@ static int sunxi_mmc_getcd_gpio(int sdc_no)
case 2: return sunxi_name_to_gpio(CONFIG_MMC2_CD_PIN);
case 3: return sunxi_name_to_gpio(CONFIG_MMC3_CD_PIN);
}
- return -1;
+ return -EINVAL;
}
static int mmc_resource_init(int sdc_no)
@@ -72,7 +73,7 @@ static int mmc_resource_init(int sdc_no)
mmchost->mmc_no = sdc_no;
cd_pin = sunxi_mmc_getcd_gpio(sdc_no);
- if (cd_pin != -1) {
+ if (cd_pin >= 0) {
ret = gpio_request(cd_pin, "mmc_cd");
if (!ret)
ret = gpio_direction_input(cd_pin);
@@ -424,7 +425,7 @@ static int sunxi_mmc_getcd(struct mmc *mmc)
int cd_pin;
cd_pin = sunxi_mmc_getcd_gpio(mmchost->mmc_no);
- if (cd_pin == -1)
+ if (cd_pin < 0)
return 1;
return !gpio_get_value(cd_pin);
OpenPOWER on IntegriCloud