diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 2834846a185d..9a3a682c6981 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -83,7 +83,6 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
83 | acpi_handle handle = dev->data; | 83 | acpi_handle handle = dev->data; |
84 | struct acpi_buffer buffer; | 84 | struct acpi_buffer buffer; |
85 | int ret; | 85 | int ret; |
86 | acpi_status status; | ||
87 | 86 | ||
88 | pnp_dbg(&dev->dev, "set resources\n"); | 87 | pnp_dbg(&dev->dev, "set resources\n"); |
89 | ret = pnpacpi_build_resource_template(dev, &buffer); | 88 | ret = pnpacpi_build_resource_template(dev, &buffer); |
@@ -94,21 +93,31 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
94 | kfree(buffer.pointer); | 93 | kfree(buffer.pointer); |
95 | return ret; | 94 | return ret; |
96 | } | 95 | } |
97 | status = acpi_set_current_resources(handle, &buffer); | 96 | if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer))) |
98 | if (ACPI_FAILURE(status)) | ||
99 | ret = -EINVAL; | 97 | ret = -EINVAL; |
98 | else if (acpi_bus_power_manageable(handle)) | ||
99 | ret = acpi_bus_set_power(handle, ACPI_STATE_D0); | ||
100 | kfree(buffer.pointer); | 100 | kfree(buffer.pointer); |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | static int pnpacpi_disable_resources(struct pnp_dev *dev) | 104 | static int pnpacpi_disable_resources(struct pnp_dev *dev) |
105 | { | 105 | { |
106 | acpi_status status; | 106 | acpi_handle handle = dev->data; |
107 | int ret; | ||
108 | |||
109 | dev_dbg(&dev->dev, "disable resources\n"); | ||
107 | 110 | ||
108 | /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ | 111 | /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ |
109 | status = acpi_evaluate_object((acpi_handle) dev->data, | 112 | ret = 0; |
110 | "_DIS", NULL, NULL); | 113 | if (acpi_bus_power_manageable(handle)) { |
111 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 114 | ret = acpi_bus_set_power(handle, ACPI_STATE_D3); |
115 | if (ret) | ||
116 | return ret; | ||
117 | } | ||
118 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) | ||
119 | ret = -ENODEV; | ||
120 | return ret; | ||
112 | } | 121 | } |
113 | 122 | ||
114 | #ifdef CONFIG_ACPI_SLEEP | 123 | #ifdef CONFIG_ACPI_SLEEP |