Linux-mmc Archive on lore.kernel.org
 help / color / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: "linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: RE: [PATCH RFT 1/3] mmc: renesas_sdhi: refactor calculation of best TAP
Date: Thu, 26 Mar 2020 07:04:49 +0000
Message-ID: <TYAPR01MB4544AD566F267EB89F479C3CD8CF0@TYAPR01MB4544.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20200306093159.6155-2-wsa+renesas@sang-engineering.com>

Hi Wolfram-san,

Thank you for the patch!

> From: Wolfram Sang, Sent: Friday, March 6, 2020 6:32 PM
<snip>
> @@ -455,29 +450,14 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
>  	 * is more than SH_MOBILE_SDHI_MAX_TAP probes long then use the
>  	 * center index as the tap.
>  	 */
> -	tap_cnt = 0;
> -	ntap = 0;
> -	tap_start = 0;
> -	tap_end = 0;
> -	for (i = 0; i < priv->tap_num * 2; i++) {
> -		if (test_bit(i, priv->taps)) {
> -			ntap++;
> -		} else {
> -			if (ntap > tap_cnt) {
> -				tap_start = i - ntap;
> -				tap_end = i - 1;
> -				tap_cnt = ntap;
> -			}
> -			ntap = 0;
> +	bitmap_for_each_set_region(priv->taps, rs, re, 0, taps_size) {
> +		if (re - 1 - rs > tap_cnt) {
> +			tap_end = re - 1;
> +			tap_start = rs;
> +			tap_cnt = tap_end - tap_start;

The left value on the condition and tap_cnt should be added "+ 1" like below.

+		if (re - 1 - rs + 1 > tap_cnt) {	// "if (re - rs > tap_cnt)" is more better?
+			tap_end = re - 1;
+			tap_start = rs;
+			tap_cnt = tap_end - tap_start + 1;

For example, the priv->taps value is 0x0007, the tap_cnt should be 3.
But, this patch's result will be 2.

Best regards,
Yoshihiro Shimoda


  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06  9:31 [PATCH RFT 0/3] mmc: renesas_sdhi: improve TAP selection if all TAPs are good Wolfram Sang
2020-03-06  9:31 ` [PATCH RFT 1/3] mmc: renesas_sdhi: refactor calculation of best TAP Wolfram Sang
2020-03-26  7:04   ` Yoshihiro Shimoda [this message]
2020-03-06  9:31 ` [PATCH RFT 2/3] mmc: renesas_sdhi: clarify handling of selecting TAPs Wolfram Sang
2020-03-26  7:06   ` Yoshihiro Shimoda
2020-03-06  9:31 ` [PATCH RFT 3/3] mmc: renesas_sdhi: improve TAP selection if all TAPs are good Wolfram Sang
2020-03-26  7:14   ` Yoshihiro Shimoda
2020-03-26  8:38 ` [PATCH RFT 0/3] " Yoshihiro Shimoda

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=TYAPR01MB4544AD566F267EB89F479C3CD8CF0@TYAPR01MB4544.jpnprd01.prod.outlook.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=wsa+renesas@sang-engineering.com \
    /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

Linux-mmc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mmc/0 linux-mmc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mmc linux-mmc/ https://lore.kernel.org/linux-mmc \
		linux-mmc@vger.kernel.org
	public-inbox-index linux-mmc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mmc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git