From: wlq Date: Tue, 23 May 2017 11:32:42 +0000 (+0800) Subject: drivers: vendor_storage: add retry when emmc initialize failed X-Git-Tag: release-20171130_firefly~4^2~522 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=31ced208e26bc740867a1f5add09cd25d33da2b3;p=firefly-linux-kernel-4.4.55.git drivers: vendor_storage: add retry when emmc initialize failed Change-Id: I28202c5e3a4eb9ab58a430f40ff5e969fd110f54 Signed-off-by: Wu Liangqing --- diff --git a/drivers/soc/rockchip/sdmmc_vendor_storage.c b/drivers/soc/rockchip/sdmmc_vendor_storage.c index a0b546226efb..fa00a3dd0c36 100644 --- a/drivers/soc/rockchip/sdmmc_vendor_storage.c +++ b/drivers/soc/rockchip/sdmmc_vendor_storage.c @@ -99,7 +99,7 @@ static int emmc_vendor_storage_init(void) g_vendor = kmalloc(sizeof(*g_vendor), GFP_KERNEL | GFP_DMA); if (!g_vendor) - return -1; + return -ENOMEM; max_ver = 0; max_index = 0; @@ -149,7 +149,7 @@ static int emmc_vendor_read(u32 id, void *pbuf, u32 size) u32 i; if (!g_vendor) - return -1; + return -ENOMEM; for (i = 0; i < g_vendor->item_num; i++) { if (g_vendor->item[i].id == id) { @@ -560,11 +560,17 @@ static struct miscdevice vender_storage_dev = { static int vendor_init_thread(void *arg) { - int ret; + int ret, try_count = 5; + + do { + ret = emmc_vendor_storage_init(); + if (!ret) { + break; + } + /* sleep 500ms wait emmc initialize completed */ + msleep(500); + } while (try_count--); - /* sleep 500ms wait emmc initialize completed */ - msleep(500); - ret = emmc_vendor_storage_init(); if (!ret) { ret = misc_register(&vender_storage_dev); rk_vendor_register(emmc_vendor_read, emmc_vendor_write);