mmc: mediatek: fix cannot receive new request when msdc_cmd_is_ready fail
authorChaotian Jing <chaotian.jing@mediatek.com>
Sat, 13 Oct 2018 07:20:47 +0000 (15:20 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 15 Oct 2018 13:00:29 +0000 (15:00 +0200)
when msdc_cmd_is_ready return fail, the req_timeout work has not been
inited and cancel_delayed_work() will return false, then, the request
return directly and never call mmc_request_done().

so need call mod_delayed_work() before msdc_cmd_is_ready()

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/mtk-sd.c

index ef45f1dd33b77f23919c13180251d0640146e0c2..fe80a1d9f000e1b649014b19f21137673eb22aaa 100644 (file)
@@ -1059,6 +1059,7 @@ static void msdc_start_command(struct msdc_host *host,
        WARN_ON(host->cmd);
        host->cmd = cmd;
 
+       mod_delayed_work(system_wq, &host->req_timeout, DAT_TIMEOUT);
        if (!msdc_cmd_is_ready(host, mrq, cmd))
                return;
 
@@ -1070,7 +1071,6 @@ static void msdc_start_command(struct msdc_host *host,
 
        cmd->error = 0;
        rawcmd = msdc_cmd_prepare_raw_cmd(host, mrq, cmd);
-       mod_delayed_work(system_wq, &host->req_timeout, DAT_TIMEOUT);
 
        sdr_set_bits(host->base + MSDC_INTEN, cmd_ints_mask);
        writel(cmd->arg, host->base + SDC_ARG);