mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaro Koskinen <aaro.koskinen@nokia.com>
To: Dmitry Antipov <dmitry.antipov@linaro.org>
Cc: Chris Ball <cjb@laptop.org>,
	patches@linaro.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: change mmc_delay() to use usleep_range()
Date: Fri, 13 Jan 2012 23:38:26 +0200 (EET)	[thread overview]
Message-ID: <alpine.DEB.2.00.1201132308530.24003@kernel.research.nokia.com> (raw)
In-Reply-To: <1326467370-21026-1-git-send-email-dmitry.antipov@linaro.org>

Hi,

On Fri, 13 Jan 2012, Dmitry Antipov wrote:
> Use the usleep_range() to simplify mmc_delay() and give some more
> accuracy to it - but with an exception of mmc_card_sleepawake():
> since sleep/awake timeout varies in a wide range, different
> delay methods should be used.
>
> Signed-off-by: Dmitry Antipov <dmitry.antipov@linaro.org>

[...]

> +	if (!(host->caps & MMC_CAP_WAIT_WHILE_BUSY)) {
> +		/* JEDEC MMCA 4.41 specifies the timeout value is in 200ns..838.86ms
> +		   range. Round it up to 1us and use an appropriate delay method. */
> +		unsigned long us = DIV_ROUND_UP(card->ext_csd.sa_timeout, 10);
> +		if (us < 10)
> +			udelay(us);
> +		else
> +			usleep_range(us, us + 100);
> +	}

I think this part of the patch is over-engineered. What difference
does it make in practice if you round it up to a bigger value so that
usleep_range() makes always sense? The S/A timeout defines the max time
the transition can take, it's not wrong to wait a bit longer. Also note
that udelay() is not accurate so you need to add some margin anyway.

A.

  reply	other threads:[~2012-01-13 21:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 15:09 Dmitry Antipov
2012-01-13 21:38 ` Aaro Koskinen [this message]
2012-01-16  6:43 Dmitry Antipov
2012-01-17  7:29 ` Adrian Hunter
2012-01-17  7:46   ` Adrian Hunter

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=alpine.DEB.2.00.1201132308530.24003@kernel.research.nokia.com \
    --to=aaro.koskinen@nokia.com \
    --cc=cjb@laptop.org \
    --cc=dmitry.antipov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=patches@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

all inboxes | Powered by JetHome®