aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/device_pm.c34
-rw-r--r--drivers/acpi/fan.c4
-rw-r--r--drivers/acpi/power.c2
-rw-r--r--drivers/acpi/scan.c4
-rw-r--r--drivers/ata/libata-acpi.c4
-rw-r--r--drivers/ide/ide-acpi.c5
-rw-r--r--drivers/pnp/pnpacpi/core.c6
-rw-r--r--include/acpi/acpi_bus.h3
8 files changed, 29 insertions, 33 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 4ab807dc8518..59d3202f6b36 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -159,26 +159,29 @@ int acpi_device_set_power(struct acpi_device *device, int state)
159 int result = 0; 159 int result = 0;
160 bool cut_power = false; 160 bool cut_power = false;
161 161
162 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) 162 if (!device || !device->flags.power_manageable
163 || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
163 return -EINVAL; 164 return -EINVAL;
164 165
165 /* Make sure this is a valid target state */ 166 /* Make sure this is a valid target state */
166 167
167 if (state == device->power.state) { 168 if (state == device->power.state) {
168 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", 169 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] already in %s\n",
170 device->pnp.bus_id,
169 acpi_power_state_string(state))); 171 acpi_power_state_string(state)));
170 return 0; 172 return 0;
171 } 173 }
172 174
173 if (!device->power.states[state].flags.valid) { 175 if (!device->power.states[state].flags.valid) {
174 printk(KERN_WARNING PREFIX "Device does not support %s\n", 176 dev_warn(&device->dev, "Power state %s not supported\n",
175 acpi_power_state_string(state)); 177 acpi_power_state_string(state));
176 return -ENODEV; 178 return -ENODEV;
177 } 179 }
178 if (device->parent && (state < device->parent->power.state)) { 180 if (device->parent && (state < device->parent->power.state)) {
179 printk(KERN_WARNING PREFIX 181 dev_warn(&device->dev,
180 "Cannot set device to a higher-powered" 182 "Cannot transition to power state %s for parent in %s\n",
181 " state than parent\n"); 183 acpi_power_state_string(state),
184 acpi_power_state_string(device->parent->power.state));
182 return -ENODEV; 185 return -ENODEV;
183 } 186 }
184 187
@@ -191,8 +194,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)
191 194
192 if (state < device->power.state && state != ACPI_STATE_D0 195 if (state < device->power.state && state != ACPI_STATE_D0
193 && device->power.state >= ACPI_STATE_D3_HOT) { 196 && device->power.state >= ACPI_STATE_D3_HOT) {
194 printk(KERN_WARNING PREFIX 197 dev_warn(&device->dev,
195 "Cannot transition to non-D0 state from D3\n"); 198 "Cannot transition to non-D0 state from D3\n");
196 return -ENODEV; 199 return -ENODEV;
197 } 200 }
198 201
@@ -219,10 +222,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)
219 222
220 end: 223 end:
221 if (result) { 224 if (result) {
222 printk(KERN_WARNING PREFIX 225 dev_warn(&device->dev, "Failed to change power state to %s\n",
223 "Device [%s] failed to transition to %s\n", 226 acpi_power_state_string(state));
224 device->pnp.bus_id,
225 acpi_power_state_string(state));
226 } else { 227 } else {
227 device->power.state = state; 228 device->power.state = state;
228 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 229 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -244,13 +245,6 @@ int acpi_bus_set_power(acpi_handle handle, int state)
244 if (result) 245 if (result)
245 return result; 246 return result;
246 247
247 if (!device->flags.power_manageable) {
248 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
249 "Device [%s] is not power manageable\n",
250 dev_name(&device->dev)));
251 return -ENODEV;
252 }
253
254 return acpi_device_set_power(device, state); 248 return acpi_device_set_power(device, state);
255} 249}
256EXPORT_SYMBOL(acpi_bus_set_power); 250EXPORT_SYMBOL(acpi_bus_set_power);
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 5b02a0aa540c..41ade6570bc0 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -93,7 +93,7 @@ static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
93 if (result) 93 if (result)
94 return result; 94 return result;
95 95
96 *state = (acpi_state == ACPI_STATE_D3 ? 0 : 96 *state = (acpi_state == ACPI_STATE_D3_COLD ? 0 :
97 (acpi_state == ACPI_STATE_D0 ? 1 : -1)); 97 (acpi_state == ACPI_STATE_D0 ? 1 : -1));
98 return 0; 98 return 0;
99} 99}
@@ -108,7 +108,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
108 return -EINVAL; 108 return -EINVAL;
109 109
110 result = acpi_bus_set_power(device->handle, 110 result = acpi_bus_set_power(device->handle,
111 state ? ACPI_STATE_D0 : ACPI_STATE_D3); 111 state ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD);
112 112
113 return result; 113 return result;
114} 114}
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 1460c88a7c0e..0dbe5cdf3396 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -784,7 +784,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state)
784 } 784 }
785 } 785 }
786 786
787 *state = ACPI_STATE_D3; 787 *state = ACPI_STATE_D3_COLD;
788 return 0; 788 return 0;
789} 789}
790 790
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d5993e339a26..a8a55d4143f2 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1409,8 +1409,8 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
1409 /* Set defaults for D0 and D3 states (always valid) */ 1409 /* Set defaults for D0 and D3 states (always valid) */
1410 device->power.states[ACPI_STATE_D0].flags.valid = 1; 1410 device->power.states[ACPI_STATE_D0].flags.valid = 1;
1411 device->power.states[ACPI_STATE_D0].power = 100; 1411 device->power.states[ACPI_STATE_D0].power = 100;
1412 device->power.states[ACPI_STATE_D3].flags.valid = 1; 1412 device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
1413 device->power.states[ACPI_STATE_D3].power = 0; 1413 device->power.states[ACPI_STATE_D3_COLD].power = 0;
1414 1414
1415 /* Set D3cold's explicit_set flag if _PS3 exists. */ 1415 /* Set D3cold's explicit_set flag if _PS3 exists. */
1416 if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set) 1416 if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set)
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index cf4e7020adac..da8170dfc90f 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -947,11 +947,11 @@ static void pata_acpi_set_state(struct ata_port *ap, pm_message_t state)
947 continue; 947 continue;
948 948
949 acpi_bus_set_power(dev_handle, state.event & PM_EVENT_RESUME ? 949 acpi_bus_set_power(dev_handle, state.event & PM_EVENT_RESUME ?
950 ACPI_STATE_D0 : ACPI_STATE_D3); 950 ACPI_STATE_D0 : ACPI_STATE_D3_COLD);
951 } 951 }
952 952
953 if (!(state.event & PM_EVENT_RESUME)) 953 if (!(state.event & PM_EVENT_RESUME))
954 acpi_bus_set_power(port_handle, ACPI_STATE_D3); 954 acpi_bus_set_power(port_handle, ACPI_STATE_D3_COLD);
955} 955}
956 956
957/** 957/**
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index f1a6796b165c..140c8ef50529 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -520,11 +520,12 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
520 ide_port_for_each_present_dev(i, drive, hwif) { 520 ide_port_for_each_present_dev(i, drive, hwif) {
521 if (drive->acpidata->obj_handle) 521 if (drive->acpidata->obj_handle)
522 acpi_bus_set_power(drive->acpidata->obj_handle, 522 acpi_bus_set_power(drive->acpidata->obj_handle,
523 on ? ACPI_STATE_D0 : ACPI_STATE_D3); 523 on ? ACPI_STATE_D0 : ACPI_STATE_D3_COLD);
524 } 524 }
525 525
526 if (!on) 526 if (!on)
527 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D3); 527 acpi_bus_set_power(hwif->acpidata->obj_handle,
528 ACPI_STATE_D3_COLD);
528} 529}
529 530
530/** 531/**
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 55cd459a3908..34049b0b4c73 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -131,7 +131,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
131 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ 131 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
132 ret = 0; 132 ret = 0;
133 if (acpi_bus_power_manageable(handle)) 133 if (acpi_bus_power_manageable(handle))
134 acpi_bus_set_power(handle, ACPI_STATE_D3); 134 acpi_bus_set_power(handle, ACPI_STATE_D3_COLD);
135 /* continue even if acpi_bus_set_power() fails */ 135 /* continue even if acpi_bus_set_power() fails */
136 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) 136 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL)))
137 ret = -ENODEV; 137 ret = -ENODEV;
@@ -174,10 +174,10 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
174 174
175 if (acpi_bus_power_manageable(handle)) { 175 if (acpi_bus_power_manageable(handle)) {
176 int power_state = acpi_pm_device_sleep_state(&dev->dev, NULL, 176 int power_state = acpi_pm_device_sleep_state(&dev->dev, NULL,
177 ACPI_STATE_D3); 177 ACPI_STATE_D3_COLD);
178 if (power_state < 0) 178 if (power_state < 0)
179 power_state = (state.event == PM_EVENT_ON) ? 179 power_state = (state.event == PM_EVENT_ON) ?
180 ACPI_STATE_D0 : ACPI_STATE_D3; 180 ACPI_STATE_D0 : ACPI_STATE_D3_COLD;
181 181
182 /* 182 /*
183 * acpi_bus_set_power() often fails (keyboard port can't be 183 * acpi_bus_set_power() often fails (keyboard port can't be
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 904379b5f2fb..5852c20760a3 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -486,7 +486,8 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
486 if (p) 486 if (p)
487 *p = ACPI_STATE_D0; 487 *p = ACPI_STATE_D0;
488 488
489 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; 489 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
490 m : ACPI_STATE_D0;
490} 491}
491static inline void acpi_dev_pm_add_dependent(acpi_handle handle, 492static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
492 struct device *depdev) {} 493 struct device *depdev) {}