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>

+8 -19
+8 -19
kernel/time/timekeeping.c
··· 14 14 #include <linux/init.h> 15 15 #include <linux/mm.h> 16 16 #include <linux/sched.h> 17 - #include <linux/sysdev.h> 17 + #include <linux/syscore_ops.h> 18 18 #include <linux/clocksource.h> 19 19 #include <linux/jiffies.h> 20 20 #include <linux/time.h> ··· 597 597 598 598 /** 599 599 * timekeeping_resume - Resumes the generic timekeeping subsystem. 600 - * @dev: unused 601 600 * 602 601 * This is for the generic clocksource timekeeping. 603 602 * xtime/wall_to_monotonic/jiffies/etc are 604 603 * still managed by arch specific suspend/resume code. 605 604 */ 606 - static int timekeeping_resume(struct sys_device *dev) 605 + static void timekeeping_resume(void) 607 606 { 608 607 unsigned long flags; 609 608 struct timespec ts; ··· 631 632 632 633 /* Resume hrtimers */ 633 634 hres_timers_resume(); 634 - 635 - return 0; 636 635 } 637 636 638 - static int timekeeping_suspend(struct sys_device *dev, pm_message_t state) 637 + static int timekeeping_suspend(void) 639 638 { 640 639 unsigned long flags; 641 640 ··· 651 654 } 652 655 653 656 /* sysfs resume/suspend bits for timekeeping */ 654 - static struct sysdev_class timekeeping_sysclass = { 655 - .name = "timekeeping", 657 + static struct syscore_ops timekeeping_syscore_ops = { 656 658 .resume = timekeeping_resume, 657 659 .suspend = timekeeping_suspend, 658 660 }; 659 661 660 - static struct sys_device device_timer = { 661 - .id = 0, 662 - .cls = &timekeeping_sysclass, 663 - }; 664 - 665 - static int __init timekeeping_init_device(void) 662 + static int __init timekeeping_init_ops(void) 666 663 { 667 - int error = sysdev_class_register(&timekeeping_sysclass); 668 - if (!error) 669 - error = sysdev_register(&device_timer); 670 - return error; 664 + register_syscore_ops(&timekeeping_syscore_ops); 665 + return 0; 671 666 } 672 667 673 - device_initcall(timekeeping_init_device); 668 + device_initcall(timekeeping_init_ops); 674 669 675 670 /* 676 671 * If the error is already larger, we look ahead even further