Module Name:    src
Committed By:   jruoho
Date:           Mon May 31 20:10:56 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_power.c

Log Message:
Silently return if a power state transition is requested for a device that
has no support for it. For example, in Kurt Schreiner's Shuttle G61:

        Device (FAN)
        {
            Name (_HID, EisaId ("PNP0C0B"))
            Method (_INI, 0, NotSerialized)
            {
                Store (TP1H, CTOS)
                Store (TP1L, CTHY)
            }
        }

Obviously acpitz(4) has little use for a device that only contains _INI.
(The handle of this device is referenced incorrectly in _AL0.)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpi_power.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_power.c
diff -u src/sys/dev/acpi/acpi_power.c:1.12 src/sys/dev/acpi/acpi_power.c:1.13
--- src/sys/dev/acpi/acpi_power.c:1.12	Wed May 12 15:59:52 2010
+++ src/sys/dev/acpi/acpi_power.c	Mon May 31 20:10:56 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.12 2010/05/12 15:59:52 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.13 2010/05/31 20:10:56 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.12 2010/05/12 15:59:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.13 2010/05/31 20:10:56 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -378,13 +378,13 @@
 
 	KASSERT(ad != NULL && ad->ad_root != NULL);
 
-	if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3) {
-		rv = AE_BAD_PARAMETER;
-		goto fail;
+	if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
+		ad->ad_state = ACPI_STATE_ERROR;
+		return false;
 	}
 
-	if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
-		rv = AE_SUPPORT;
+	if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3) {
+		rv = AE_BAD_PARAMETER;
 		goto fail;
 	}
 

Reply via email to