Skip to content

Commit

Permalink
mmc: core: Avoid hogging the CPU while polling for busy for mmc ioctls
Browse files Browse the repository at this point in the history
[ Upstream commit 4681081 ]

When __mmc_blk_ioctl_cmd() calls card_busy_detect() to verify that the
card's states moves back into transfer state, the polling with CMD13 is
done without any delays in between the commands being sent.

Rather than fixing card_busy_detect() in this regards, let's instead
convert into using the common mmc_poll_for_busy(), which also helps us to
avoid open-coding.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Link: https://lore.kernel.org/r/20210702134229.357717-3-ulf.hansson@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
storulf authored and gregkh committed Sep 18, 2021
1 parent 0c8b583 commit 00d27b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mmc/core/block.c
Expand Up @@ -605,7 +605,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
* Ensure RPMB/R1B command has completed by polling CMD13
* "Send Status".
*/
err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, NULL);
err = mmc_poll_for_busy(card, MMC_BLK_TIMEOUT_MS, false,
MMC_BUSY_IO);
}

return err;
Expand Down

0 comments on commit 00d27b4

Please sign in to comment.