Commit c403e2b4 authored by Patrick Mochel's avatar Patrick Mochel

[nmi] Convert to use new system device API.

parent 1a28d3fd
...@@ -183,50 +183,46 @@ void enable_lapic_nmi_watchdog(void) ...@@ -183,50 +183,46 @@ void enable_lapic_nmi_watchdog(void)
#include <linux/device.h> #include <linux/device.h>
static int nmi_pm_active; /* nmi_active before suspend */ static int nmi_pm_active; /* nmi_active before suspend */
static int lapic_nmi_suspend(struct device *dev, u32 state, u32 level) static int lapic_nmi_suspend(struct sys_device *dev, u32 state)
{ {
if (level != SUSPEND_POWER_DOWN)
return 0;
nmi_pm_active = nmi_active; nmi_pm_active = nmi_active;
disable_lapic_nmi_watchdog(); disable_lapic_nmi_watchdog();
return 0; return 0;
} }
static int lapic_nmi_resume(struct device *dev, u32 level) static int lapic_nmi_resume(struct sys_device *dev)
{ {
if (level != RESUME_POWER_ON)
return 0;
if (nmi_pm_active > 0) if (nmi_pm_active > 0)
enable_lapic_nmi_watchdog(); enable_lapic_nmi_watchdog();
return 0; return 0;
} }
static struct device_driver lapic_nmi_driver = {
.name = "lapic_nmi", static struct sysdev_class nmi_sysclass = {
.bus = &system_bus_type, set_kset_name("lapic_nmi"),
.resume = lapic_nmi_resume, .resume = lapic_nmi_resume,
.suspend = lapic_nmi_suspend, .suspend = lapic_nmi_suspend,
}; };
static struct sys_device device_lapic_nmi = { static struct sys_device device_lapic_nmi = {
.name = "lapic_nmi", .id = 0,
.id = 0, .cls = &nmi_sysclass,
.dev = {
.name = "lapic_nmi",
.driver = &lapic_nmi_driver,
.parent = &device_lapic.dev,
},
}; };
static int __init init_lapic_nmi_devicefs(void) static int __init init_lapic_nmi_sysfs(void)
{ {
int error;
if (nmi_active == 0) if (nmi_active == 0)
return 0; return 0;
driver_register(&lapic_nmi_driver);
return sys_device_register(&device_lapic_nmi); error = sysdev_class_register(&nmi_sysclass);
if (!error)
error = sys_device_register(&device_lapic_nmi);
return error;
} }
/* must come after the local APIC's device_initcall() */ /* must come after the local APIC's device_initcall() */
late_initcall(init_lapic_nmi_devicefs); late_initcall(init_lapic_nmi_sysfs);
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment