public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Mikael Pettersson <mikpe@it.uu.se>,
	Ralf Baechle <ralf@linux-mips.org>,
	Linus Walleij <linus.walleij@stericsson.com>,
	John Stultz <johnstul@us.ibm.com>, Ingo Molnar <mingo@elte.hu>
Subject: [patch 1/3] clockevents: Use u32 for mult and shift factors
Date: Wed, 11 Nov 2009 14:05:25 -0000	[thread overview]
Message-ID: <20091111134229.725664788@linutronix.de> (raw)
In-Reply-To: 20091111134018.393422332@linutronix.de

[-- Attachment #1: clockevents-use-u32-for-mult-and-shift-factors.patch --]
[-- Type: text/plain, Size: 1985 bytes --]

The mult and shift factors of clock events differ in their data type
from those of clock sources for no reason. u32 is sufficient for
both. shift is always <= 32 and mult is limited to 2^32-1 to avoid
64bit multiplication overflows in the conversion.

Preparatory patch for a generic mult/shift factor calculation
function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 include/linux/clockchips.h |    4 ++--
 kernel/time/timer_list.c   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6-tip/include/linux/clockchips.h
===================================================================
--- linux-2.6-tip.orig/include/linux/clockchips.h
+++ linux-2.6-tip/include/linux/clockchips.h
@@ -79,8 +79,8 @@ struct clock_event_device {
 	unsigned int		features;
 	unsigned long		max_delta_ns;
 	unsigned long		min_delta_ns;
-	unsigned long		mult;
-	int			shift;
+	u32			mult;
+	u32			shift;
 	int			rating;
 	int			irq;
 	const struct cpumask	*cpumask;
Index: linux-2.6-tip/kernel/time/timer_list.c
===================================================================
--- linux-2.6-tip.orig/kernel/time/timer_list.c
+++ linux-2.6-tip/kernel/time/timer_list.c
@@ -206,8 +206,8 @@ print_tickdevice(struct seq_file *m, str
 	SEQ_printf(m, "%s\n", dev->name);
 	SEQ_printf(m, " max_delta_ns:   %lu\n", dev->max_delta_ns);
 	SEQ_printf(m, " min_delta_ns:   %lu\n", dev->min_delta_ns);
-	SEQ_printf(m, " mult:           %lu\n", dev->mult);
-	SEQ_printf(m, " shift:          %d\n", dev->shift);
+	SEQ_printf(m, " mult:           %u\n", dev->mult);
+	SEQ_printf(m, " shift:          %u\n", dev->shift);
 	SEQ_printf(m, " mode:           %d\n", dev->mode);
 	SEQ_printf(m, " next_event:     %Ld nsecs\n",
 		   (unsigned long long) ktime_to_ns(dev->next_event));



  reply	other threads:[~2009-11-11 14:05 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 ` Thomas Gleixner [this message]
2009-11-13 19:48   ` [tip:timers/core] clockevents: Use u32 for mult and shift factors 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:timers/core] " tip-bot for Thomas Gleixner
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=20091111134229.725664788@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=johnstul@us.ibm.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=mingo@elte.hu \
    --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