aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-03-23 17:16:04 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-03-23 17:16:04 -0400
commite1a85b2c519551d4792180cdab4074d7e99bf2c9 (patch)
treeee53aed254043d06a7e30151af6500eab3bf0407
parentf3c6ea1b06c71b43f751b36bd99345369fe911af (diff)
timekeeping: Use syscore_ops instead of sysdev class and sysdev
The timekeeping subsystem uses a sysdev class and a sysdev for executing timekeeping_suspend() after interrupts have been turned off on the boot CPU (during system suspend) and for executing timekeeping_resume() before turning on interrupts on the boot CPU (during system resume). However, since both of these functions ignore their arguments, the entire mechanism may be replaced with a struct syscore_ops object which is simpler. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--kernel/time/timekeeping.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 3bd7e3d5c632..8ad5d576755e 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -14,7 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/sysdev.h> 17#include <linux/syscore_ops.h>
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/jiffies.h> 19#include <linux/jiffies.h>
20#include <linux/time.h> 20#include <linux/time.h>
@@ -597,13 +597,12 @@ static struct timespec timekeeping_suspend_time;
597 597
598/** 598/**
599 * timekeeping_resume - Resumes the generic timekeeping subsystem. 599 * timekeeping_resume - Resumes the generic timekeeping subsystem.
600 * @dev: unused
601 * 600 *
602 * This is for the generic clocksource timekeeping. 601 * This is for the generic clocksource timekeeping.
603 * xtime/wall_to_monotonic/jiffies/etc are 602 * xtime/wall_to_monotonic/jiffies/etc are
604 * still managed by arch specific suspend/resume code. 603 * still managed by arch specific suspend/resume code.
605 */ 604 */
606static int timekeeping_resume(struct sys_device *dev) 605static void timekeeping_resume(void)
607{ 606{
608 unsigned long flags; 607 unsigned long flags;
609 struct timespec ts; 608 struct timespec ts;
@@ -632,11 +631,9 @@ static int timekeeping_resume(struct sys_device *dev)
632 631
633 /* Resume hrtimers */ 632 /* Resume hrtimers */
634 hres_timers_resume(); 633 hres_timers_resume();
635
636 return 0;
637} 634}
638 635
639static int timekeeping_suspend(struct sys_device *dev, pm_message_t state) 636static int timekeeping_suspend(void)
640{ 637{
641 unsigned long flags; 638 unsigned long flags;
642 639
@@ -654,26 +651,18 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
654} 651}
655 652
656/* sysfs resume/suspend bits for timekeeping */ 653/* sysfs resume/suspend bits for timekeeping */
657static struct sysdev_class timekeeping_sysclass = { 654static struct syscore_ops timekeeping_syscore_ops = {
658 .name = "timekeeping",
659 .resume = timekeeping_resume, 655 .resume = timekeeping_resume,
660 .suspend = timekeeping_suspend, 656 .suspend = timekeeping_suspend,
661}; 657};
662 658
663static struct sys_device device_timer = { 659static int __init timekeeping_init_ops(void)
664 .id = 0,
665 .cls = &timekeeping_sysclass,
666};
667
668static int __init timekeeping_init_device(void)
669{ 660{
670 int error = sysdev_class_register(&timekeeping_sysclass); 661 register_syscore_ops(&timekeeping_syscore_ops);
671 if (!error) 662 return 0;
672 error = sysdev_register(&device_timer);
673 return error;
674} 663}
675 664
676device_initcall(timekeeping_init_device); 665device_initcall(timekeeping_init_ops);
677 666
678/* 667/*
679 * If the error is already larger, we look ahead even further 668 * If the error is already larger, we look ahead even further