Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1679450 > unrolled thread

[PATCH] staging: sm750fb: refactor the clock frequency calculation method

Started byLynn Lei <lynnl.wit@gmail.com>
First post2017-07-02 14:30 +0200
Last post2017-07-03 08:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: sm750fb: refactor the clock frequency calculation  method Lynn Lei <lynnl.wit@gmail.com> - 2017-07-02 14:30 +0200
    Re: [PATCH] staging: sm750fb: refactor the clock frequency  calculation method Greg KH <gregkh@linuxfoundation.org> - 2017-07-03 08:30 +0200

#1679450 — [PATCH] staging: sm750fb: refactor the clock frequency calculation method

FromLynn Lei <lynnl.wit@gmail.com>
Date2017-07-02 14:30 +0200
Subject[PATCH] staging: sm750fb: refactor the clock frequency calculation method
Message-ID<tYMaJ-1MG-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1679666 — Re: [PATCH] staging: sm750fb: refactor the clock frequency calculation method

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-07-03 08:30 +0200
SubjectRe: [PATCH] staging: sm750fb: refactor the clock frequency calculation method
Message-ID<tZ31U-5Fr-21@gated-at.bofh.it>
In reply to#1679450
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web