linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: refactor the clock frequency calculation method
@ 2017-07-02 12:24 Lynn Lei
  2017-07-03  6:21 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Lynn Lei @ 2017-07-02 12:24 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: teddy.wang, gregkh, linux-fbdev, devel, linux-kernel

speed up calculation by merging two divisions into one.

Signed-off-by: Lynn Lei <lynnl.wit@gmail.com>
---
 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index c51761221131..5970c3792f27 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -44,7 +44,7 @@ static unsigned int get_mxclk_freq(void)
 	OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
 	POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
 
-	return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD);
+	return DEFAULT_INPUT_CLOCK * M / N / (1 << (OD + POD));
 }
 
 /*
-- 
2.13.2

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

* Re: [PATCH] staging: sm750fb: refactor the clock frequency calculation method
  2017-07-02 12:24 [PATCH] staging: sm750fb: refactor the clock frequency calculation method Lynn Lei
@ 2017-07-03  6:21 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-07-03  6:21 UTC (permalink / raw)
  To: Lynn Lei; +Cc: sudipm.mukherjee, devel, linux-fbdev, teddy.wang, linux-kernel

On Sun, Jul 02, 2017 at 08:24:26PM +0800, Lynn Lei wrote:
> speed up calculation by merging two divisions into one.

How much did you speed it up?  Please provide proof of anything like
this if you say it is a speed up.

> 
> Signed-off-by: Lynn Lei <lynnl.wit@gmail.com>
> ---
>  drivers/staging/sm750fb/ddk750_chip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index c51761221131..5970c3792f27 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -44,7 +44,7 @@ static unsigned int get_mxclk_freq(void)
>  	OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
>  	POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
>  
> -	return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD);
> +	return DEFAULT_INPUT_CLOCK * M / N / (1 << (OD + POD));

Are you sure that gcc didn't already do this for you?  It's a constant
number, I doubt this did anything at all.

thanks,

greg k-h

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

end of thread, other threads:[~2017-07-03  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-02 12:24 [PATCH] staging: sm750fb: refactor the clock frequency calculation method Lynn Lei
2017-07-03  6:21 ` 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).