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 Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux