clockevents: Use u32 for mult and shift factors
authorThomas Gleixner <tglx@linutronix.de>
Wed, 11 Nov 2009 14:05:25 +0000 (14:05 +0000)
committer黄涛 <huangtao@rock-chips.com>
Mon, 25 Jul 2011 01:29:10 +0000 (09:29 +0800)
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>
Tested-by: 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.725664788@linutronix.de>

include/linux/clockchips.h
kernel/time/timer_list.c

index b7905462043cf3a7d8da526db4aa8f8f533492e9..4d438b0bc10a5c6849e7d56a8e102442ef67f27d 100644 (file)
@@ -79,8 +79,8 @@ struct clock_event_device {
        unsigned int            features;
        unsigned long           max_delta_ns;
        unsigned long           min_delta_ns;
        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;
        int                     rating;
        int                     irq;
        const struct cpumask    *cpumask;
index 54c0ddaa06c98d3b4b244657c54145183c90e28d..a6e445c673b05644c201bac049c65de10d8a9cc1 100644 (file)
@@ -209,8 +209,8 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
        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, "%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));
        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));