[PATCH] mmc: block: ioctl: No busywaiting of non-TRAN CMDs
From: Christian Löhle
Date: Wed May 05 2021 - 09:14:05 EST
Prevent busywaiting for TRAN state indication
after issuing a command that will not transition
to TRAN state.
Signed-off-by: Christian Loehle <cloehle@xxxxxxxxxxxxxx>
---
drivers/mmc/core/block.c | 3 ++-
drivers/mmc/core/block.h | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 689eb9afeeed..9baf95639688 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -593,7 +593,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
memcpy(&(idata->ic.response), cmd.resp, sizeof(cmd.resp));
- if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) {
+ if ((idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B)
+ && TRAN_TRANSITION_CMD(cmd.opcode)) {
/*
* Ensure RPMB/R1B command has completed by polling CMD13
* "Send Status".
diff --git a/drivers/mmc/core/block.h b/drivers/mmc/core/block.h
index 31153f656f41..51b806384ab0 100644
--- a/drivers/mmc/core/block.h
+++ b/drivers/mmc/core/block.h
@@ -17,4 +17,9 @@ struct work_struct;
void mmc_blk_mq_complete_work(struct work_struct *work);
+#define TRAN_TRANSITION_CMD(cmd) !(cmd == MMC_SEND_STATUS \
+ || cmd == MMC_SEND_CID \
+ || cmd == MMC_ALL_SEND_CID \
+ || cmd == MMC_SEND_CSD)
+
#endif
--
2.31.1
Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
Managing Directors: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782