Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk
diff mbox series

Message ID 20190403151608.27326-1-madhumithabiw@gmail.com
State New
Headers show
Series
  • Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk
Related show

Commit Message

Madhumitha Prabakaran April 3, 2019, 3:16 p.m. UTC
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(-)

Comments

Greg Kroah-Hartman April 16, 2019, 11:44 a.m. UTC | #1
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 :(

Patch
diff mbox series

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;
 		}
 	}