mmc: block: stop BKOPs before handling RPMB and ioctl

IOCTL and RPMB commands can be issued while the device is busy
with background Operations handling.
Stop the device BKOPs before handling the RPMB / IOCTL command.

Change-Id: I088f74c77026ccd901276e1214e4466ac7815bf1
Signed-off-by: Maya Erez <merez@codeaurora.org>
[subhashj@codeaurora.org: fixed merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Maya Erez 2015-10-01 11:27:17 +03:00 committed by Subhash Jadavani
parent f0b1bca2eb
commit baf5c81221

View file

@ -670,6 +670,15 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
mrq.cmd = &cmd;
if (mmc_card_doing_bkops(card)) {
err = mmc_stop_bkops(card);
if (err) {
dev_err(mmc_dev(card->host),
"%s: stop_bkops failed %d\n", __func__, err);
return err;
}
}
err = mmc_blk_part_switch(card, md);
if (err)
return err;
@ -790,6 +799,25 @@ static int mmc_blk_ioctl_rpmb_cmd(struct block_device *bdev,
mmc_get_card(card);
if (mmc_card_doing_bkops(card)) {
if (mmc_card_cmdq(card)) {
err = mmc_cmdq_halt(card->host, true);
if (err)
goto cmd_rel_host;
}
err = mmc_stop_bkops(card);
if (err) {
dev_err(mmc_dev(card->host),
"%s: stop_bkops failed %d\n", __func__, err);
goto cmd_rel_host;
}
if (mmc_card_cmdq(card)) {
err = mmc_cmdq_halt(card->host, false);
if (err)
goto cmd_rel_host;
}
}
err = mmc_blk_part_switch(card, md);
if (err)
goto cmd_rel_host;