diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-06-29 17:40:13 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-01 07:31:06 -0400 |
commit | 13db85528fd606b2dfd8f1a5952158e4ad6ce51a (patch) | |
tree | 5aa6e694f86f02eb874a672db6f5d482eb867097 /drivers/acpi | |
parent | c5dec0182256361a3f823316e8fb85263f76efe7 (diff) |
ACPI / PM: Do not execute legacy driver PM callbacks
Since all ACPI drivers in the tree should have been switched
to power management handling based on struct dev_pm_ops,
modify the ACPI bus type driver so that is doesn't execute
legacy driver power management callbacks from the functions
pointed to by the members of the acpi_bus_pm structure.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index af924ba85148..c384e59c3d9a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -290,51 +290,45 @@ static void acpi_device_release(struct device *dev) | |||
290 | kfree(acpi_dev); | 290 | kfree(acpi_dev); |
291 | } | 291 | } |
292 | 292 | ||
293 | #define ACPI_DEV_PM_CALLBACK(dev, callback, legacy_cb) \ | 293 | #define ACPI_DEV_PM_CALLBACK(dev, callback) \ |
294 | ({ \ | 294 | ({ \ |
295 | struct acpi_device *__acpi_dev = to_acpi_device(dev); \ | ||
296 | struct acpi_driver *__acpi_drv = __acpi_dev->driver; \ | ||
297 | struct device_driver *__drv = dev->driver; \ | 295 | struct device_driver *__drv = dev->driver; \ |
298 | int __ret; \ | 296 | int __ret = 0; \ |
299 | \ | 297 | \ |
300 | if (__acpi_drv && __acpi_drv->ops.legacy_cb) \ | 298 | if (__drv && __drv->pm && __drv->pm->callback) \ |
301 | __ret = __acpi_drv->ops.legacy_cb(__acpi_dev); \ | ||
302 | else if (__drv && __drv->pm && __drv->pm->callback) \ | ||
303 | __ret = __drv->pm->callback(dev); \ | 299 | __ret = __drv->pm->callback(dev); \ |
304 | else \ | ||
305 | __ret = 0; \ | ||
306 | \ | 300 | \ |
307 | __ret; \ | 301 | __ret; \ |
308 | }) | 302 | }) |
309 | 303 | ||
310 | static int acpi_pm_suspend(struct device *dev) | 304 | static int acpi_pm_suspend(struct device *dev) |
311 | { | 305 | { |
312 | return ACPI_DEV_PM_CALLBACK(dev, suspend, suspend); | 306 | return ACPI_DEV_PM_CALLBACK(dev, suspend); |
313 | } | 307 | } |
314 | 308 | ||
315 | static int acpi_pm_resume(struct device *dev) | 309 | static int acpi_pm_resume(struct device *dev) |
316 | { | 310 | { |
317 | return ACPI_DEV_PM_CALLBACK(dev, resume, resume); | 311 | return ACPI_DEV_PM_CALLBACK(dev, resume); |
318 | } | 312 | } |
319 | 313 | ||
320 | static int acpi_pm_freeze(struct device *dev) | 314 | static int acpi_pm_freeze(struct device *dev) |
321 | { | 315 | { |
322 | return ACPI_DEV_PM_CALLBACK(dev, freeze, suspend); | 316 | return ACPI_DEV_PM_CALLBACK(dev, freeze); |
323 | } | 317 | } |
324 | 318 | ||
325 | static int acpi_pm_thaw(struct device *dev) | 319 | static int acpi_pm_thaw(struct device *dev) |
326 | { | 320 | { |
327 | return ACPI_DEV_PM_CALLBACK(dev, thaw, resume); | 321 | return ACPI_DEV_PM_CALLBACK(dev, thaw); |
328 | } | 322 | } |
329 | 323 | ||
330 | static int acpi_pm_poweroff(struct device *dev) | 324 | static int acpi_pm_poweroff(struct device *dev) |
331 | { | 325 | { |
332 | return ACPI_DEV_PM_CALLBACK(dev, poweroff, suspend); | 326 | return ACPI_DEV_PM_CALLBACK(dev, poweroff); |
333 | } | 327 | } |
334 | 328 | ||
335 | static int acpi_pm_restore(struct device *dev) | 329 | static int acpi_pm_restore(struct device *dev) |
336 | { | 330 | { |
337 | return ACPI_DEV_PM_CALLBACK(dev, restore, resume); | 331 | return ACPI_DEV_PM_CALLBACK(dev, restore); |
338 | } | 332 | } |
339 | 333 | ||
340 | static const struct dev_pm_ops acpi_bus_pm = { | 334 | static const struct dev_pm_ops acpi_bus_pm = { |