From 60e3bf14d4e2a9fcc11c2fc33f572bfafa8ece92 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 20 Oct 2012 07:46:02 +0300 Subject: clocksource: clean up parse_pmtmr() I changed the strict_strtoul() to kstrtouint(). That has the check for UINT_MAX built in to it so the ifdefs can be removed. Also I changed a printk() to pr_info(). Signed-off-by: Dan Carpenter Signed-off-by: John Stultz --- drivers/clocksource/acpi_pm.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 6b5cf02c35c..5d1b9268bca 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c @@ -233,16 +233,15 @@ fs_initcall(init_acpi_pm_clocksource); */ static int __init parse_pmtmr(char *arg) { - unsigned long base; + unsigned int base; + int ret; - if (strict_strtoul(arg, 16, &base)) - return -EINVAL; -#ifdef CONFIG_X86_64 - if (base > UINT_MAX) - return -ERANGE; -#endif - printk(KERN_INFO "PMTMR IOPort override: 0x%04x -> 0x%04lx\n", - pmtmr_ioport, base); + ret = kstrtouint(arg, 16, &base); + if (ret) + return ret; + + pr_info("PMTMR IOPort override: 0x%04x -> 0x%04x\n", pmtmr_ioport, + base); pmtmr_ioport = base; return 1; -- cgit v1.2.3 From 980097b36074596c76c1367a9e7b70ec8583d55b Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 29 Oct 2012 15:24:18 +0100 Subject: clocksource: arm_generic: use integer math helpers This will make the two crucial integer divisions in the generic ARM arch timer used for ARMv8 use the kernel DIV_ROUND_CLOSEST() helper inline from so they get more precise. Cc: Marc Zyngier Cc: Catalin Marinas Signed-off-by: Linus Walleij Signed-off-by: John Stultz --- drivers/clocksource/arm_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index c4d9f9566c6..6cd1b30e01a 100644 --- a/drivers/clocksource/arm_generic.c +++ b/drivers/clocksource/arm_generic.c @@ -127,7 +127,7 @@ static void __init arch_timer_calibrate(void) /* Cache the sched_clock multiplier to save a divide in the hot path. */ - sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; + sched_clock_mult = DIV_ROUND_CLOSEST(NSEC_PER_SEC, arch_timer_rate); pr_info("Architected local timer running at %u.%02uMHz.\n", arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100); @@ -221,7 +221,7 @@ int __init arm_generic_timer_init(void) clocksource_register_hz(&clocksource_counter, arch_timer_rate); /* Calibrate the delay loop directly */ - lpj_fine = arch_timer_rate / HZ; + lpj_fine = DIV_ROUND_CLOSEST(arch_timer_rate, HZ); /* Immediately configure the timer on the boot CPU */ arch_timer_setup(per_cpu_ptr(&arch_timer_evt, smp_processor_id())); -- cgit v1.2.3 From 47c8c91b2d60006df22146effe79ac4cdafd9205 Mon Sep 17 00:00:00 2001 From: Shan Wei Date: Tue, 13 Nov 2012 09:53:14 +0800 Subject: clocksource: arm_generic: use this_cpu_ptr per-cpu helper Utilize this_cpu_ptr() instead of per_cpu_ptr(...,smp_processor_id()) Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter Signed-off-by: John Stultz --- drivers/clocksource/arm_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index 6cd1b30e01a..c210f4f1ecf 100644 --- a/drivers/clocksource/arm_generic.c +++ b/drivers/clocksource/arm_generic.c @@ -224,7 +224,7 @@ int __init arm_generic_timer_init(void) lpj_fine = DIV_ROUND_CLOSEST(arch_timer_rate, HZ); /* Immediately configure the timer on the boot CPU */ - arch_timer_setup(per_cpu_ptr(&arch_timer_evt, smp_processor_id())); + arch_timer_setup(this_cpu_ptr(&arch_timer_evt)); register_cpu_notifier(&arch_timer_cpu_nb); -- cgit v1.2.3 From d6ad418763888f617ac5b4849823e4cd670df1dd Mon Sep 17 00:00:00 2001 From: John Stultz Date: Tue, 28 Feb 2012 16:50:11 -0800 Subject: time: Kill xtime_lock, replacing it with jiffies_lock Now that timekeeping is protected by its own locks, rename the xtime_lock to jifffies_lock to better describe what it protects. CC: Thomas Gleixner CC: Eric Dumazet CC: Richard Cochran Signed-off-by: John Stultz --- drivers/clocksource/i8253.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c index e7cab2da910..14ee3efcc40 100644 --- a/drivers/clocksource/i8253.c +++ b/drivers/clocksource/i8253.c @@ -35,7 +35,7 @@ static cycle_t i8253_read(struct clocksource *cs) raw_spin_lock_irqsave(&i8253_lock, flags); /* - * Although our caller may have the read side of xtime_lock, + * Although our caller may have the read side of jiffies_lock, * this is now a seqlock, and we are cheating in this routine * by having side effects on state that we cannot undo if * there is a collision on the seqlock and our caller has to -- cgit v1.2.3