linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk
@ 2019-04-03 15:16 Madhumitha Prabakaran
  2019-04-16 11:44 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Madhumitha Prabakaran @ 2019-04-03 15:16 UTC (permalink / raw)
  To: gregkh, matthias.bgg, devel, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: Madhumitha Prabakaran

Use DIV_ROUND_UP to make code simple and more understandable.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/mt7621-mmc/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 4b26ec896a96..b12ed2c988fd 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -240,7 +240,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 			div  = 1;         /* mean div = 1/4 */
 			sclk = hclk >> 2; /* sclk = clk / 4 */
 		} else {
-			div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
+			div  = DIV_ROUND_UP(hclk, (hz << 2));
 			sclk = (hclk >> 2) / div;
 		}
 	} else if (hz >= hclk) { /* bug fix */
@@ -253,7 +253,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 			div  = 0;         /* mean div = 1/2 */
 			sclk = hclk >> 1; /* sclk = clk / 2 */
 		} else {
-			div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
+			div  = DIV_ROUND_UP(hclk, (hz << 2));
 			sclk = (hclk >> 2) / div;
 		}
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk
  2019-04-03 15:16 [PATCH] Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk Madhumitha Prabakaran
@ 2019-04-16 11:44 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-04-16 11:44 UTC (permalink / raw)
  To: Madhumitha Prabakaran
  Cc: matthias.bgg, devel, linux-arm-kernel, linux-mediatek, linux-kernel

On Wed, Apr 03, 2019 at 10:16:08AM -0500, Madhumitha Prabakaran wrote:
> Use DIV_ROUND_UP to make code simple and more understandable.
> 
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/mt7621-mmc/sd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index 4b26ec896a96..b12ed2c988fd 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -240,7 +240,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
>  			div  = 1;         /* mean div = 1/4 */
>  			sclk = hclk >> 2; /* sclk = clk / 4 */
>  		} else {
> -			div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
> +			div  = DIV_ROUND_UP(hclk, (hz << 2));
>  			sclk = (hclk >> 2) / div;
>  		}
>  	} else if (hz >= hclk) { /* bug fix */
> @@ -253,7 +253,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
>  			div  = 0;         /* mean div = 1/2 */
>  			sclk = hclk >> 1; /* sclk = clk / 2 */
>  		} else {
> -			div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
> +			div  = DIV_ROUND_UP(hclk, (hz << 2));
>  			sclk = (hclk >> 2) / div;
>  		}
>  	}

This file is no longer in the kernel tree :(

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-16 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 15:16 [PATCH] Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk Madhumitha Prabakaran
2019-04-16 11:44 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).