]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: core: Convert to mmc_poll_for_busy() for erase/trim/discard
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 4 Feb 2020 08:54:45 +0000 (09:54 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 24 Mar 2020 13:35:40 +0000 (14:35 +0100)
commit42fc5270394a7c95b95c26ccfd13681ca7abce07
treee723e0502b0f8407c9ff46338bb72dbd3127d2db
parent7c01280fc151110d74bf8eaba447ba1b79a3eae5
mmc: core: Convert to mmc_poll_for_busy() for erase/trim/discard

Rather than open coding the polling loop in mmc_do_erase(), let's convert
to use mmc_poll_for_busy().

To allow a slightly different error parsing during polling, compared to the
__mmc_switch() case, a new in-parameter to mmc_poll_for_busy() is needed,
but other than that the conversion is straight forward.

Besides addressing the open coding issue, moving to mmc_poll_for_busy() for
erase/trim/discard improves the behaviour according to below.

- Adds support for polling via the optional ->card_busy() host ops.
- Returns zero to indicate success when the final polling attempt finds the
  card non-busy, even if the timeout expired.
- Exits the polling loop when state moves to R1_STATE_TRAN, rather than
  when leaving R1_STATE_PRG.
- Decreases the starting range for throttling to 32-64us.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Baolin Wang <baolin.wang7@gmail.com>
Tested-by: Ludovic Barre <ludovic.barre@st.com>
Reviewed-by: Ludovic Barre <ludovic.barre@st.com>
Link: https://lore.kernel.org/r/20200204085449.32585-9-ulf.hansson@linaro.org
drivers/mmc/core/core.c
drivers/mmc/core/mmc_ops.c
drivers/mmc/core/mmc_ops.h