From: Thomas Gleixner <tglx@linutronix.de>
To: Xiubo Li <Li.Xiubo@freescale.com>
Cc: daniel.lezcano@linaro.org, dongsheng.wang@freescale.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] Clocksource: Flextimer: Fix counter clock prescaler calculation.
Date: Wed, 3 Sep 2014 12:57:38 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.10.1409031241310.3333@nanos> (raw)
In-Reply-To: <1409031951-39021-5-git-send-email-Li.Xiubo@freescale.com>
On Tue, 26 Aug 2014, Xiubo Li wrote:
> We should minus one after calculating the counter input clock's
> prescaler.
>
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com>
> ---
> drivers/clocksource/fsl_ftm_timer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
> index f70fcf2..974890e 100644
> --- a/drivers/clocksource/fsl_ftm_timer.c
> +++ b/drivers/clocksource/fsl_ftm_timer.c
> @@ -311,7 +311,7 @@ static int __init ftm_calc_closest_round_cyc(unsigned long freq)
> HZ * (1 << priv->ps++));
> } while (priv->periodic_cyc > 0xFFFF);
>
> - if (priv->ps > FTM_PS_MAX) {
> + if (--priv->ps > FTM_PS_MAX) {
Looking at this makes me run away screaming. Just because you
increment priv->ps unconditionally in the loop above, you decrement it
again here. Why not fix the calculation proper in the first place?
for (cyc = ~0UL, ps = 0, div = HZ; cyc > 0xffff; ps++, div *= 2)
cyc = DIV_ROUND_CLOSEST(freq, div);
Hmm?
tglx
next prev parent reply other threads:[~2014-09-03 10:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 5:45 [PATCH 0/5] Clocksource: Flextimer: Merged to LS1 Xiubo Li
2014-08-26 5:45 ` [PATCH 1/5] Clocksource: Flextimer: Set cpumask to cpu_possible_mask Xiubo Li
2014-08-26 5:45 ` [PATCH 2/5] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
2014-09-03 10:38 ` Thomas Gleixner
2014-09-04 1:49 ` Li.Xiubo
2014-09-04 8:35 ` Thomas Gleixner
2014-09-04 8:43 ` Li.Xiubo
2014-09-04 8:45 ` Thomas Gleixner
2014-09-04 8:53 ` Li.Xiubo
2014-09-05 5:59 ` Li.Xiubo
2014-08-26 5:45 ` [PATCH 3/5] Clocksource: Flextimer: Remove the useless code Xiubo Li
2014-08-26 5:45 ` [PATCH 4/5] Clocksource: Flextimer: Fix counter clock prescaler calculation Xiubo Li
2014-09-03 10:57 ` Thomas Gleixner [this message]
2014-09-04 2:18 ` Li.Xiubo
2014-09-03 10:59 ` Thomas Gleixner
2014-09-04 2:03 ` Li.Xiubo
2014-08-26 5:45 ` [PATCH 5/5] Clocksource: Flextimer: Use Macro for clock source selection Xiubo Li
2014-09-03 12:01 ` Thomas Gleixner
2014-09-04 2:06 ` Li.Xiubo
2014-09-04 8:36 ` Thomas Gleixner
2014-09-03 3:50 ` [PATCH 0/5] Clocksource: Flextimer: Merged to LS1 Li.Xiubo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1409031241310.3333@nanos \
--to=tglx@linutronix.de \
--cc=Li.Xiubo@freescale.com \
--cc=daniel.lezcano@linaro.org \
--cc=dongsheng.wang@freescale.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®