Commit bc2f37cc authored by Patrick Mochel's avatar Patrick Mochel

[oprofile] Convert to use new system device API.

parent 9191f600
...@@ -31,53 +31,48 @@ static int nmi_enabled = 0; ...@@ -31,53 +31,48 @@ static int nmi_enabled = 0;
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int nmi_suspend(struct device *dev, u32 state, u32 level) static int nmi_suspend(struct sys_device *dev, u32 state)
{ {
if (level != SUSPEND_POWER_DOWN)
return 0;
if (nmi_enabled == 1) if (nmi_enabled == 1)
nmi_stop(); nmi_stop();
return 0; return 0;
} }
static int nmi_resume(struct device *dev, u32 level) static int nmi_resume(struct sys_device *dev)
{ {
if (level != RESUME_POWER_ON)
return 0;
if (nmi_enabled == 1) if (nmi_enabled == 1)
nmi_start(); nmi_start();
return 0; return 0;
} }
static struct device_driver nmi_driver = { static struct sysdev_class oprofile_sysclass = {
.name = "oprofile", set_kset_name("oprofile"),
.bus = &system_bus_type,
.resume = nmi_resume, .resume = nmi_resume,
.suspend = nmi_suspend, .suspend = nmi_suspend,
}; };
static struct device device_nmi = { static struct sys_device device_oprofile = {
.name = "oprofile", .id = 0,
.bus_id = "oprofile", .cls = &oprofile_sysclass,
.driver = &nmi_driver,
.parent = &device_lapic.dev,
}; };
static int __init init_driverfs(void) static int __init init_driverfs(void)
{ {
driver_register(&nmi_driver); int error;
return device_register(&device_nmi); if (!(error = sysdev_class_register(&oprofile_sysclass)))
error = sys_device_register(&device_oprofile);
return error;
} }
static void __exit exit_driverfs(void) static void __exit exit_driverfs(void)
{ {
device_unregister(&device_nmi); sys_device_unregister(&device_oprofile);
driver_unregister(&nmi_driver); sysdev_class_unregister(&oprofile_sysclass);
} }
#else #else
......
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