diff mbox

[RFC,v2,4/4] mmc: sdhci-cadence: fix the return value of sdhci_cdns_get_timeout_clock

Message ID 1488184144-122285-5-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin Feb. 27, 2017, 8:29 a.m. UTC
Return the timeout clock rate in Hz for sdhci core.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2: None

 drivers/mmc/host/sdhci-cadence.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Adrian Hunter Feb. 28, 2017, 1:16 p.m. UTC | #1
On 27/02/17 10:29, Shawn Lin wrote:
> Return the timeout clock rate in Hz for sdhci core.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
> Changes in v2: None
> 
>  drivers/mmc/host/sdhci-cadence.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index 316cfec..bb3951a 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -103,9 +103,10 @@ static unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
>  {
>  	/*
>  	 * Cadence's spec says the Timeout Clock Frequency is the same as the
> -	 * Base Clock Frequency.  Divide it by 1000 to return a value in kHz.
> +	 * Base Clock Frequency. Return a value in Hz per the requirement of
> +	 * .get_timeout_clock callback.
>  	 */
> -	return host->max_clk / 1000;
> +	return DIV_ROUND_UP(DIV_ROUND_UP(host->max_clk, 1000), 1000);

Isn't it just host->max_clk now.

>  }
>  
>  static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada Feb. 28, 2017, 1:43 p.m. UTC | #2
Hi.


2017-02-27 17:29 GMT+09:00 Shawn Lin <shawn.lin@rock-chips.com>:
> Return the timeout clock rate in Hz for sdhci core.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>


I do not like the subject
"mmc: sdhci-cadence: fix the return value of sdhci_cdns_get_timeout_clock".

You are not fixing this driver,
but you are changing the API, right?

(More precisely, you are breaking it by 2/4, then fixing it by 4/4.
Right, you are fixing...)

Anyway, this would not be a problem because
Adrian requested to squash all the patches in this series.




> ---
>
> Changes in v2: None
>
>  drivers/mmc/host/sdhci-cadence.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index 316cfec..bb3951a 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -103,9 +103,10 @@ static unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
>  {
>         /*
>          * Cadence's spec says the Timeout Clock Frequency is the same as the
> -        * Base Clock Frequency.  Divide it by 1000 to return a value in kHz.
> +        * Base Clock Frequency. Return a value in Hz per the requirement of
> +        * .get_timeout_clock callback.
>          */
> -       return host->max_clk / 1000;
> +       return DIV_ROUND_UP(DIV_ROUND_UP(host->max_clk, 1000), 1000);
>  }
>
>  static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,


As Adrian pointed out, simply "return host->max_clk".

Also, please just remove the comment "Divide it by 1000 to return a
value in kHz."
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index 316cfec..bb3951a 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -103,9 +103,10 @@  static unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
 {
 	/*
 	 * Cadence's spec says the Timeout Clock Frequency is the same as the
-	 * Base Clock Frequency.  Divide it by 1000 to return a value in kHz.
+	 * Base Clock Frequency. Return a value in Hz per the requirement of
+	 * .get_timeout_clock callback.
 	 */
-	return host->max_clk / 1000;
+	return DIV_ROUND_UP(DIV_ROUND_UP(host->max_clk, 1000), 1000);
 }
 
 static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,