aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
commitbc9b6407bd6df3ab7189e5622816bbc11ae9d2d8 (patch)
tree8f44ae6c9750b271eb423787e19db1288b53c42e
parent6a8dd80821c215bc49bf6b108e85c1738c82bf43 (diff)
ACPI / PM: Rework the handling of devices depending on power resources
Commit 0090def6 (ACPI: Add interface to register/unregister device to/from power resources) made it possible to indicate to the ACPI core that if the given device depends on any power resources, then it should be resumed as soon as all of the power resources required by it to transition to the D0 power state have been turned on. Unfortunately, however, this was a mistake, because all devices depending on power resources should be treated this way (i.e. they should be resumed when all power resources required by their D0 state have been turned on) and for the majority of those devices the ACPI core can figure out by itself which (physical) devices depend on what power resources. For this reason, replace the code added by commit 0090def6 with a new, much more straightforward, mechanism that will be used internally by the ACPI core and remove all references to that code from kernel subsystems using ACPI. For the cases when there are (physical) devices that should be resumed whenever a not directly related ACPI device node goes into D0 as a result of power resources configuration changes, like in the SATA case, add two new routines, acpi_dev_pm_add_dependent() and acpi_dev_pm_remove_dependent(), allowing subsystems to manage such dependencies. Convert the SATA subsystem to use the new functions accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/device_pm.c56
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/power.c219
-rw-r--r--drivers/acpi/scan.c8
-rw-r--r--drivers/ata/libata-acpi.c18
-rw-r--r--drivers/pci/pci-acpi.c2
-rw-r--r--include/acpi/acpi_bus.h9
7 files changed, 158 insertions, 155 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 995019063f64..8be4b29e38aa 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -665,3 +665,59 @@ void acpi_dev_pm_detach(struct device *dev, bool power_off)
665 } 665 }
666} 666}
667EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); 667EXPORT_SYMBOL_GPL(acpi_dev_pm_detach);
668
669/**
670 * acpi_dev_pm_add_dependent - Add physical device depending for PM.
671 * @handle: Handle of ACPI device node.
672 * @depdev: Device depending on that node for PM.
673 */
674void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev)
675{
676 struct acpi_device_physical_node *dep;
677 struct acpi_device *adev;
678
679 if (!depdev || acpi_bus_get_device(handle, &adev))
680 return;
681
682 mutex_lock(&adev->physical_node_lock);
683
684 list_for_each_entry(dep, &adev->power_dependent, node)
685 if (dep->dev == depdev)
686 goto out;
687
688 dep = kzalloc(sizeof(*dep), GFP_KERNEL);
689 if (dep) {
690 dep->dev = depdev;
691 list_add_tail(&dep->node, &adev->power_dependent);
692 }
693
694 out:
695 mutex_unlock(&adev->physical_node_lock);
696}
697EXPORT_SYMBOL_GPL(acpi_dev_pm_add_dependent);
698
699/**
700 * acpi_dev_pm_remove_dependent - Remove physical device depending for PM.
701 * @handle: Handle of ACPI device node.
702 * @depdev: Device depending on that node for PM.
703 */
704void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev)
705{
706 struct acpi_device_physical_node *dep;
707 struct acpi_device *adev;
708
709 if (!depdev || acpi_bus_get_device(handle, &adev))
710 return;
711
712 mutex_lock(&adev->physical_node_lock);
713
714 list_for_each_entry(dep, &adev->power_dependent, node)
715 if (dep->dev == depdev) {
716 list_del(&dep->node);
717 kfree(dep);
718 break;
719 }
720
721 mutex_unlock(&adev->physical_node_lock);
722}
723EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent);
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index e050254ae143..b79b4258bd6b 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -38,6 +38,7 @@ static inline void acpi_debugfs_init(void) { return; }
38 Power Resource 38 Power Resource
39 -------------------------------------------------------------------------- */ 39 -------------------------------------------------------------------------- */
40int acpi_power_init(void); 40int acpi_power_init(void);
41void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
41int acpi_device_sleep_wake(struct acpi_device *dev, 42int acpi_device_sleep_wake(struct acpi_device *dev,
42 int enable, int sleep_state, int dev_state); 43 int enable, int sleep_state, int dev_state);
43int acpi_power_get_inferred_state(struct acpi_device *device, int *state); 44int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 6e7b9d523812..659386c4f0cb 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -83,31 +83,20 @@ static struct acpi_driver acpi_power_driver = {
83 .drv.pm = &acpi_power_pm, 83 .drv.pm = &acpi_power_pm,
84}; 84};
85 85
86/* 86struct acpi_power_dependent_device {
87 * A power managed device 87 struct list_head node;
88 * A device may rely on multiple power resources. 88 struct acpi_device *adev;
89 * */ 89 struct work_struct work;
90struct acpi_power_managed_device {
91 struct device *dev; /* The physical device */
92 acpi_handle *handle;
93};
94
95struct acpi_power_resource_device {
96 struct acpi_power_managed_device *device;
97 struct acpi_power_resource_device *next;
98}; 90};
99 91
100struct acpi_power_resource { 92struct acpi_power_resource {
101 struct acpi_device * device; 93 struct acpi_device *device;
94 struct list_head dependent;
102 acpi_bus_id name; 95 acpi_bus_id name;
103 u32 system_level; 96 u32 system_level;
104 u32 order; 97 u32 order;
105 unsigned int ref_count; 98 unsigned int ref_count;
106 struct mutex resource_lock; 99 struct mutex resource_lock;
107
108 /* List of devices relying on this power resource */
109 struct acpi_power_resource_device *devices;
110 struct mutex devices_lock;
111}; 100};
112 101
113static struct list_head acpi_power_resource_list; 102static struct list_head acpi_power_resource_list;
@@ -207,21 +196,30 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
207 return 0; 196 return 0;
208} 197}
209 198
210/* Resume the device when all power resources in _PR0 are on */ 199static void acpi_power_resume_dependent(struct work_struct *work)
211static void acpi_power_on_device(struct acpi_power_managed_device *device)
212{ 200{
213 struct acpi_device *acpi_dev; 201 struct acpi_power_dependent_device *dep;
214 acpi_handle handle = device->handle; 202 struct acpi_device_physical_node *pn;
203 struct acpi_device *adev;
215 int state; 204 int state;
216 205
217 if (acpi_bus_get_device(handle, &acpi_dev)) 206 dep = container_of(work, struct acpi_power_dependent_device, work);
207 adev = dep->adev;
208 if (acpi_power_get_inferred_state(adev, &state))
218 return; 209 return;
219 210
220 if(acpi_power_get_inferred_state(acpi_dev, &state)) 211 if (state > ACPI_STATE_D0)
221 return; 212 return;
222 213
223 if (state == ACPI_STATE_D0 && pm_runtime_suspended(device->dev)) 214 mutex_lock(&adev->physical_node_lock);
224 pm_request_resume(device->dev); 215
216 list_for_each_entry(pn, &adev->physical_node_list, node)
217 pm_request_resume(pn->dev);
218
219 list_for_each_entry(pn, &adev->power_dependent, node)
220 pm_request_resume(pn->dev);
221
222 mutex_unlock(&adev->physical_node_lock);
225} 223}
226 224
227static int __acpi_power_on(struct acpi_power_resource *resource) 225static int __acpi_power_on(struct acpi_power_resource *resource)
@@ -244,9 +242,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
244static int acpi_power_on(acpi_handle handle) 242static int acpi_power_on(acpi_handle handle)
245{ 243{
246 int result = 0; 244 int result = 0;
247 bool resume_device = false;
248 struct acpi_power_resource *resource = NULL; 245 struct acpi_power_resource *resource = NULL;
249 struct acpi_power_resource_device *device_list;
250 246
251 result = acpi_power_get_context(handle, &resource); 247 result = acpi_power_get_context(handle, &resource);
252 if (result) 248 if (result)
@@ -260,26 +256,17 @@ static int acpi_power_on(acpi_handle handle)
260 resource->name)); 256 resource->name));
261 } else { 257 } else {
262 result = __acpi_power_on(resource); 258 result = __acpi_power_on(resource);
263 if (result) 259 if (result) {
264 resource->ref_count--; 260 resource->ref_count--;
265 else 261 } else {
266 resume_device = true; 262 struct acpi_power_dependent_device *dep;
267 }
268 263
269 mutex_unlock(&resource->resource_lock); 264 list_for_each_entry(dep, &resource->dependent, node)
270 265 schedule_work(&dep->work);
271 if (!resume_device) 266 }
272 return result;
273
274 mutex_lock(&resource->devices_lock);
275
276 device_list = resource->devices;
277 while (device_list) {
278 acpi_power_on_device(device_list->device);
279 device_list = device_list->next;
280 } 267 }
281 268
282 mutex_unlock(&resource->devices_lock); 269 mutex_unlock(&resource->resource_lock);
283 270
284 return result; 271 return result;
285} 272}
@@ -357,119 +344,81 @@ static int acpi_power_on_list(struct acpi_handle_list *list)
357 return result; 344 return result;
358} 345}
359 346
360static void __acpi_power_resource_unregister_device(struct device *dev, 347static void acpi_power_add_dependent(acpi_handle rhandle,
361 acpi_handle res_handle) 348 struct acpi_device *adev)
362{ 349{
363 struct acpi_power_resource *resource = NULL; 350 struct acpi_power_dependent_device *dep;
364 struct acpi_power_resource_device *prev, *curr; 351 struct acpi_power_resource *resource;
365 352
366 if (acpi_power_get_context(res_handle, &resource)) 353 if (!rhandle || !adev || acpi_power_get_context(rhandle, &resource))
367 return; 354 return;
368 355
369 mutex_lock(&resource->devices_lock); 356 mutex_lock(&resource->resource_lock);
370 prev = NULL;
371 curr = resource->devices;
372 while (curr) {
373 if (curr->device->dev == dev) {
374 if (!prev)
375 resource->devices = curr->next;
376 else
377 prev->next = curr->next;
378
379 kfree(curr);
380 break;
381 }
382
383 prev = curr;
384 curr = curr->next;
385 }
386 mutex_unlock(&resource->devices_lock);
387}
388
389/* Unlink dev from all power resources in _PR0 */
390void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle)
391{
392 struct acpi_device *acpi_dev;
393 struct acpi_handle_list *list;
394 int i;
395 357
396 if (!dev || !handle) 358 list_for_each_entry(dep, &resource->dependent, node)
397 return; 359 if (dep->adev == adev)
360 goto out;
398 361
399 if (acpi_bus_get_device(handle, &acpi_dev)) 362 dep = kzalloc(sizeof(*dep), GFP_KERNEL);
400 return; 363 if (!dep)
364 goto out;
401 365
402 list = &acpi_dev->power.states[ACPI_STATE_D0].resources; 366 dep->adev = adev;
367 INIT_WORK(&dep->work, acpi_power_resume_dependent);
368 list_add_tail(&dep->node, &resource->dependent);
403 369
404 for (i = 0; i < list->count; i++) 370 out:
405 __acpi_power_resource_unregister_device(dev, 371 mutex_unlock(&resource->resource_lock);
406 list->handles[i]);
407} 372}
408EXPORT_SYMBOL_GPL(acpi_power_resource_unregister_device);
409 373
410static int __acpi_power_resource_register_device( 374static void acpi_power_remove_dependent(acpi_handle rhandle,
411 struct acpi_power_managed_device *powered_device, acpi_handle handle) 375 struct acpi_device *adev)
412{ 376{
413 struct acpi_power_resource *resource = NULL; 377 struct acpi_power_dependent_device *dep;
414 struct acpi_power_resource_device *power_resource_device; 378 struct acpi_power_resource *resource;
415 int result; 379 struct work_struct *work = NULL;
416 380
417 result = acpi_power_get_context(handle, &resource); 381 if (!rhandle || !adev || acpi_power_get_context(rhandle, &resource))
418 if (result) 382 return;
419 return result;
420 383
421 power_resource_device = kzalloc( 384 mutex_lock(&resource->resource_lock);
422 sizeof(*power_resource_device), GFP_KERNEL);
423 if (!power_resource_device)
424 return -ENOMEM;
425 385
426 power_resource_device->device = powered_device; 386 list_for_each_entry(dep, &resource->dependent, node)
387 if (dep->adev == adev) {
388 list_del(&dep->node);
389 work = &dep->work;
390 break;
391 }
427 392
428 mutex_lock(&resource->devices_lock); 393 mutex_unlock(&resource->resource_lock);
429 power_resource_device->next = resource->devices;
430 resource->devices = power_resource_device;
431 mutex_unlock(&resource->devices_lock);
432 394
433 return 0; 395 if (work) {
396 cancel_work_sync(work);
397 kfree(dep);
398 }
434} 399}
435 400
436/* Link dev to all power resources in _PR0 */ 401void acpi_power_add_remove_device(struct acpi_device *adev, bool add)
437int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
438{ 402{
439 struct acpi_device *acpi_dev; 403 if (adev->power.flags.power_resources) {
440 struct acpi_handle_list *list; 404 struct acpi_device_power_state *ps;
441 struct acpi_power_managed_device *powered_device; 405 int j;
442 int i, ret;
443 406
444 if (!dev || !handle) 407 ps = &adev->power.states[ACPI_STATE_D0];
445 return -ENODEV; 408 for (j = 0; j < ps->resources.count; j++) {
446 409 acpi_handle rhandle = ps->resources.handles[j];
447 ret = acpi_bus_get_device(handle, &acpi_dev);
448 if (ret || !acpi_dev->power.flags.power_resources)
449 return -ENODEV;
450 410
451 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); 411 if (add)
452 if (!powered_device) 412 acpi_power_add_dependent(rhandle, adev);
453 return -ENOMEM; 413 else
454 414 acpi_power_remove_dependent(rhandle, adev);
455 powered_device->dev = dev;
456 powered_device->handle = handle;
457
458 list = &acpi_dev->power.states[ACPI_STATE_D0].resources;
459
460 for (i = 0; i < list->count; i++) {
461 ret = __acpi_power_resource_register_device(powered_device,
462 list->handles[i]);
463
464 if (ret) {
465 acpi_power_resource_unregister_device(dev, handle);
466 break;
467 } 415 }
468 } 416 }
469
470 return ret;
471} 417}
472EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); 418
419/* --------------------------------------------------------------------------
420 Device Power Management
421 -------------------------------------------------------------------------- */
473 422
474/** 423/**
475 * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in 424 * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in
@@ -623,10 +572,6 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
623 return err; 572 return err;
624} 573}
625 574
626/* --------------------------------------------------------------------------
627 Device Power Management
628 -------------------------------------------------------------------------- */
629
630int acpi_power_get_inferred_state(struct acpi_device *device, int *state) 575int acpi_power_get_inferred_state(struct acpi_device *device, int *state)
631{ 576{
632 int result = 0; 577 int result = 0;
@@ -725,7 +670,7 @@ static int acpi_power_add(struct acpi_device *device)
725 670
726 resource->device = device; 671 resource->device = device;
727 mutex_init(&resource->resource_lock); 672 mutex_init(&resource->resource_lock);
728 mutex_init(&resource->devices_lock); 673 INIT_LIST_HEAD(&resource->dependent);
729 strcpy(resource->name, device->pnp.bus_id); 674 strcpy(resource->name, device->pnp.bus_id);
730 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 675 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
731 strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 676 strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7d164a966b0d..c6d60910e8a8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -633,6 +633,7 @@ static int acpi_device_register(struct acpi_device *device)
633 INIT_LIST_HEAD(&device->wakeup_list); 633 INIT_LIST_HEAD(&device->wakeup_list);
634 INIT_LIST_HEAD(&device->physical_node_list); 634 INIT_LIST_HEAD(&device->physical_node_list);
635 mutex_init(&device->physical_node_lock); 635 mutex_init(&device->physical_node_lock);
636 INIT_LIST_HEAD(&device->power_dependent);
636 637
637 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); 638 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
638 if (!new_bus_id) { 639 if (!new_bus_id) {
@@ -706,8 +707,14 @@ static void acpi_device_unregister(struct acpi_device *device)
706 707
707 acpi_detach_data(device->handle, acpi_bus_data_handler); 708 acpi_detach_data(device->handle, acpi_bus_data_handler);
708 709
710 acpi_power_add_remove_device(device, false);
709 acpi_device_remove_files(device); 711 acpi_device_remove_files(device);
710 device_unregister(&device->dev); 712 device_unregister(&device->dev);
713 /*
714 * Drop the reference counts of all power resources the device depends
715 * on and turn off the ones that have no more references.
716 */
717 acpi_power_transition(device, ACPI_STATE_D3_COLD);
711} 718}
712 719
713/* -------------------------------------------------------------------------- 720/* --------------------------------------------------------------------------
@@ -1441,6 +1448,7 @@ static int acpi_add_single_object(struct acpi_device **child,
1441 1448
1442end: 1449end:
1443 if (!result) { 1450 if (!result) {
1451 acpi_power_add_remove_device(device, true);
1444 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 1452 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
1445 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1453 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1446 "Adding %s [%s] parent %s\n", dev_name(&device->dev), 1454 "Adding %s [%s] parent %s\n", dev_name(&device->dev),
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index ef01ac07502e..6fc67f7efb22 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -1029,30 +1029,20 @@ static void ata_acpi_register_power_resource(struct ata_device *dev)
1029{ 1029{
1030 struct scsi_device *sdev = dev->sdev; 1030 struct scsi_device *sdev = dev->sdev;
1031 acpi_handle handle; 1031 acpi_handle handle;
1032 struct device *device;
1033 1032
1034 handle = ata_dev_acpi_handle(dev); 1033 handle = ata_dev_acpi_handle(dev);
1035 if (!handle) 1034 if (handle)
1036 return; 1035 acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev);
1037
1038 device = &sdev->sdev_gendev;
1039
1040 acpi_power_resource_register_device(device, handle);
1041} 1036}
1042 1037
1043static void ata_acpi_unregister_power_resource(struct ata_device *dev) 1038static void ata_acpi_unregister_power_resource(struct ata_device *dev)
1044{ 1039{
1045 struct scsi_device *sdev = dev->sdev; 1040 struct scsi_device *sdev = dev->sdev;
1046 acpi_handle handle; 1041 acpi_handle handle;
1047 struct device *device;
1048 1042
1049 handle = ata_dev_acpi_handle(dev); 1043 handle = ata_dev_acpi_handle(dev);
1050 if (!handle) 1044 if (handle)
1051 return; 1045 acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev);
1052
1053 device = &sdev->sdev_gendev;
1054
1055 acpi_power_resource_unregister_device(device, handle);
1056} 1046}
1057 1047
1058void ata_acpi_bind(struct ata_device *dev) 1048void ata_acpi_bind(struct ata_device *dev)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 42736e213f25..e407c61559ca 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -345,7 +345,6 @@ static void pci_acpi_setup(struct device *dev)
345 acpi_pci_irq_add_prt(handle, pci_domain_nr(pci_dev->bus), bus); 345 acpi_pci_irq_add_prt(handle, pci_domain_nr(pci_dev->bus), bus);
346 } 346 }
347 347
348 acpi_power_resource_register_device(dev, handle);
349 if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid) 348 if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid)
350 return; 349 return;
351 350
@@ -368,7 +367,6 @@ static void pci_acpi_cleanup(struct device *dev)
368 device_set_run_wake(dev, false); 367 device_set_run_wake(dev, false);
369 pci_acpi_remove_pm_notifier(adev); 368 pci_acpi_remove_pm_notifier(adev);
370 } 369 }
371 acpi_power_resource_unregister_device(dev, handle);
372 370
373 if (pci_dev->subordinate) 371 if (pci_dev->subordinate)
374 acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus), 372 acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus),
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 567851b4f043..29a1badfca55 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -279,6 +279,7 @@ struct acpi_device {
279 struct list_head physical_node_list; 279 struct list_head physical_node_list;
280 struct mutex physical_node_lock; 280 struct mutex physical_node_lock;
281 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); 281 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
282 struct list_head power_dependent;
282}; 283};
283 284
284static inline void *acpi_driver_data(struct acpi_device *d) 285static inline void *acpi_driver_data(struct acpi_device *d)
@@ -334,8 +335,6 @@ int acpi_device_set_power(struct acpi_device *device, int state);
334int acpi_bus_update_power(acpi_handle handle, int *state_p); 335int acpi_bus_update_power(acpi_handle handle, int *state_p);
335bool acpi_bus_power_manageable(acpi_handle handle); 336bool acpi_bus_power_manageable(acpi_handle handle);
336bool acpi_bus_can_wakeup(acpi_handle handle); 337bool acpi_bus_can_wakeup(acpi_handle handle);
337int acpi_power_resource_register_device(struct device *dev, acpi_handle handle);
338void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle);
339#ifdef CONFIG_ACPI_PROC_EVENT 338#ifdef CONFIG_ACPI_PROC_EVENT
340int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 339int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
341int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); 340int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
@@ -414,6 +413,8 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
414int acpi_device_power_state(struct device *dev, struct acpi_device *adev, 413int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
415 u32 target_state, int d_max_in, int *d_min_p); 414 u32 target_state, int d_max_in, int *d_min_p);
416int acpi_pm_device_sleep_state(struct device *, int *, int); 415int acpi_pm_device_sleep_state(struct device *, int *, int);
416void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
417void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
417#else 418#else
418static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 419static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
419 acpi_notify_handler handler, 420 acpi_notify_handler handler,
@@ -443,6 +444,10 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
443{ 444{
444 return __acpi_device_power_state(m, p); 445 return __acpi_device_power_state(m, p);
445} 446}
447static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
448 struct device *depdev) {}
449static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
450 struct device *depdev) {}
446#endif 451#endif
447 452
448#ifdef CONFIG_PM_RUNTIME 453#ifdef CONFIG_PM_RUNTIME