OSDN Git Service

mmc: block: fix partition switch failure observed during shutdown
authorSahitya Tummala <stummala@codeaurora.org>
Thu, 5 Nov 2015 04:37:42 +0000 (10:07 +0530)
committerSubhash Jadavani <subhashj@codeaurora.org>
Tue, 31 May 2016 22:27:57 +0000 (15:27 -0700)
If an RPMB request is the last request to be done before shutdown,
then the card will be already switched to legacy mode as part of
RPMB request handling. Later, in the shutdown handler, we get this
error if we try to switch to legacy mode again.

mmc0: failed to switch card to legacy mode: -74

CRs-Fixed: 935717
Change-Id: Ie75ba225412d0fecce9c98f07334b570a6cd5772
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
drivers/mmc/card/block.c

index 120e457..50b8a4b 100644 (file)
@@ -3002,18 +3002,19 @@ static void mmc_blk_cmdq_shutdown(struct mmc_queue *mq)
        }
 
        /* disable CQ mode in card */
-       err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-                        EXT_CSD_CMDQ, 0,
-                        card->ext_csd.generic_cmd6_time);
-       if (err) {
-               pr_err("%s: failed to switch card to legacy mode: %d\n",
-                      __func__, err);
-               goto out;
-       } else {
+       if (mmc_card_cmdq(card)) {
+               err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+                                EXT_CSD_CMDQ, 0,
+                                card->ext_csd.generic_cmd6_time);
+               if (err) {
+                       pr_err("%s: failed to switch card to legacy mode: %d\n",
+                              __func__, err);
+                       goto out;
+               }
                mmc_card_clr_cmdq(card);
-               host->cmdq_ops->disable(host, false);
-               host->card->cmdq_init = false;
        }
+       host->cmdq_ops->disable(host, false);
+       host->card->cmdq_init = false;
 out:
        mmc_host_clk_release(host);
        mmc_put_card(card);