Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c6c7f40 authored by Maya Erez's avatar Maya Erez
Browse files

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: default avatarMaya Erez <merez@codeaurora.org>
parent f5d3db32
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -685,6 +685,15 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
		}
	}

	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);
			goto cmd_rel_host;
		}
	}

	err = mmc_blk_part_switch(card, md);
	if (err)
		goto cmd_rel_host;
@@ -832,6 +841,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;