Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1a85b2c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent f3c6ea1b
Loading
Loading
Loading
Loading
+8 −19
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/sysdev.h>
#include <linux/syscore_ops.h>
#include <linux/clocksource.h>
#include <linux/clocksource.h>
#include <linux/jiffies.h>
#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/time.h>
@@ -597,13 +597,12 @@ static struct timespec timekeeping_suspend_time;


/**
/**
 * timekeeping_resume - Resumes the generic timekeeping subsystem.
 * timekeeping_resume - Resumes the generic timekeeping subsystem.
 * @dev:	unused
 *
 *
 * This is for the generic clocksource timekeeping.
 * This is for the generic clocksource timekeeping.
 * xtime/wall_to_monotonic/jiffies/etc are
 * xtime/wall_to_monotonic/jiffies/etc are
 * still managed by arch specific suspend/resume code.
 * still managed by arch specific suspend/resume code.
 */
 */
static int timekeeping_resume(struct sys_device *dev)
static void timekeeping_resume(void)
{
{
	unsigned long flags;
	unsigned long flags;
	struct timespec ts;
	struct timespec ts;
@@ -632,11 +631,9 @@ static int timekeeping_resume(struct sys_device *dev)


	/* Resume hrtimers */
	/* Resume hrtimers */
	hres_timers_resume();
	hres_timers_resume();

	return 0;
}
}


static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
static int timekeeping_suspend(void)
{
{
	unsigned long flags;
	unsigned long flags;


@@ -654,26 +651,18 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
}
}


/* sysfs resume/suspend bits for timekeeping */
/* sysfs resume/suspend bits for timekeeping */
static struct sysdev_class timekeeping_sysclass = {
static struct syscore_ops timekeeping_syscore_ops = {
	.name		= "timekeeping",
	.resume		= timekeeping_resume,
	.resume		= timekeeping_resume,
	.suspend	= timekeeping_suspend,
	.suspend	= timekeeping_suspend,
};
};


static struct sys_device device_timer = {
static int __init timekeeping_init_ops(void)
	.id		= 0,
	.cls		= &timekeeping_sysclass,
};

static int __init timekeeping_init_device(void)
{
{
	int error = sysdev_class_register(&timekeeping_sysclass);
	register_syscore_ops(&timekeeping_syscore_ops);
	if (!error)
	return 0;
		error = sysdev_register(&device_timer);
	return error;
}
}


device_initcall(timekeeping_init_device);
device_initcall(timekeeping_init_ops);


/*
/*
 * If the error is already larger, we look ahead even further
 * If the error is already larger, we look ahead even further