RE: [PATCH RFT 1/3] mmc: renesas_sdhi: refactor calculation of best TAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux