diff mbox series

mmc: block: ioctl: No busywaiting of non-TRAN CMDs

Message ID CWXP265MB2680DC98B32CD4B49AA8A224C4599@CWXP265MB2680.GBRP265.PROD.OUTLOOK.COM (mailing list archive)
State New, archived
Headers show
Series mmc: block: ioctl: No busywaiting of non-TRAN CMDs | expand

Commit Message

Christian Loehle May 5, 2021, 1:12 p.m. UTC
Prevent busywaiting for TRAN state indication
after issuing a command that will not transition
to TRAN state.

Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
 drivers/mmc/core/block.c | 3 ++-
 drivers/mmc/core/block.h | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Avri Altman May 6, 2021, 6:15 a.m. UTC | #1
> Prevent busywaiting for TRAN state indication
> after issuing a command that will not transition
> to TRAN state.
> 
> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
> ---
>  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)
> +
You might want to use a static inline here to allow type checking.
If you decide to leave it as a macro however, need to add () on each term.

Thanks,
Avri

>  #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
diff mbox series

Patch

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