Commit 3cc944bb authored by Patrick Mochel's avatar Patrick Mochel

[lapic] Convert to new system device API.

parent 60c37a8b
...@@ -484,13 +484,11 @@ static struct { ...@@ -484,13 +484,11 @@ static struct {
unsigned int apic_thmr; unsigned int apic_thmr;
} apic_pm_state; } apic_pm_state;
static int lapic_suspend(struct device *dev, u32 state, u32 level) static int lapic_suspend(struct sys_device *dev, u32 state)
{ {
unsigned int l, h; unsigned int l, h;
unsigned long flags; unsigned long flags;
if (level != SUSPEND_POWER_DOWN)
return 0;
if (!apic_pm_state.active) if (!apic_pm_state.active)
return 0; return 0;
...@@ -517,13 +515,11 @@ static int lapic_suspend(struct device *dev, u32 state, u32 level) ...@@ -517,13 +515,11 @@ static int lapic_suspend(struct device *dev, u32 state, u32 level)
return 0; return 0;
} }
static int lapic_resume(struct device *dev, u32 level) static int lapic_resume(struct sys_device *dev)
{ {
unsigned int l, h; unsigned int l, h;
unsigned long flags; unsigned long flags;
if (level != RESUME_POWER_ON)
return 0;
if (!apic_pm_state.active) if (!apic_pm_state.active)
return 0; return 0;
...@@ -557,38 +553,37 @@ static int lapic_resume(struct device *dev, u32 level) ...@@ -557,38 +553,37 @@ static int lapic_resume(struct device *dev, u32 level)
return 0; return 0;
} }
static struct device_driver lapic_driver = {
.name = "lapic", static struct sysdev_class lapic_sysclass = {
.bus = &system_bus_type, set_kset_name("lapic"),
.resume = lapic_resume, .resume = lapic_resume,
.suspend = lapic_suspend, .suspend = lapic_suspend,
}; };
/* not static, needed by child devices */ static struct sys_device device_lapic = {
struct sys_device device_lapic = { .id = 0,
.name = "lapic", .cls = &lapic_sysclass,
.id = 0,
.dev = {
.name = "lapic",
.driver = &lapic_driver,
},
}; };
EXPORT_SYMBOL(device_lapic);
static void __init apic_pm_activate(void) static void __init apic_pm_activate(void)
{ {
apic_pm_state.active = 1; apic_pm_state.active = 1;
} }
static int __init init_lapic_devicefs(void) static int __init init_lapic_sysfs(void)
{ {
int error;
if (!cpu_has_apic) if (!cpu_has_apic)
return 0; return 0;
/* XXX: remove suspend/resume procs if !apic_pm_state.active? */ /* XXX: remove suspend/resume procs if !apic_pm_state.active? */
driver_register(&lapic_driver);
return sys_device_register(&device_lapic); error = sysdev_class_register(&lapic_sysclass);
if (!error)
error = sys_device_register(&device_lapic);
return error;
} }
device_initcall(init_lapic_devicefs); device_initcall(init_lapic_sysfs);
#else /* CONFIG_PM */ #else /* 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