mirror of https://gitee.com/openkylin/linux.git
PM / Blackfin: Use struct syscore_ops instead of sysdevs for PM
Convert some Blackfin architecture's code to using struct syscore_ops objects for power management instead of sysdev classes and sysdevs. This simplifies the code and reduces the kernel's memory footprint. It also is necessary for removing sysdevs from the kernel entirely in the future. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
bb072c3cf2
commit
67f9cbf9af
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <linux/hardirq.h>
|
#include <linux/hardirq.h>
|
||||||
#include <linux/sysdev.h>
|
#include <linux/syscore_ops.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/nmi.h>
|
#include <linux/nmi.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
|
@ -196,43 +196,31 @@ void touch_nmi_watchdog(void)
|
||||||
|
|
||||||
/* Suspend/resume support */
|
/* Suspend/resume support */
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int nmi_wdt_suspend(struct sys_device *dev, pm_message_t state)
|
static int nmi_wdt_suspend(void)
|
||||||
{
|
{
|
||||||
nmi_wdt_stop();
|
nmi_wdt_stop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nmi_wdt_resume(struct sys_device *dev)
|
static void nmi_wdt_resume(void)
|
||||||
{
|
{
|
||||||
if (nmi_active)
|
if (nmi_active)
|
||||||
nmi_wdt_start();
|
nmi_wdt_start();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sysdev_class nmi_sysclass = {
|
static struct syscore_ops nmi_syscore_ops = {
|
||||||
.name = DRV_NAME,
|
|
||||||
.resume = nmi_wdt_resume,
|
.resume = nmi_wdt_resume,
|
||||||
.suspend = nmi_wdt_suspend,
|
.suspend = nmi_wdt_suspend,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sys_device device_nmi_wdt = {
|
static int __init init_nmi_wdt_syscore(void)
|
||||||
.id = 0,
|
|
||||||
.cls = &nmi_sysclass,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init init_nmi_wdt_sysfs(void)
|
|
||||||
{
|
{
|
||||||
int error;
|
if (nmi_active)
|
||||||
|
register_syscore_ops(&nmi_syscore_ops);
|
||||||
|
|
||||||
if (!nmi_active)
|
return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
error = sysdev_class_register(&nmi_sysclass);
|
|
||||||
if (!error)
|
|
||||||
error = sysdev_register(&device_nmi_wdt);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
late_initcall(init_nmi_wdt_sysfs);
|
late_initcall(init_nmi_wdt_syscore);
|
||||||
|
|
||||||
#endif /* CONFIG_PM */
|
#endif /* CONFIG_PM */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue