Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: "Christian Löhle" <CLoehle@hyperstone.com>
To: Avri Altman <Avri.Altman@wdc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Linux MMC List <linux-mmc@vger.kernel.org>
Subject: RE: [PATCHv2 1/2] mmc-utils: Refactor switch to allow custom timeout
Date: Thu, 13 Oct 2022 08:35:06 +0000	[thread overview]
Message-ID: <2aa93912572a46738252f490258489d9@hyperstone.com> (raw)
In-Reply-To: <BL0PR04MB6564149CA860570CA546E51FFC259@BL0PR04MB6564.namprd04.prod.outlook.com>

>> Certain commands require a longer switch timeout.
>> Refactor accordingly to allow e.g. for future sanitize change.
>> 
>> Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
>> ---
>>  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


      reply	other threads:[~2022-10-13  8:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 19:03 [PATCHv2 1/2] mmc-utils: Refactor switch to allow custom timeout Christian Löhle
2022-10-13  8:19 ` Avri Altman
2022-10-13  8:35   ` Christian Löhle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2aa93912572a46738252f490258489d9@hyperstone.com \
    --to=cloehle@hyperstone.com \
    --cc=Avri.Altman@wdc.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox