2020-12-02 20:27:02

by Bean Huo

[permalink] [raw]
Subject: [PATCH] mmc: block: Let CMD13 polling only for MMC IOCTLS with the R1B response

From: Bean Huo <[email protected]>

The CMD13 polling is only needed for the command with R1B Resp. For the
command with R1 Resp, such as open-ended multiple block read/write
(CMD18/25) commands, the device will just wait for its next paired command.
There is no need to poll device status through CMD13.

Meanwhile, based on the original change commit (mmc: block: Add CMD13 polling
for MMC IOCTLS with R1B response), and comment in __mmc_blk_ioctl_cmd(),
current code is not in line with its original purpose. So fix it with this patch.

Fixes: a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response")
Cc: [email protected]
Reported-by: Zhan Liu <[email protected]>
Signed-off-by: Zhan Liu <[email protected]>
Signed-off-by: Bean Huo <[email protected]>
---
drivers/mmc/core/block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 8d3df0be0355..42e27a298218 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -580,7 +580,7 @@ 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)) {
+ if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) {
/*
* Ensure RPMB/R1B command has completed by polling CMD13
* "Send Status".
--
2.17.1


2020-12-04 14:43:38

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: block: Let CMD13 polling only for MMC IOCTLS with the R1B response

On Wed, 2 Dec 2020 at 21:23, Bean Huo <[email protected]> wrote:
>
> From: Bean Huo <[email protected]>
>
> The CMD13 polling is only needed for the command with R1B Resp. For the
> command with R1 Resp, such as open-ended multiple block read/write
> (CMD18/25) commands, the device will just wait for its next paired command.
> There is no need to poll device status through CMD13.
>
> Meanwhile, based on the original change commit (mmc: block: Add CMD13 polling
> for MMC IOCTLS with R1B response), and comment in __mmc_blk_ioctl_cmd(),
> current code is not in line with its original purpose. So fix it with this patch.
>
> Fixes: a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response")
> Cc: [email protected]
> Reported-by: Zhan Liu <[email protected]>
> Signed-off-by: Zhan Liu <[email protected]>
> Signed-off-by: Bean Huo <[email protected]>

Applied for fixes, thanks!

Note, I took the liberty to rephrase the commit message (and the
header) to clarify things a bit more.

Kind regards
Uffe


> ---
> drivers/mmc/core/block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 8d3df0be0355..42e27a298218 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -580,7 +580,7 @@ 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)) {
> + if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) {
> /*
> * Ensure RPMB/R1B command has completed by polling CMD13
> * "Send Status".
> --
> 2.17.1
>

2020-12-04 15:56:36

by Bean Huo

[permalink] [raw]
Subject: Re: [PATCH] mmc: block: Let CMD13 polling only for MMC IOCTLS with the R1B response

On Fri, 2020-12-04 at 15:38 +0100, Ulf Hansson wrote:
> > There is no need to poll device status through CMD13.
> >
> > Meanwhile, based on the original change commit (mmc: block: Add
> > CMD13 polling
> > for MMC IOCTLS with R1B response), and comment in
> > __mmc_blk_ioctl_cmd(),
> > current code is not in line with its original purpose. So fix it
> > with this patch.
> >
> > Fixes: a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS
> > with R1B response")
> > Cc: [email protected]
> > Reported-by: Zhan Liu <[email protected]>
> > Signed-off-by: Zhan Liu <[email protected]>
> > Signed-off-by: Bean Huo <[email protected]>
>
> Applied for fixes, thanks!
>
> Note, I took the liberty to rephrase the commit message (and the
> header) to clarify things a bit more.
>

Uffe,
Nice, thanks a lot.

Bean