Commit 6148d38b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-acpi'

* pm-acpi: (24 commits)
  olpc-xo15-sci: Use struct dev_pm_ops for power management
  ACPI / PM: Drop PM callbacks from the ACPI bus type
  ACPI / PM: Drop legacy driver PM callbacks that are not used any more
  ACPI / PM: Do not execute legacy driver PM callbacks
  acpi_power_meter: Use struct dev_pm_ops for power management
  fujitsu-tablet: Use struct dev_pm_ops for power management
  classmate-laptop: Use struct dev_pm_ops for power management
  xo15-ebook: Use struct dev_pm_ops for power management
  toshiba_bluetooth: Use struct dev_pm_ops for power management
  panasonic-laptop: Use struct dev_pm_ops for power management
  sony-laptop: Use struct dev_pm_ops for power management
  hp_accel: Use struct dev_pm_ops for power management
  toshiba_acpi: Use struct dev_pm_ops for power management
  ACPI: Use struct dev_pm_ops for power management in the SBS driver
  ACPI: Use struct dev_pm_ops for power management in the power driver
  ACPI: Use struct dev_pm_ops for power management in the button driver
  ACPI: Use struct dev_pm_ops for power management in the battery driver
  ACPI: Use struct dev_pm_ops for power management in the AC driver
  ACPI: Use struct dev_pm_ops for power management in processor driver
  ACPI: Use struct dev_pm_ops for power management in the thermal driver
  ...
parents d52fdf13 18468843
...@@ -203,7 +203,7 @@ static int xo15_sci_remove(struct acpi_device *device, int type) ...@@ -203,7 +203,7 @@ static int xo15_sci_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int xo15_sci_resume(struct acpi_device *device) static int xo15_sci_resume(struct device *dev)
{ {
/* Enable all EC events */ /* Enable all EC events */
olpc_ec_mask_write(EC_SCI_SRC_ALL); olpc_ec_mask_write(EC_SCI_SRC_ALL);
...@@ -215,6 +215,8 @@ static int xo15_sci_resume(struct acpi_device *device) ...@@ -215,6 +215,8 @@ static int xo15_sci_resume(struct acpi_device *device)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(xo15_sci_pm, NULL, xo15_sci_resume);
static const struct acpi_device_id xo15_sci_device_ids[] = { static const struct acpi_device_id xo15_sci_device_ids[] = {
{"XO15EC", 0}, {"XO15EC", 0},
{"", 0}, {"", 0},
...@@ -227,8 +229,8 @@ static struct acpi_driver xo15_sci_drv = { ...@@ -227,8 +229,8 @@ static struct acpi_driver xo15_sci_drv = {
.ops = { .ops = {
.add = xo15_sci_add, .add = xo15_sci_add,
.remove = xo15_sci_remove, .remove = xo15_sci_remove,
.resume = xo15_sci_resume,
}, },
.drv.pm = &xo15_sci_pm,
}; };
static int __init xo15_sci_init(void) static int __init xo15_sci_init(void)
......
...@@ -61,7 +61,6 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file); ...@@ -61,7 +61,6 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
static int acpi_ac_add(struct acpi_device *device); static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_remove(struct acpi_device *device, int type);
static int acpi_ac_resume(struct acpi_device *device);
static void acpi_ac_notify(struct acpi_device *device, u32 event); static void acpi_ac_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id ac_device_ids[] = { static const struct acpi_device_id ac_device_ids[] = {
...@@ -70,6 +69,9 @@ static const struct acpi_device_id ac_device_ids[] = { ...@@ -70,6 +69,9 @@ static const struct acpi_device_id ac_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, ac_device_ids); MODULE_DEVICE_TABLE(acpi, ac_device_ids);
static int acpi_ac_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static struct acpi_driver acpi_ac_driver = { static struct acpi_driver acpi_ac_driver = {
.name = "ac", .name = "ac",
.class = ACPI_AC_CLASS, .class = ACPI_AC_CLASS,
...@@ -78,9 +80,9 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -78,9 +80,9 @@ static struct acpi_driver acpi_ac_driver = {
.ops = { .ops = {
.add = acpi_ac_add, .add = acpi_ac_add,
.remove = acpi_ac_remove, .remove = acpi_ac_remove,
.resume = acpi_ac_resume,
.notify = acpi_ac_notify, .notify = acpi_ac_notify,
}, },
.drv.pm = &acpi_ac_pm,
}; };
struct acpi_ac { struct acpi_ac {
...@@ -309,13 +311,18 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -309,13 +311,18 @@ static int acpi_ac_add(struct acpi_device *device)
return result; return result;
} }
static int acpi_ac_resume(struct acpi_device *device) static int acpi_ac_resume(struct device *dev)
{ {
struct acpi_ac *ac; struct acpi_ac *ac;
unsigned old_state; unsigned old_state;
if (!device || !acpi_driver_data(device))
if (!dev)
return -EINVAL; return -EINVAL;
ac = acpi_driver_data(device);
ac = acpi_driver_data(to_acpi_device(dev));
if (!ac)
return -EINVAL;
old_state = ac->state; old_state = ac->state;
if (acpi_ac_get_state(ac)) if (acpi_ac_get_state(ac))
return 0; return 0;
......
...@@ -1044,17 +1044,24 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -1044,17 +1044,24 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
} }
/* this is needed to learn about changes made in suspended state */ /* this is needed to learn about changes made in suspended state */
static int acpi_battery_resume(struct acpi_device *device) static int acpi_battery_resume(struct device *dev)
{ {
struct acpi_battery *battery; struct acpi_battery *battery;
if (!device)
if (!dev)
return -EINVAL; return -EINVAL;
battery = acpi_driver_data(device);
battery = acpi_driver_data(to_acpi_device(dev));
if (!battery)
return -EINVAL;
battery->update_time = 0; battery->update_time = 0;
acpi_battery_update(battery); acpi_battery_update(battery);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
static struct acpi_driver acpi_battery_driver = { static struct acpi_driver acpi_battery_driver = {
.name = "battery", .name = "battery",
.class = ACPI_BATTERY_CLASS, .class = ACPI_BATTERY_CLASS,
...@@ -1062,10 +1069,10 @@ static struct acpi_driver acpi_battery_driver = { ...@@ -1062,10 +1069,10 @@ static struct acpi_driver acpi_battery_driver = {
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = { .ops = {
.add = acpi_battery_add, .add = acpi_battery_add,
.resume = acpi_battery_resume,
.remove = acpi_battery_remove, .remove = acpi_battery_remove,
.notify = acpi_battery_notify, .notify = acpi_battery_notify,
}, },
.drv.pm = &acpi_battery_pm,
}; };
static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
......
...@@ -76,19 +76,21 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids); ...@@ -76,19 +76,21 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
static int acpi_button_add(struct acpi_device *device); static int acpi_button_add(struct acpi_device *device);
static int acpi_button_remove(struct acpi_device *device, int type); static int acpi_button_remove(struct acpi_device *device, int type);
static int acpi_button_resume(struct acpi_device *device);
static void acpi_button_notify(struct acpi_device *device, u32 event); static void acpi_button_notify(struct acpi_device *device, u32 event);
static int acpi_button_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume);
static struct acpi_driver acpi_button_driver = { static struct acpi_driver acpi_button_driver = {
.name = "button", .name = "button",
.class = ACPI_BUTTON_CLASS, .class = ACPI_BUTTON_CLASS,
.ids = button_device_ids, .ids = button_device_ids,
.ops = { .ops = {
.add = acpi_button_add, .add = acpi_button_add,
.resume = acpi_button_resume,
.remove = acpi_button_remove, .remove = acpi_button_remove,
.notify = acpi_button_notify, .notify = acpi_button_notify,
}, },
.drv.pm = &acpi_button_pm,
}; };
struct acpi_button { struct acpi_button {
...@@ -308,8 +310,9 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) ...@@ -308,8 +310,9 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
} }
} }
static int acpi_button_resume(struct acpi_device *device) static int acpi_button_resume(struct device *dev)
{ {
struct acpi_device *device = to_acpi_device(dev);
struct acpi_button *button = acpi_driver_data(device); struct acpi_button *button = acpi_driver_data(device);
if (button->type == ACPI_BUTTON_TYPE_LID) if (button->type == ACPI_BUTTON_TYPE_LID)
......
...@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL"); ...@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL");
static int acpi_fan_add(struct acpi_device *device); static int acpi_fan_add(struct acpi_device *device);
static int acpi_fan_remove(struct acpi_device *device, int type); static int acpi_fan_remove(struct acpi_device *device, int type);
static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state);
static int acpi_fan_resume(struct acpi_device *device);
static const struct acpi_device_id fan_device_ids[] = { static const struct acpi_device_id fan_device_ids[] = {
{"PNP0C0B", 0}, {"PNP0C0B", 0},
...@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = { ...@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, fan_device_ids); MODULE_DEVICE_TABLE(acpi, fan_device_ids);
static int acpi_fan_suspend(struct device *dev);
static int acpi_fan_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
static struct acpi_driver acpi_fan_driver = { static struct acpi_driver acpi_fan_driver = {
.name = "fan", .name = "fan",
.class = ACPI_FAN_CLASS, .class = ACPI_FAN_CLASS,
...@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = { ...@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = {
.ops = { .ops = {
.add = acpi_fan_add, .add = acpi_fan_add,
.remove = acpi_fan_remove, .remove = acpi_fan_remove,
.suspend = acpi_fan_suspend,
.resume = acpi_fan_resume,
}, },
.drv.pm = &acpi_fan_pm,
}; };
/* thermal cooling device callbacks */ /* thermal cooling device callbacks */
...@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type) ...@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state) static int acpi_fan_suspend(struct device *dev)
{ {
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
acpi_bus_set_power(device->handle, ACPI_STATE_D0); acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);
return AE_OK; return AE_OK;
} }
static int acpi_fan_resume(struct acpi_device *device) static int acpi_fan_resume(struct device *dev)
{ {
int result; int result;
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
result = acpi_bus_update_power(device->handle, NULL); result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
if (result) if (result)
printk(KERN_ERR PREFIX "Error updating fan power state\n"); printk(KERN_ERR PREFIX "Error updating fan power state\n");
......
...@@ -60,7 +60,6 @@ ACPI_MODULE_NAME("power"); ...@@ -60,7 +60,6 @@ ACPI_MODULE_NAME("power");
static int acpi_power_add(struct acpi_device *device); static int acpi_power_add(struct acpi_device *device);
static int acpi_power_remove(struct acpi_device *device, int type); static int acpi_power_remove(struct acpi_device *device, int type);
static int acpi_power_resume(struct acpi_device *device);
static const struct acpi_device_id power_device_ids[] = { static const struct acpi_device_id power_device_ids[] = {
{ACPI_POWER_HID, 0}, {ACPI_POWER_HID, 0},
...@@ -68,6 +67,9 @@ static const struct acpi_device_id power_device_ids[] = { ...@@ -68,6 +67,9 @@ static const struct acpi_device_id power_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, power_device_ids); MODULE_DEVICE_TABLE(acpi, power_device_ids);
static int acpi_power_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume);
static struct acpi_driver acpi_power_driver = { static struct acpi_driver acpi_power_driver = {
.name = "power", .name = "power",
.class = ACPI_POWER_CLASS, .class = ACPI_POWER_CLASS,
...@@ -75,8 +77,8 @@ static struct acpi_driver acpi_power_driver = { ...@@ -75,8 +77,8 @@ static struct acpi_driver acpi_power_driver = {
.ops = { .ops = {
.add = acpi_power_add, .add = acpi_power_add,
.remove = acpi_power_remove, .remove = acpi_power_remove,
.resume = acpi_power_resume,
}, },
.drv.pm = &acpi_power_pm,
}; };
/* /*
...@@ -771,14 +773,16 @@ static int acpi_power_remove(struct acpi_device *device, int type) ...@@ -771,14 +773,16 @@ static int acpi_power_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_power_resume(struct acpi_device *device) static int acpi_power_resume(struct device *dev)
{ {
int result = 0, state; int result = 0, state;
struct acpi_device *device;
struct acpi_power_resource *resource; struct acpi_power_resource *resource;
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
device = to_acpi_device(dev);
resource = acpi_driver_data(device); resource = acpi_driver_data(device);
if (!resource) if (!resource)
return -EINVAL; return -EINVAL;
......
...@@ -93,6 +93,9 @@ static const struct acpi_device_id processor_device_ids[] = { ...@@ -93,6 +93,9 @@ static const struct acpi_device_id processor_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, processor_device_ids); MODULE_DEVICE_TABLE(acpi, processor_device_ids);
static SIMPLE_DEV_PM_OPS(acpi_processor_pm,
acpi_processor_suspend, acpi_processor_resume);
static struct acpi_driver acpi_processor_driver = { static struct acpi_driver acpi_processor_driver = {
.name = "processor", .name = "processor",
.class = ACPI_PROCESSOR_CLASS, .class = ACPI_PROCESSOR_CLASS,
...@@ -100,10 +103,9 @@ static struct acpi_driver acpi_processor_driver = { ...@@ -100,10 +103,9 @@ static struct acpi_driver acpi_processor_driver = {
.ops = { .ops = {
.add = acpi_processor_add, .add = acpi_processor_add,
.remove = acpi_processor_remove, .remove = acpi_processor_remove,
.suspend = acpi_processor_suspend,
.resume = acpi_processor_resume,
.notify = acpi_processor_notify, .notify = acpi_processor_notify,
}, },
.drv.pm = &acpi_processor_pm,
}; };
#define INSTALL_NOTIFY_HANDLER 1 #define INSTALL_NOTIFY_HANDLER 1
......
...@@ -237,13 +237,13 @@ static void acpi_idle_bm_rld_restore(void) ...@@ -237,13 +237,13 @@ static void acpi_idle_bm_rld_restore(void)
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
} }
int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) int acpi_processor_suspend(struct device *dev)
{ {
acpi_idle_bm_rld_save(); acpi_idle_bm_rld_save();
return 0; return 0;
} }
int acpi_processor_resume(struct acpi_device * device) int acpi_processor_resume(struct device *dev)
{ {
acpi_idle_bm_rld_restore(); acpi_idle_bm_rld_restore();
return 0; return 0;
......
...@@ -988,16 +988,18 @@ static void acpi_sbs_rmdirs(void) ...@@ -988,16 +988,18 @@ static void acpi_sbs_rmdirs(void)
#endif #endif
} }
static int acpi_sbs_resume(struct acpi_device *device) static int acpi_sbs_resume(struct device *dev)
{ {
struct acpi_sbs *sbs; struct acpi_sbs *sbs;
if (!device) if (!dev)
return -EINVAL; return -EINVAL;
sbs = device->driver_data; sbs = to_acpi_device(dev)->driver_data;
acpi_sbs_callback(sbs); acpi_sbs_callback(sbs);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
static struct acpi_driver acpi_sbs_driver = { static struct acpi_driver acpi_sbs_driver = {
.name = "sbs", .name = "sbs",
.class = ACPI_SBS_CLASS, .class = ACPI_SBS_CLASS,
...@@ -1005,8 +1007,8 @@ static struct acpi_driver acpi_sbs_driver = { ...@@ -1005,8 +1007,8 @@ static struct acpi_driver acpi_sbs_driver = {
.ops = { .ops = {
.add = acpi_sbs_add, .add = acpi_sbs_add,
.remove = acpi_sbs_remove, .remove = acpi_sbs_remove,
.resume = acpi_sbs_resume,
}, },
.drv.pm = &acpi_sbs_pm,
}; };
static int __init acpi_sbs_init(void) static int __init acpi_sbs_init(void)
......
...@@ -290,26 +290,6 @@ static void acpi_device_release(struct device *dev) ...@@ -290,26 +290,6 @@ static void acpi_device_release(struct device *dev)
kfree(acpi_dev); kfree(acpi_dev);
} }
static int acpi_device_suspend(struct device *dev, pm_message_t state)
{
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_driver *acpi_drv = acpi_dev->driver;
if (acpi_drv && acpi_drv->ops.suspend)
return acpi_drv->ops.suspend(acpi_dev, state);
return 0;
}
static int acpi_device_resume(struct device *dev)
{
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_driver *acpi_drv = acpi_dev->driver;
if (acpi_drv && acpi_drv->ops.resume)
return acpi_drv->ops.resume(acpi_dev);
return 0;
}
static int acpi_bus_match(struct device *dev, struct device_driver *drv) static int acpi_bus_match(struct device *dev, struct device_driver *drv)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
...@@ -441,8 +421,6 @@ static int acpi_device_remove(struct device * dev) ...@@ -441,8 +421,6 @@ static int acpi_device_remove(struct device * dev)
struct bus_type acpi_bus_type = { struct bus_type acpi_bus_type = {
.name = "acpi", .name = "acpi",
.suspend = acpi_device_suspend,
.resume = acpi_device_resume,
.match = acpi_bus_match, .match = acpi_bus_match,
.probe = acpi_device_probe, .probe = acpi_device_probe,
.remove = acpi_device_remove, .remove = acpi_device_remove,
......
...@@ -98,7 +98,6 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); ...@@ -98,7 +98,6 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
static int acpi_thermal_add(struct acpi_device *device); static int acpi_thermal_add(struct acpi_device *device);
static int acpi_thermal_remove(struct acpi_device *device, int type); static int acpi_thermal_remove(struct acpi_device *device, int type);
static int acpi_thermal_resume(struct acpi_device *device);
static void acpi_thermal_notify(struct acpi_device *device, u32 event); static void acpi_thermal_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id thermal_device_ids[] = { static const struct acpi_device_id thermal_device_ids[] = {
...@@ -107,6 +106,9 @@ static const struct acpi_device_id thermal_device_ids[] = { ...@@ -107,6 +106,9 @@ static const struct acpi_device_id thermal_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, thermal_device_ids); MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
static int acpi_thermal_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
static struct acpi_driver acpi_thermal_driver = { static struct acpi_driver acpi_thermal_driver = {
.name = "thermal", .name = "thermal",
.class = ACPI_THERMAL_CLASS, .class = ACPI_THERMAL_CLASS,
...@@ -114,9 +116,9 @@ static struct acpi_driver acpi_thermal_driver = { ...@@ -114,9 +116,9 @@ static struct acpi_driver acpi_thermal_driver = {
.ops = { .ops = {
.add = acpi_thermal_add, .add = acpi_thermal_add,
.remove = acpi_thermal_remove, .remove = acpi_thermal_remove,
.resume = acpi_thermal_resume,
.notify = acpi_thermal_notify, .notify = acpi_thermal_notify,
}, },
.drv.pm = &acpi_thermal_pm,
}; };
struct acpi_thermal_state { struct acpi_thermal_state {
...@@ -1041,16 +1043,17 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) ...@@ -1041,16 +1043,17 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_thermal_resume(struct acpi_device *device) static int acpi_thermal_resume(struct device *dev)
{ {
struct acpi_thermal *tz = NULL; struct acpi_thermal *tz;
int i, j, power_state, result; int i, j, power_state, result;
if (!dev)
if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
tz = acpi_driver_data(device); tz = acpi_driver_data(to_acpi_device(dev));
if (!tz)
return -EINVAL;
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
if (!(&tz->trips.active[i])) if (!(&tz->trips.active[i]))
......
...@@ -929,20 +929,25 @@ static int acpi_power_meter_remove(struct acpi_device *device, int type) ...@@ -929,20 +929,25 @@ static int acpi_power_meter_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_power_meter_resume(struct acpi_device *device) static int acpi_power_meter_resume(struct device *dev)
{ {
struct acpi_power_meter_resource *resource; struct acpi_power_meter_resource *resource;
if (!device || !acpi_driver_data(device)) if (!dev)
return -EINVAL;
resource = acpi_driver_data(to_acpi_device(dev));
if (!resource)
return -EINVAL; return -EINVAL;
resource = acpi_driver_data(device);
free_capabilities(resource); free_capabilities(resource);
read_capabilities(resource); read_capabilities(resource);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(acpi_power_meter_pm, NULL, acpi_power_meter_resume);
static struct acpi_driver acpi_power_meter_driver = { static struct acpi_driver acpi_power_meter_driver = {
.name = "power_meter", .name = "power_meter",
.class = ACPI_POWER_METER_CLASS, .class = ACPI_POWER_METER_CLASS,
...@@ -950,9 +955,9 @@ static struct acpi_driver acpi_power_meter_driver = { ...@@ -950,9 +955,9 @@ static struct acpi_driver acpi_power_meter_driver = {
.ops = { .ops = {
.add = acpi_power_meter_add, .add = acpi_power_meter_add,
.remove = acpi_power_meter_remove, .remove = acpi_power_meter_remove,
.resume = acpi_power_meter_resume,
.notify = acpi_power_meter_notify, .notify = acpi_power_meter_notify,
}, },
.drv.pm = &acpi_power_meter_pm,
}; };
/* Module init/exit routines */ /* Module init/exit routines */
......
...@@ -362,15 +362,18 @@ static int cmpc_tablet_remove(struct acpi_device *acpi, int type) ...@@ -362,15 +362,18 @@ static int cmpc_tablet_remove(struct acpi_device *acpi, int type)
return cmpc_remove_acpi_notify_device(acpi); return cmpc_remove_acpi_notify_device(acpi);
} }
static int cmpc_tablet_resume(struct acpi_device *acpi) static int cmpc_tablet_resume(struct device *dev)
{ {
struct input_dev *inputdev = dev_get_drvdata(&acpi->dev); struct input_dev *inputdev = dev_get_drvdata(dev);
unsigned long long val = 0; unsigned long long val = 0;
if (ACPI_SUCCESS(cmpc_get_tablet(acpi->handle, &val))) if (ACPI_SUCCESS(cmpc_get_tablet(to_acpi_device(dev)->handle, &val)))
input_report_switch(inputdev, SW_TABLET_MODE, !val); input_report_switch(inputdev, SW_TABLET_MODE, !val);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(cmpc_tablet_pm, NULL, cmpc_tablet_resume);
static const struct acpi_device_id cmpc_tablet_device_ids[] = { static const struct acpi_device_id cmpc_tablet_device_ids[] = {
{CMPC_TABLET_HID, 0}, {CMPC_TABLET_HID, 0},
{"", 0} {"", 0}
...@@ -384,9 +387,9 @@ static struct acpi_driver cmpc_tablet_acpi_driver = { ...@@ -384,9 +387,9 @@ static struct acpi_driver cmpc_tablet_acpi_driver = {
.ops = { .ops = {
.add = cmpc_tablet_add, .add = cmpc_tablet_add,
.remove = cmpc_tablet_remove, .remove = cmpc_tablet_remove,
.resume = cmpc_tablet_resume,
.notify = cmpc_tablet_handler, .notify = cmpc_tablet_handler,
} },
.drv.pm = &cmpc_tablet_pm,
}; };
......
...@@ -440,12 +440,14 @@ static int __devexit acpi_fujitsu_remove(struct acpi_device *adev, int type) ...@@ -440,12 +440,14 @@ static int __devexit acpi_fujitsu_remove(struct acpi_device *adev, int type)
return 0; return 0;
} }
static int acpi_fujitsu_resume(struct acpi_device *adev) static int acpi_fujitsu_resume(struct device *dev)
{ {
fujitsu_reset(); fujitsu_reset();
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(acpi_fujitsu_pm, NULL, acpi_fujitsu_resume);
static struct acpi_driver acpi_fujitsu_driver = { static struct acpi_driver acpi_fujitsu_driver = {
.name = MODULENAME, .name = MODULENAME,
.class = "hotkey", .class = "hotkey",
...@@ -453,8 +455,8 @@ static struct acpi_driver acpi_fujitsu_driver = { ...@@ -453,8 +455,8 @@ static struct acpi_driver acpi_fujitsu_driver = {
.ops = { .ops = {
.add = acpi_fujitsu_add, .add = acpi_fujitsu_add,
.remove = acpi_fujitsu_remove, .remove = acpi_fujitsu_remove,
.resume = acpi_fujitsu_resume, },
} .drv.pm = &acpi_fujitsu_pm,
}; };
static int __init fujitsu_module_init(void) static int __init fujitsu_module_init(void)
......
...@@ -353,20 +353,22 @@ static int lis3lv02d_remove(struct acpi_device *device, int type) ...@@ -353,20 +353,22 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state) static int lis3lv02d_suspend(struct device *dev)
{ {
/* make sure the device is off when we suspend */ /* make sure the device is off when we suspend */
lis3lv02d_poweroff(&lis3_dev); lis3lv02d_poweroff(&lis3_dev);
return 0; return 0;
} }
static int lis3lv02d_resume(struct acpi_device *device) static int lis3lv02d_resume(struct device *dev)
{ {
return lis3lv02d_poweron(&lis3_dev); return lis3lv02d_poweron(&lis3_dev);
} }
static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);
#define HP_ACCEL_PM (&hp_accel_pm)
#else #else
#define lis3lv02d_suspend NULL #define HP_ACCEL_PM NULL
#define lis3lv02d_resume NULL
#endif #endif
/* For the HP MDPS aka 3D Driveguard */ /* For the HP MDPS aka 3D Driveguard */
...@@ -377,9 +379,8 @@ static struct acpi_driver lis3lv02d_driver = { ...@@ -377,9 +379,8 @@ static struct acpi_driver lis3lv02d_driver = {
.ops = { .ops = {
.add = lis3lv02d_add, .add = lis3lv02d_add,
.remove = lis3lv02d_remove, .remove = lis3lv02d_remove,
.suspend = lis3lv02d_suspend, },
.resume = lis3lv02d_resume, .drv.pm = HP_ACCEL_PM,
}
}; };
static int __init lis3lv02d_init_module(void) static int __init lis3lv02d_init_module(void)
......
...@@ -177,7 +177,6 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0, ...@@ -177,7 +177,6 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0,
static int acpi_pcc_hotkey_add(struct acpi_device *device); static int acpi_pcc_hotkey_add(struct acpi_device *device);
static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type); static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
static int acpi_pcc_hotkey_resume(struct acpi_device *device);
static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event); static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id pcc_device_ids[] = { static const struct acpi_device_id pcc_device_ids[] = {
...@@ -189,6 +188,9 @@ static const struct acpi_device_id pcc_device_ids[] = { ...@@ -189,6 +188,9 @@ static const struct acpi_device_id pcc_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, pcc_device_ids); MODULE_DEVICE_TABLE(acpi, pcc_device_ids);
static int acpi_pcc_hotkey_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(acpi_pcc_hotkey_pm, NULL, acpi_pcc_hotkey_resume);
static struct acpi_driver acpi_pcc_driver = { static struct acpi_driver acpi_pcc_driver = {
.name = ACPI_PCC_DRIVER_NAME, .name = ACPI_PCC_DRIVER_NAME,
.class = ACPI_PCC_CLASS, .class = ACPI_PCC_CLASS,
...@@ -196,9 +198,9 @@ static struct acpi_driver acpi_pcc_driver = { ...@@ -196,9 +198,9 @@ static struct acpi_driver acpi_pcc_driver = {
.ops = { .ops = {
.add = acpi_pcc_hotkey_add, .add = acpi_pcc_hotkey_add,
.remove = acpi_pcc_hotkey_remove, .remove = acpi_pcc_hotkey_remove,
.resume = acpi_pcc_hotkey_resume,
.notify = acpi_pcc_hotkey_notify, .notify = acpi_pcc_hotkey_notify,
}, },
.drv.pm = &acpi_pcc_hotkey_pm,
}; };
static const struct key_entry panasonic_keymap[] = { static const struct key_entry panasonic_keymap[] = {
...@@ -538,11 +540,15 @@ static void acpi_pcc_destroy_input(struct pcc_acpi *pcc) ...@@ -538,11 +540,15 @@ static void acpi_pcc_destroy_input(struct pcc_acpi *pcc)
/* kernel module interface */ /* kernel module interface */
static int acpi_pcc_hotkey_resume(struct acpi_device *device) static int acpi_pcc_hotkey_resume(struct device *dev)
{ {
struct pcc_acpi *pcc = acpi_driver_data(device); struct pcc_acpi *pcc;
if (!dev)
return -EINVAL;
if (device == NULL || pcc == NULL) pcc = acpi_driver_data(to_acpi_device(dev));
if (!pcc)
return -EINVAL; return -EINVAL;
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n", ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n",
......
...@@ -1452,7 +1452,7 @@ static void sony_nc_function_resume(void) ...@@ -1452,7 +1452,7 @@ static void sony_nc_function_resume(void)
&result); &result);
} }
static int sony_nc_resume(struct acpi_device *device) static int sony_nc_resume(struct device *dev)
{ {
struct sony_nc_value *item; struct sony_nc_value *item;
acpi_handle handle; acpi_handle handle;
...@@ -1484,6 +1484,8 @@ static int sony_nc_resume(struct acpi_device *device) ...@@ -1484,6 +1484,8 @@ static int sony_nc_resume(struct acpi_device *device)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(sony_nc_pm, NULL, sony_nc_resume);
static void sony_nc_rfkill_cleanup(void) static void sony_nc_rfkill_cleanup(void)
{ {
int i; int i;
...@@ -2728,9 +2730,9 @@ static struct acpi_driver sony_nc_driver = { ...@@ -2728,9 +2730,9 @@ static struct acpi_driver sony_nc_driver = {
.ops = { .ops = {
.add = sony_nc_add, .add = sony_nc_add,
.remove = sony_nc_remove, .remove = sony_nc_remove,
.resume = sony_nc_resume,
.notify = sony_nc_notify, .notify = sony_nc_notify,
}, },
.drv.pm = &sony_nc_pm,
}; };
/*********** SPIC (SNY6001) Device ***********/ /*********** SPIC (SNY6001) Device ***********/
...@@ -4243,19 +4245,22 @@ static int sony_pic_add(struct acpi_device *device) ...@@ -4243,19 +4245,22 @@ static int sony_pic_add(struct acpi_device *device)
return result; return result;
} }
static int sony_pic_suspend(struct acpi_device *device, pm_message_t state) static int sony_pic_suspend(struct device *dev)
{ {
if (sony_pic_disable(device)) if (sony_pic_disable(to_acpi_device(dev)))
return -ENXIO; return -ENXIO;
return 0; return 0;
} }
static int sony_pic_resume(struct acpi_device *device) static int sony_pic_resume(struct device *dev)
{ {
sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); sony_pic_enable(to_acpi_device(dev),
spic_dev.cur_ioport, spic_dev.cur_irq);
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(sony_pic_pm, sony_pic_suspend, sony_pic_resume);
static const struct acpi_device_id sony_pic_device_ids[] = { static const struct acpi_device_id sony_pic_device_ids[] = {
{SONY_PIC_HID, 0}, {SONY_PIC_HID, 0},
{"", 0}, {"", 0},
...@@ -4269,9 +4274,8 @@ static struct acpi_driver sony_pic_driver = { ...@@ -4269,9 +4274,8 @@ static struct acpi_driver sony_pic_driver = {
.ops = { .ops = {
.add = sony_pic_add, .add = sony_pic_add,
.remove = sony_pic_remove, .remove = sony_pic_remove,
.suspend = sony_pic_suspend,
.resume = sony_pic_resume,
}, },
.drv.pm = &sony_pic_pm,
}; };
static struct dmi_system_id __initdata sonypi_dmi_table[] = { static struct dmi_system_id __initdata sonypi_dmi_table[] = {
......
...@@ -1296,10 +1296,9 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) ...@@ -1296,10 +1296,9 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
} }
} }
static int toshiba_acpi_suspend(struct acpi_device *acpi_dev, static int toshiba_acpi_suspend(struct device *device)
pm_message_t state)
{ {
struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device));
u32 result; u32 result;
if (dev->hotkey_dev) if (dev->hotkey_dev)
...@@ -1308,9 +1307,9 @@ static int toshiba_acpi_suspend(struct acpi_device *acpi_dev, ...@@ -1308,9 +1307,9 @@ static int toshiba_acpi_suspend(struct acpi_device *acpi_dev,
return 0; return 0;
} }
static int toshiba_acpi_resume(struct acpi_device *acpi_dev) static int toshiba_acpi_resume(struct device *device)
{ {
struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device));
u32 result; u32 result;
if (dev->hotkey_dev) if (dev->hotkey_dev)
...@@ -1319,6 +1318,9 @@ static int toshiba_acpi_resume(struct acpi_device *acpi_dev) ...@@ -1319,6 +1318,9 @@ static int toshiba_acpi_resume(struct acpi_device *acpi_dev)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(toshiba_acpi_pm,
toshiba_acpi_suspend, toshiba_acpi_resume);
static struct acpi_driver toshiba_acpi_driver = { static struct acpi_driver toshiba_acpi_driver = {
.name = "Toshiba ACPI driver", .name = "Toshiba ACPI driver",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -1328,9 +1330,8 @@ static struct acpi_driver toshiba_acpi_driver = { ...@@ -1328,9 +1330,8 @@ static struct acpi_driver toshiba_acpi_driver = {
.add = toshiba_acpi_add, .add = toshiba_acpi_add,
.remove = toshiba_acpi_remove, .remove = toshiba_acpi_remove,
.notify = toshiba_acpi_notify, .notify = toshiba_acpi_notify,
.suspend = toshiba_acpi_suspend,
.resume = toshiba_acpi_resume,
}, },
.drv.pm = &toshiba_acpi_pm,
}; };
static int __init toshiba_acpi_init(void) static int __init toshiba_acpi_init(void)
......
...@@ -34,7 +34,6 @@ MODULE_LICENSE("GPL"); ...@@ -34,7 +34,6 @@ MODULE_LICENSE("GPL");
static int toshiba_bt_rfkill_add(struct acpi_device *device); static int toshiba_bt_rfkill_add(struct acpi_device *device);
static int toshiba_bt_rfkill_remove(struct acpi_device *device, int type); static int toshiba_bt_rfkill_remove(struct acpi_device *device, int type);
static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event); static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event);
static int toshiba_bt_resume(struct acpi_device *device);
static const struct acpi_device_id bt_device_ids[] = { static const struct acpi_device_id bt_device_ids[] = {
{ "TOS6205", 0}, { "TOS6205", 0},
...@@ -42,6 +41,9 @@ static const struct acpi_device_id bt_device_ids[] = { ...@@ -42,6 +41,9 @@ static const struct acpi_device_id bt_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, bt_device_ids); MODULE_DEVICE_TABLE(acpi, bt_device_ids);
static int toshiba_bt_resume(struct device *dev);
static SIMPLE_DEV_PM_OPS(toshiba_bt_pm, NULL, toshiba_bt_resume);
static struct acpi_driver toshiba_bt_rfkill_driver = { static struct acpi_driver toshiba_bt_rfkill_driver = {
.name = "Toshiba BT", .name = "Toshiba BT",
.class = "Toshiba", .class = "Toshiba",
...@@ -50,9 +52,9 @@ static struct acpi_driver toshiba_bt_rfkill_driver = { ...@@ -50,9 +52,9 @@ static struct acpi_driver toshiba_bt_rfkill_driver = {
.add = toshiba_bt_rfkill_add, .add = toshiba_bt_rfkill_add,
.remove = toshiba_bt_rfkill_remove, .remove = toshiba_bt_rfkill_remove,
.notify = toshiba_bt_rfkill_notify, .notify = toshiba_bt_rfkill_notify,
.resume = toshiba_bt_resume,
}, },
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv.pm = &toshiba_bt_pm,
}; };
...@@ -88,9 +90,9 @@ static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event) ...@@ -88,9 +90,9 @@ static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event)
toshiba_bluetooth_enable(device->handle); toshiba_bluetooth_enable(device->handle);
} }
static int toshiba_bt_resume(struct acpi_device *device) static int toshiba_bt_resume(struct device *dev)
{ {
return toshiba_bluetooth_enable(device->handle); return toshiba_bluetooth_enable(to_acpi_device(dev)->handle);
} }
static int toshiba_bt_rfkill_add(struct acpi_device *device) static int toshiba_bt_rfkill_add(struct acpi_device *device)
......
...@@ -77,11 +77,13 @@ static void ebook_switch_notify(struct acpi_device *device, u32 event) ...@@ -77,11 +77,13 @@ static void ebook_switch_notify(struct acpi_device *device, u32 event)
} }
} }
static int ebook_switch_resume(struct acpi_device *device) static int ebook_switch_resume(struct device *dev)
{ {
return ebook_send_state(device); return ebook_send_state(to_acpi_device(dev));
} }
static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume);
static int ebook_switch_add(struct acpi_device *device) static int ebook_switch_add(struct acpi_device *device)
{ {
struct ebook_switch *button; struct ebook_switch *button;
...@@ -161,10 +163,10 @@ static struct acpi_driver xo15_ebook_driver = { ...@@ -161,10 +163,10 @@ static struct acpi_driver xo15_ebook_driver = {
.ids = ebook_device_ids, .ids = ebook_device_ids,
.ops = { .ops = {
.add = ebook_switch_add, .add = ebook_switch_add,
.resume = ebook_switch_resume,
.remove = ebook_switch_remove, .remove = ebook_switch_remove,
.notify = ebook_switch_notify, .notify = ebook_switch_notify,
}, },
.drv.pm = &ebook_switch_pm,
}; };
static int __init xo15_ebook_init(void) static int __init xo15_ebook_init(void)
......
...@@ -117,9 +117,6 @@ struct acpi_device; ...@@ -117,9 +117,6 @@ struct acpi_device;
typedef int (*acpi_op_add) (struct acpi_device * device); typedef int (*acpi_op_add) (struct acpi_device * device);
typedef int (*acpi_op_remove) (struct acpi_device * device, int type); typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
typedef int (*acpi_op_start) (struct acpi_device * device); typedef int (*acpi_op_start) (struct acpi_device * device);
typedef int (*acpi_op_suspend) (struct acpi_device * device,
pm_message_t state);
typedef int (*acpi_op_resume) (struct acpi_device * device);
typedef int (*acpi_op_bind) (struct acpi_device * device); typedef int (*acpi_op_bind) (struct acpi_device * device);
typedef int (*acpi_op_unbind) (struct acpi_device * device); typedef int (*acpi_op_unbind) (struct acpi_device * device);
typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
...@@ -133,8 +130,6 @@ struct acpi_device_ops { ...@@ -133,8 +130,6 @@ struct acpi_device_ops {
acpi_op_add add; acpi_op_add add;
acpi_op_remove remove; acpi_op_remove remove;
acpi_op_start start; acpi_op_start start;
acpi_op_suspend suspend;
acpi_op_resume resume;
acpi_op_bind bind; acpi_op_bind bind;
acpi_op_unbind unbind; acpi_op_unbind unbind;
acpi_op_notify notify; acpi_op_notify notify;
......
...@@ -331,8 +331,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr); ...@@ -331,8 +331,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr);
int acpi_processor_hotplug(struct acpi_processor *pr); int acpi_processor_hotplug(struct acpi_processor *pr);
int acpi_processor_power_exit(struct acpi_processor *pr, int acpi_processor_power_exit(struct acpi_processor *pr,
struct acpi_device *device); struct acpi_device *device);
int acpi_processor_suspend(struct acpi_device * device, pm_message_t state); int acpi_processor_suspend(struct device *dev);
int acpi_processor_resume(struct acpi_device * device); int acpi_processor_resume(struct device *dev);
extern struct cpuidle_driver acpi_idle_driver; extern struct cpuidle_driver acpi_idle_driver;
/* in processor_thermal.c */ /* in processor_thermal.c */
......
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