From: tip-bot for Thomas Gleixner <tglx@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
linus.walleij@stericsson.com, johnstul@us.ibm.com,
mikpe@it.uu.se, ralf@linux-mips.org, tglx@linutronix.de
Subject: [tip:timers/core] mips: Use generic mult/shift factor calculation for clocks
Date: Fri, 13 Nov 2009 19:49:17 GMT [thread overview]
Message-ID: <tip-e3a4fab0c0c30e21e104712f4e9cb39f175d0f21@git.kernel.org> (raw)
In-Reply-To: <20091111134229.807255074@linutronix.de>
Commit-ID: e3a4fab0c0c30e21e104712f4e9cb39f175d0f21
Gitweb: http://git.kernel.org/tip/e3a4fab0c0c30e21e104712f4e9cb39f175d0f21
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 11 Nov 2009 14:05:34 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 13 Nov 2009 20:46:24 +0100
mips: Use generic mult/shift factor calculation for clocks
Replace the MIPS functions of mult/shift factor calculation for clock
events and clock sources with inline functions which call the generic
functions. The minimum guaranteed conversion range is set to 4 seconds
which corresponds to the current MIPS implementation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Cc: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <20091111134229.807255074@linutronix.de>
---
arch/mips/include/asm/time.h | 14 +++++++++++---
arch/mips/kernel/time.c | 33 ---------------------------------
2 files changed, 11 insertions(+), 36 deletions(-)
diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
index df6a430..c7f1bfe 100644
--- a/arch/mips/include/asm/time.h
+++ b/arch/mips/include/asm/time.h
@@ -84,8 +84,16 @@ static inline int init_mips_clocksource(void)
#endif
}
-extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock);
-extern void clockevent_set_clock(struct clock_event_device *cd,
- unsigned int clock);
+static inline void clocksource_set_clock(struct clocksource *cs,
+ unsigned int clock)
+{
+ clocksource_calc_mult_shift(cs, clock, 4);
+}
+
+static inline void clockevent_set_clock(struct clock_event_device *cd,
+ unsigned int clock)
+{
+ clockevents_calc_mult_shift(cd, clock, 4);
+}
#endif /* _ASM_TIME_H */
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 1f467d5..fb74974 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -71,39 +71,6 @@ EXPORT_SYMBOL(perf_irq);
unsigned int mips_hpt_frequency;
-void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
-{
- u64 temp;
- u32 shift;
-
- /* Find a shift value */
- for (shift = 32; shift > 0; shift--) {
- temp = (u64) NSEC_PER_SEC << shift;
- do_div(temp, clock);
- if ((temp >> 32) == 0)
- break;
- }
- cs->shift = shift;
- cs->mult = (u32) temp;
-}
-
-void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
- unsigned int clock)
-{
- u64 temp;
- u32 shift;
-
- /* Find a shift value */
- for (shift = 32; shift > 0; shift--) {
- temp = (u64) clock << shift;
- do_div(temp, NSEC_PER_SEC);
- if ((temp >> 32) == 0)
- break;
- }
- cd->shift = shift;
- cd->mult = (u32) temp;
-}
-
/*
* This function exists in order to cause an error due to a duplicate
* definition if platform code should have its own implementation. The hook
next prev parent reply other threads:[~2009-11-13 19:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 14:05 [patch 0/3] Provide generic function to calc mult/shift factors for clocks Thomas Gleixner
2009-11-11 14:05 ` [patch 1/3] clockevents: Use u32 for mult and shift factors Thomas Gleixner
2009-11-13 19:48 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2009-11-11 14:05 ` [patch 2/3] clocksource: Provide a generic mult/shift factor calculation Thomas Gleixner
2009-11-13 19:49 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2009-11-11 14:05 ` [patch 3/3] mips: Use generic mult/shift factor calculation for clocks Thomas Gleixner
2009-11-13 19:49 ` tip-bot for Thomas Gleixner [this message]
2009-11-11 14:08 ` [patch 0/3] Provide generic function to calc mult/shift factors forclocks Linus Walleij
2009-11-12 11:37 ` [patch 0/3] Provide generic function to calc mult/shift factors for clocks Ralf Baechle
2009-11-12 16:59 ` Mikael Pettersson
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=tip-e3a4fab0c0c30e21e104712f4e9cb39f175d0f21@git.kernel.org \
--to=tglx@linutronix.de \
--cc=hpa@zytor.com \
--cc=johnstul@us.ibm.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mikpe@it.uu.se \
--cc=mingo@redhat.com \
--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