>> Certain commands require a longer switch timeout. >> Refactor accordingly to allow e.g. for future sanitize change. >> >> Signed-off-by: Christian Loehle <cloehle@xxxxxxxxxxxxxx> >> --- >> mmc_cmds.c | 83 >> +++++++++++++++++++++++++++++++++++------------------- >> 1 file changed, 54 insertions(+), 29 deletions(-) >> >> diff --git a/mmc_cmds.c b/mmc_cmds.c >> index 2957aa9..8bc7a56 100644 >> --- a/mmc_cmds.c >> +++ b/mmc_cmds.c >> @@ -54,6 +54,8 @@ >> #define WPTYPE_PWRON 2 >> #define WPTYPE_PERM 3 >> >> +#define SWITCH_TIMEOUT_MS (10 * 1000) >Why 10 seconds? >Maybe add comment or at least explain in your commit log. > >> + >> >> int read_extcsd(int fd, __u8 *ext_csd) { @@ -76,7 +78,7 @@ int >> read_extcsd(int fd, __u8 *ext_csd) >> return ret; >> } >> >> -int write_extcsd_value(int fd, __u8 index, __u8 value) >> +int write_extcsd_value(int fd, __u8 index, __u8 value, unsigned int >> +timeout_ms) >> { >> int ret = 0; >> struct mmc_ioc_cmd idata; >> @@ -89,6 +91,7 @@ int write_extcsd_value(int fd, __u8 index, __u8 value) >> (value << 8) | >> EXT_CSD_CMD_SET_NORMAL; >> idata.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; >> + idata.cmd_timeout_ms = timeout_ms; >If cmd_timeout_ms not set, mmc_sanitize will use 240s - MMC_SANITIZE_TIMEOUT_MS. >I thought that you need more time, or did I get it wrong? > > Also, I am uncomfortable that you are setting this value for all other commands. Thanks for your comments, I agree. I will resend a v3 that leaves the cmd_timeout_ms setting to the kernel unless the sanitize user-specified timeout is used. Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782