diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-07-06 21:32:02 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-07-07 19:25:10 -0400 |
commit | 961d9120fa6f078492a1c762dd91f2c097e56c83 (patch) | |
tree | e11955d14d0f777ad5a76b44034f6b3c5281a0bf /drivers/pci/pci-acpi.c | |
parent | 3737b2b1046900660b42e25c904b85e78139d25b (diff) |
PCI: Introduce platform_pci_power_manageable function
Introduce function pointer platform_pci_power_manageable to be used
by the platform-related code to point to a function allowing us to
check if given device is power manageable by the platform.
Introduce acpi_pci_power_manageable() playing that role for ACPI.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 056ea80ee27a..e4df71ab79b3 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -215,7 +215,6 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | |||
215 | } | 215 | } |
216 | EXPORT_SYMBOL(pci_osc_control_set); | 216 | EXPORT_SYMBOL(pci_osc_control_set); |
217 | 217 | ||
218 | #ifdef CONFIG_ACPI_SLEEP | ||
219 | /* | 218 | /* |
220 | * _SxD returns the D-state with the highest power | 219 | * _SxD returns the D-state with the highest power |
221 | * (lowest D-state number) supported in the S-state "x". | 220 | * (lowest D-state number) supported in the S-state "x". |
@@ -259,7 +258,13 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
259 | } | 258 | } |
260 | return PCI_POWER_ERROR; | 259 | return PCI_POWER_ERROR; |
261 | } | 260 | } |
262 | #endif | 261 | |
262 | static bool acpi_pci_power_manageable(struct pci_dev *dev) | ||
263 | { | ||
264 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | ||
265 | |||
266 | return handle ? acpi_bus_power_manageable(handle) : false; | ||
267 | } | ||
263 | 268 | ||
264 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 269 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
265 | { | 270 | { |
@@ -290,6 +295,11 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
290 | return -EINVAL; | 295 | return -EINVAL; |
291 | } | 296 | } |
292 | 297 | ||
298 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { | ||
299 | .is_manageable = acpi_pci_power_manageable, | ||
300 | .set_state = acpi_pci_set_power_state, | ||
301 | .choose_state = acpi_pci_choose_state, | ||
302 | }; | ||
293 | 303 | ||
294 | /* ACPI bus type */ | 304 | /* ACPI bus type */ |
295 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 305 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
@@ -341,10 +351,7 @@ static int __init acpi_pci_init(void) | |||
341 | ret = register_acpi_bus_type(&acpi_pci_bus); | 351 | ret = register_acpi_bus_type(&acpi_pci_bus); |
342 | if (ret) | 352 | if (ret) |
343 | return 0; | 353 | return 0; |
344 | #ifdef CONFIG_ACPI_SLEEP | 354 | pci_set_platform_pm(&acpi_pci_platform_pm); |
345 | platform_pci_choose_state = acpi_pci_choose_state; | ||
346 | #endif | ||
347 | platform_pci_set_power_state = acpi_pci_set_power_state; | ||
348 | return 0; | 355 | return 0; |
349 | } | 356 | } |
350 | arch_initcall(acpi_pci_init); | 357 | arch_initcall(acpi_pci_init); |