diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-16 10:49:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-16 10:49:54 -0400 |
commit | 4406c56d0a4da7a37b9180abeaece6cd00bcc874 (patch) | |
tree | 65a85fa73a25d24cbed6d163fdcf8df1b934a0be /drivers/acpi | |
parent | 6b7b352f2102e21f9d8f38e932f01d9c5705c073 (diff) | |
parent | 5e3573db2bd5db6925159279d99576a4635bdb66 (diff) |
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (75 commits)
PCI hotplug: clean up acpi_run_hpp()
PCI hotplug: acpiphp: use generic pci_configure_slot()
PCI hotplug: shpchp: use generic pci_configure_slot()
PCI hotplug: pciehp: use generic pci_configure_slot()
PCI hotplug: add pci_configure_slot()
PCI hotplug: clean up acpi_get_hp_params_from_firmware() interface
PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge
PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation
PCI: Clear saved_state after the state has been restored
PCI PM: Return error codes from pci_pm_resume()
PCI: use dev_printk in quirk messages
PCI / PCIe portdrv: Fix pcie_portdrv_slot_reset()
PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle
PCI Hotplug: acpiphp: find bridges the easy way
PCI: pcie portdrv: remove unused variable
PCI / ACPI PM: Propagate wake-up enable for devices w/o ACPI support
ACPI PM: Replace wakeup.prepared with reference counter
PCI PM: Introduce device flag wakeup_prepared
PCI / ACPI PM: Rework some debug messages
PCI PM: Simplify PCI wake-up code
...
Fixed up conflict in arch/powerpc/kernel/pci_64.c due to OF device tree
scanning having been moved and merged for the 32- and 64-bit cases. The
'needs_freset' initialization added in 6e19314cc ("PCI/powerpc: support
PCIe fundamental reset") is now in arch/powerpc/kernel/pci_of_scan.c.
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/pci_root.c | 17 | ||||
-rw-r--r-- | drivers/acpi/power.c | 58 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 1 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 12 | ||||
-rw-r--r-- | drivers/acpi/wakeup.c | 4 |
5 files changed, 49 insertions, 43 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 55b5b90c2a44..31b961c2f22f 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -61,20 +61,6 @@ static struct acpi_driver acpi_pci_root_driver = { | |||
61 | }, | 61 | }, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | struct acpi_pci_root { | ||
65 | struct list_head node; | ||
66 | struct acpi_device *device; | ||
67 | struct pci_bus *bus; | ||
68 | u16 segment; | ||
69 | u8 bus_nr; | ||
70 | |||
71 | u32 osc_support_set; /* _OSC state of support bits */ | ||
72 | u32 osc_control_set; /* _OSC state of control bits */ | ||
73 | u32 osc_control_qry; /* the latest _OSC query result */ | ||
74 | |||
75 | u32 osc_queried:1; /* has _OSC control been queried? */ | ||
76 | }; | ||
77 | |||
78 | static LIST_HEAD(acpi_pci_roots); | 64 | static LIST_HEAD(acpi_pci_roots); |
79 | 65 | ||
80 | static struct acpi_pci_driver *sub_driver; | 66 | static struct acpi_pci_driver *sub_driver; |
@@ -317,7 +303,7 @@ static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) | |||
317 | return status; | 303 | return status; |
318 | } | 304 | } |
319 | 305 | ||
320 | static struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) | 306 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) |
321 | { | 307 | { |
322 | struct acpi_pci_root *root; | 308 | struct acpi_pci_root *root; |
323 | 309 | ||
@@ -327,6 +313,7 @@ static struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) | |||
327 | } | 313 | } |
328 | return NULL; | 314 | return NULL; |
329 | } | 315 | } |
316 | EXPORT_SYMBOL_GPL(acpi_pci_find_root); | ||
330 | 317 | ||
331 | struct acpi_handle_node { | 318 | struct acpi_handle_node { |
332 | struct list_head node; | 319 | struct list_head node; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index d74365d4a6e7..5a09bf392ec1 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -44,6 +44,8 @@ | |||
44 | #include <acpi/acpi_bus.h> | 44 | #include <acpi/acpi_bus.h> |
45 | #include <acpi/acpi_drivers.h> | 45 | #include <acpi/acpi_drivers.h> |
46 | 46 | ||
47 | #include "sleep.h" | ||
48 | |||
47 | #define _COMPONENT ACPI_POWER_COMPONENT | 49 | #define _COMPONENT ACPI_POWER_COMPONENT |
48 | ACPI_MODULE_NAME("power"); | 50 | ACPI_MODULE_NAME("power"); |
49 | #define ACPI_POWER_CLASS "power_resource" | 51 | #define ACPI_POWER_CLASS "power_resource" |
@@ -361,17 +363,15 @@ int acpi_device_sleep_wake(struct acpi_device *dev, | |||
361 | */ | 363 | */ |
362 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | 364 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) |
363 | { | 365 | { |
364 | int i, err; | 366 | int i, err = 0; |
365 | 367 | ||
366 | if (!dev || !dev->wakeup.flags.valid) | 368 | if (!dev || !dev->wakeup.flags.valid) |
367 | return -EINVAL; | 369 | return -EINVAL; |
368 | 370 | ||
369 | /* | 371 | mutex_lock(&acpi_device_lock); |
370 | * Do not execute the code below twice in a row without calling | 372 | |
371 | * acpi_disable_wakeup_device_power() in between for the same device | 373 | if (dev->wakeup.prepare_count++) |
372 | */ | 374 | goto out; |
373 | if (dev->wakeup.flags.prepared) | ||
374 | return 0; | ||
375 | 375 | ||
376 | /* Open power resource */ | 376 | /* Open power resource */ |
377 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 377 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
@@ -379,7 +379,8 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | |||
379 | if (ret) { | 379 | if (ret) { |
380 | printk(KERN_ERR PREFIX "Transition power state\n"); | 380 | printk(KERN_ERR PREFIX "Transition power state\n"); |
381 | dev->wakeup.flags.valid = 0; | 381 | dev->wakeup.flags.valid = 0; |
382 | return -ENODEV; | 382 | err = -ENODEV; |
383 | goto err_out; | ||
383 | } | 384 | } |
384 | } | 385 | } |
385 | 386 | ||
@@ -388,9 +389,13 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | |||
388 | * in arbitrary power state afterwards. | 389 | * in arbitrary power state afterwards. |
389 | */ | 390 | */ |
390 | err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); | 391 | err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); |
391 | if (!err) | ||
392 | dev->wakeup.flags.prepared = 1; | ||
393 | 392 | ||
393 | err_out: | ||
394 | if (err) | ||
395 | dev->wakeup.prepare_count = 0; | ||
396 | |||
397 | out: | ||
398 | mutex_unlock(&acpi_device_lock); | ||
394 | return err; | 399 | return err; |
395 | } | 400 | } |
396 | 401 | ||
@@ -402,35 +407,42 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | |||
402 | */ | 407 | */ |
403 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) | 408 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) |
404 | { | 409 | { |
405 | int i, ret; | 410 | int i, err = 0; |
406 | 411 | ||
407 | if (!dev || !dev->wakeup.flags.valid) | 412 | if (!dev || !dev->wakeup.flags.valid) |
408 | return -EINVAL; | 413 | return -EINVAL; |
409 | 414 | ||
415 | mutex_lock(&acpi_device_lock); | ||
416 | |||
417 | if (--dev->wakeup.prepare_count > 0) | ||
418 | goto out; | ||
419 | |||
410 | /* | 420 | /* |
411 | * Do not execute the code below twice in a row without calling | 421 | * Executing the code below even if prepare_count is already zero when |
412 | * acpi_enable_wakeup_device_power() in between for the same device | 422 | * the function is called may be useful, for example for initialisation. |
413 | */ | 423 | */ |
414 | if (!dev->wakeup.flags.prepared) | 424 | if (dev->wakeup.prepare_count < 0) |
415 | return 0; | 425 | dev->wakeup.prepare_count = 0; |
416 | 426 | ||
417 | dev->wakeup.flags.prepared = 0; | 427 | err = acpi_device_sleep_wake(dev, 0, 0, 0); |
418 | 428 | if (err) | |
419 | ret = acpi_device_sleep_wake(dev, 0, 0, 0); | 429 | goto out; |
420 | if (ret) | ||
421 | return ret; | ||
422 | 430 | ||
423 | /* Close power resource */ | 431 | /* Close power resource */ |
424 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 432 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
425 | ret = acpi_power_off_device(dev->wakeup.resources.handles[i], dev); | 433 | int ret = acpi_power_off_device( |
434 | dev->wakeup.resources.handles[i], dev); | ||
426 | if (ret) { | 435 | if (ret) { |
427 | printk(KERN_ERR PREFIX "Transition power state\n"); | 436 | printk(KERN_ERR PREFIX "Transition power state\n"); |
428 | dev->wakeup.flags.valid = 0; | 437 | dev->wakeup.flags.valid = 0; |
429 | return -ENODEV; | 438 | err = -ENODEV; |
439 | goto out; | ||
430 | } | 440 | } |
431 | } | 441 | } |
432 | 442 | ||
433 | return ret; | 443 | out: |
444 | mutex_unlock(&acpi_device_lock); | ||
445 | return err; | ||
434 | } | 446 | } |
435 | 447 | ||
436 | /* -------------------------------------------------------------------------- | 448 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 781435d7e369..318b1ea7a5bf 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -781,6 +781,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
781 | kfree(buffer.pointer); | 781 | kfree(buffer.pointer); |
782 | 782 | ||
783 | device->wakeup.flags.valid = 1; | 783 | device->wakeup.flags.valid = 1; |
784 | device->wakeup.prepare_count = 0; | ||
784 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | 785 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping |
785 | * system for the ACPI device with the _PRW object. | 786 | * system for the ACPI device with the _PRW object. |
786 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | 787 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 42159a28f433..feece693d773 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -689,19 +689,25 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
689 | { | 689 | { |
690 | acpi_handle handle; | 690 | acpi_handle handle; |
691 | struct acpi_device *adev; | 691 | struct acpi_device *adev; |
692 | int error; | ||
692 | 693 | ||
693 | if (!device_may_wakeup(dev)) | 694 | if (!device_can_wakeup(dev)) |
694 | return -EINVAL; | 695 | return -EINVAL; |
695 | 696 | ||
696 | handle = DEVICE_ACPI_HANDLE(dev); | 697 | handle = DEVICE_ACPI_HANDLE(dev); |
697 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | 698 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { |
698 | printk(KERN_DEBUG "ACPI handle has no context!\n"); | 699 | dev_dbg(dev, "ACPI handle has no context in %s!\n", __func__); |
699 | return -ENODEV; | 700 | return -ENODEV; |
700 | } | 701 | } |
701 | 702 | ||
702 | return enable ? | 703 | error = enable ? |
703 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : | 704 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : |
704 | acpi_disable_wakeup_device_power(adev); | 705 | acpi_disable_wakeup_device_power(adev); |
706 | if (!error) | ||
707 | dev_info(dev, "wake-up capability %s by ACPI\n", | ||
708 | enable ? "enabled" : "disabled"); | ||
709 | |||
710 | return error; | ||
705 | } | 711 | } |
706 | #endif | 712 | #endif |
707 | 713 | ||
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 88725dcdf8bc..e0ee0c036f5a 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -68,7 +68,7 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
68 | /* If users want to disable run-wake GPE, | 68 | /* If users want to disable run-wake GPE, |
69 | * we only disable it for wake and leave it for runtime | 69 | * we only disable it for wake and leave it for runtime |
70 | */ | 70 | */ |
71 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) | 71 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) |
72 | || sleep_state > (u32) dev->wakeup.sleep_state) { | 72 | || sleep_state > (u32) dev->wakeup.sleep_state) { |
73 | if (dev->wakeup.flags.run_wake) { | 73 | if (dev->wakeup.flags.run_wake) { |
74 | /* set_gpe_type will disable GPE, leave it like that */ | 74 | /* set_gpe_type will disable GPE, leave it like that */ |
@@ -100,7 +100,7 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
100 | if (!dev->wakeup.flags.valid) | 100 | if (!dev->wakeup.flags.valid) |
101 | continue; | 101 | continue; |
102 | 102 | ||
103 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) | 103 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) |
104 | || sleep_state > (u32) dev->wakeup.sleep_state) { | 104 | || sleep_state > (u32) dev->wakeup.sleep_state) { |
105 | if (dev->wakeup.flags.run_wake) { | 105 | if (dev->wakeup.flags.run_wake) { |
106 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 106 | acpi_set_gpe_type(dev->wakeup.gpe_device, |