Skip to content

Commit 59068e3

Browse files
committed
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Pull an ACPI patch from Len Brown: "It fixes a D3 issue new in 3.4-rc1." By Lin Ming via Len Brown: * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: ACPI: Fix D3hot v D3cold confusion
2 parents 377485f + 1cc0c99 commit 59068e3

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

drivers/acpi/power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state)
631631
* We know a device's inferred power state when all the resources
632632
* required for a given D-state are 'on'.
633633
*/
634-
for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) {
634+
for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) {
635635
list = &device->power.states[i].resources;
636636
if (list->count < 1)
637637
continue;

drivers/acpi/scan.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
869869
/*
870870
* Enumerate supported power management states
871871
*/
872-
for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) {
872+
for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) {
873873
struct acpi_device_power_state *ps = &device->power.states[i];
874874
char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' };
875875

@@ -884,21 +884,18 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
884884
acpi_bus_add_power_resource(ps->resources.handles[j]);
885885
}
886886

887-
/* The exist of _PR3 indicates D3Cold support */
888-
if (i == ACPI_STATE_D3) {
889-
status = acpi_get_handle(device->handle, object_name, &handle);
890-
if (ACPI_SUCCESS(status))
891-
device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
892-
}
893-
894887
/* Evaluate "_PSx" to see if we can do explicit sets */
895888
object_name[2] = 'S';
896889
status = acpi_get_handle(device->handle, object_name, &handle);
897890
if (ACPI_SUCCESS(status))
898891
ps->flags.explicit_set = 1;
899892

900-
/* State is valid if we have some power control */
901-
if (ps->resources.count || ps->flags.explicit_set)
893+
/*
894+
* State is valid if there are means to put the device into it.
895+
* D3hot is only valid if _PR3 present.
896+
*/
897+
if (ps->resources.count ||
898+
(ps->flags.explicit_set && i < ACPI_STATE_D3_HOT))
902899
ps->flags.valid = 1;
903900

904901
ps->power = -1; /* Unknown - driver assigned */

drivers/pci/pci-acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev)
200200
return PCI_D1;
201201
case ACPI_STATE_D2:
202202
return PCI_D2;
203-
case ACPI_STATE_D3:
203+
case ACPI_STATE_D3_HOT:
204204
return PCI_D3hot;
205205
case ACPI_STATE_D3_COLD:
206206
return PCI_D3cold;
@@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
223223
[PCI_D0] = ACPI_STATE_D0,
224224
[PCI_D1] = ACPI_STATE_D1,
225225
[PCI_D2] = ACPI_STATE_D2,
226-
[PCI_D3hot] = ACPI_STATE_D3,
226+
[PCI_D3hot] = ACPI_STATE_D3_HOT,
227227
[PCI_D3cold] = ACPI_STATE_D3
228228
};
229229
int error = -EINVAL;

include/acpi/actypes.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,10 @@ typedef u64 acpi_integer;
499499
#define ACPI_STATE_D0 (u8) 0
500500
#define ACPI_STATE_D1 (u8) 1
501501
#define ACPI_STATE_D2 (u8) 2
502-
#define ACPI_STATE_D3 (u8) 3
503-
#define ACPI_STATE_D3_COLD (u8) 4
504-
#define ACPI_D_STATES_MAX ACPI_STATE_D3_COLD
502+
#define ACPI_STATE_D3_HOT (u8) 3
503+
#define ACPI_STATE_D3 (u8) 4
504+
#define ACPI_STATE_D3_COLD ACPI_STATE_D3
505+
#define ACPI_D_STATES_MAX ACPI_STATE_D3
505506
#define ACPI_D_STATE_COUNT 5
506507

507508
#define ACPI_STATE_C0 (u8) 0

0 commit comments

Comments
 (0)