mmc: core/card: maintain clock gating reference count integrity

Clock gating logic maintains the reference count which gets incremented
with *hold* API call and get decremented with *release* API call.
If we want to make sure that clocks are enabled during some operation,
we should call *hold* API before the operation and then call *release*
API after the operation is finished. So *hold* and *release* should be
in pair and called exactly once per operation, any violation of these
rules may put the reference count out of sync and can cause issues
(like unclocked register access). This change fixes the places where
this can go out of sync.

Change-Id: I2d784cc31027a551a466beec63ee8cd0a1f67af7
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Subhash Jadavani 2015-10-20 18:01:53 -07:00
parent 603e5ef719
commit 2304056223
2 changed files with 2 additions and 3 deletions

View file

@ -2989,7 +2989,7 @@ static void mmc_blk_cmdq_shutdown(struct mmc_queue *mq)
err = mmc_cmdq_halt(host, true); err = mmc_cmdq_halt(host, true);
if (err) { if (err) {
pr_err("%s: halt: failed: %d\n", __func__, err); pr_err("%s: halt: failed: %d\n", __func__, err);
return; goto out;
} }
/* disable CQ mode in card */ /* disable CQ mode in card */

View file

@ -1541,8 +1541,7 @@ static int mmc_select_cmdq(struct mmc_card *card)
mmc_card_clr_cmdq(card); mmc_card_clr_cmdq(card);
ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_CMDQ, 0, ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_CMDQ, 0,
card->ext_csd.generic_cmd6_time); card->ext_csd.generic_cmd6_time);
if (ret) goto out;
goto out;
} }
mmc_host_clk_release(card->host); mmc_host_clk_release(card->host);