diff mbox

[Intel-gfx] 3.19-rc1 errors when opening LID

Message ID 1818900.MY9q0yfluC@vostro.rjw.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Rafael J. Wysocki Dec. 27, 2014, 8:22 p.m. UTC
On Saturday, December 27, 2014 09:19:49 AM Pali Rohár wrote:
> Hello,
> 
> in attachment is output of ls -l /sys/bus/acpi/devices from both 
> 3.13 and 3.19 kernels.
>  
> Anyway Gabriele Mazzotta wrote me that new acpi devices could be 
> created after commit faae404ebdc6bba (ACPICA: Add "Windows 2013" 
> string to _OSI support).
> 
> Maybe this another output could help you:
> 
> $ cat /sys/bus/acpi/devices/INT33C5\:00/status
> 0
> $ cat /sys/bus/acpi/devices/INT33C5\:00/power_state
> (unknown)
> 
> Device INT33C5 is in that dmesg log:
> acpi INT33C5:00: Cannot transition to non-D0 state from D3

The appended patch should make these messages go away, please test.

> And status 0 in sysnode could indicate that acpi device is not 
> present right?

That's correct.

---
 drivers/acpi/device_pm.c |    7 ++++---
 include/acpi/acpi_bus.h  |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox

Patch

Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -589,7 +589,8 @@  static inline u32 acpi_target_system_sta
 
 static inline bool acpi_device_power_manageable(struct acpi_device *adev)
 {
-	return adev->flags.power_manageable;
+	return adev->flags.power_manageable
+		&& (adev->status.present || adev->status.functional);
 }
 
 static inline bool acpi_device_can_wakeup(struct acpi_device *adev)
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -68,7 +68,8 @@  int acpi_device_get_power(struct acpi_de
 {
 	int result = ACPI_STATE_UNKNOWN;
 
-	if (!device || !state)
+	if (!device || !state
+	    || !(device->status.present || device->status.functional))
 		return -EINVAL;
 
 	if (!device->flags.power_manageable) {
@@ -156,7 +157,7 @@  int acpi_device_set_power(struct acpi_de
 	int result = 0;
 	bool cut_power = false;
 
-	if (!device || !device->flags.power_manageable
+	if (!device || !acpi_device_power_manageable(device)
 	    || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
 		return -EINVAL;
 
@@ -361,7 +362,7 @@  bool acpi_bus_power_manageable(acpi_hand
 	int result;
 
 	result = acpi_bus_get_device(handle, &device);
-	return result ? false : device->flags.power_manageable;
+	return result ? false : acpi_device_power_manageable(device);
 }
 EXPORT_SYMBOL(acpi_bus_power_manageable);