@@ -92,7 +92,7 @@ asmlinkage __visible int xo1_do_sleep(u8 sleep_state)
return 0;
}
-static void xo1_power_off(void)
+static void xo1_power_off(struct power_off_handler_block *this)
{
printk(KERN_INFO "OLPC XO-1 power off sequence...\n");
@@ -110,6 +110,11 @@ static void xo1_power_off(void)
outl(0x00002000, acpi_base + CS5536_PM1_CNT);
}
+static struct power_off_handler_block xo1_power_off_hb = {
+ .handler = xo1_power_off,
+ .priority = POWER_OFF_PRIORITY_HIGH,
+};
+
static int xo1_power_state_valid(suspend_state_t pm_state)
{
/* suspend-to-RAM only */
@@ -146,8 +151,12 @@ static int xo1_pm_probe(struct platform_device *pdev)
/* If we have both addresses, we can override the poweroff hook */
if (pms_base && acpi_base) {
+ err = register_power_off_handler(&xo1_power_off_hb);
+ if (err) {
+ dev_err(&pdev->dev, "Failed to register power-off handler\n");
+ return err;
+ }
suspend_set_ops(&xo1_suspend_ops);
- pm_power_off = xo1_power_off;
printk(KERN_INFO "OLPC XO-1 support registered\n");
}
@@ -158,12 +167,13 @@ static int xo1_pm_remove(struct platform_device *pdev)
{
mfd_cell_disable(pdev);
+ unregister_power_off_handler(&xo1_power_off_hb);
+
if (strcmp(pdev->name, "cs5535-pms") == 0)
pms_base = 0;
else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
acpi_base = 0;
- pm_power_off = NULL;
return 0;
}