Re: [PATCH v2] mmc: block: Use .card_busy() to detect busy state in card_busy_detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021/7/2 23:00, Ulf Hansson wrote:
On Tue, 8 Jun 2021 at 08:43, Shawn Lin <shawn.lin@xxxxxxxxxxxxxx> wrote:

No need to send CMD13 if host driver supports .card_busy().

Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>

Shawn, I just sent a small series that moves the mmc block layer into
using the common mmc_poll_for_busy() code. I think $subject patch is
better to be discussed as an improvement on top in that series.

I already have some thoughts about it, but I will be awaiting to
provide you with some comment around it, until there is a new version
from you.

Sure, I will take a close look at your patch-set.

Thanks.


Kind regards
Uffe


---

Changes in v2:
- fix build issue

  drivers/mmc/core/block.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 88f4c215..379614a9 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -417,10 +417,17 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
         unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
         int err = 0;
         u32 status;
+       bool busy;

         do {
                 bool done = time_after(jiffies, timeout);

+               if (card->host->ops->card_busy) {
+                       busy = card->host->ops->card_busy(card->host);
+                       status = busy ? 0 : R1_READY_FOR_DATA | R1_STATE_TRAN << 9;
+                       goto cb;
+               }
+
                 err = __mmc_send_status(card, &status, 5);
                 if (err) {
                         dev_err(mmc_dev(card->host),
@@ -431,7 +438,7 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
                 /* Accumulate any response error bits seen */
                 if (resp_errs)
                         *resp_errs |= status;
-
+cb:
                 /*
                  * Timeout if the device never becomes ready for data and never
                  * leaves the program state.
--
2.7.4











[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux