From: Thomas Gleixner <tglx@linutronix.de>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] MIPS: Don't overflow cevt-r4k.c calculations at high clock rates.
Date: Wed, 19 May 2010 12:34:38 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1005191233490.3368@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.00.1005191223260.3368@localhost.localdomain>
On Wed, 19 May 2010, Thomas Gleixner wrote:
> On Tue, 18 May 2010, David Daney wrote:
>
> > The 'mult' element of struct clock_event_device must never be wider
> > than 32-bits. If it were, it would get truncated when used by
> > clockevent_delta2ns() when this calls do_div().
> >
> > We meet the requirement by ensuring that the relationship:
> >
> > (mips_hpt_frequency >> (32 - shift)) < NSEC_PER_SEC
> >
> > Always holds.
>
> clocks_calc_mult_shift() is your friend :)
There are wrapper functions for clock sources and clock events as well:
clocksource_calc_mult_shift()
clockevents_calc_mult_shift()
Thanks,
tglx
prev parent reply other threads:[~2010-05-19 10:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 22:11 [PATCH] MIPS: Don't overflow cevt-r4k.c calculations at high clock rates David Daney
2010-05-18 22:48 ` Kevin D. Kissell
2010-05-18 22:52 ` Ralf Baechle
2010-05-19 1:27 ` Wu Zhangjin
2010-05-19 9:52 ` Sergei Shtylyov
2010-05-19 10:23 ` Thomas Gleixner
2010-05-19 10:34 ` Thomas Gleixner [this message]
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.LFD.2.00.1005191233490.3368@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=ddaney@caviumnetworks.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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