Module Name:    src
Committed By:   jruoho
Date:           Wed Aug 11 16:22:19 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_cpu.c acpi_cpu_pstate.c

Log Message:
Check the 'sc->sc_cold' flag also in P-state code, and set this flag once
we start the detachment routine.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpi_cpu_pstate.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_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.13 src/sys/dev/acpi/acpi_cpu.c:1.14
--- src/sys/dev/acpi/acpi_cpu.c:1.13	Sun Aug  8 18:47:54 2010
+++ src/sys/dev/acpi/acpi_cpu.c	Wed Aug 11 16:22:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.13 2010/08/08 18:47:54 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.14 2010/08/11 16:22:18 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruoho...@iki.fi>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.13 2010/08/08 18:47:54 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.14 2010/08/11 16:22:18 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -176,6 +176,7 @@
 	static ONCE_DECL(once_detach);
 	int rv = 0;
 
+	sc->sc_cold = true;
 	acpi_deregister_notify(sc->sc_node);
 
 	if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
@@ -500,14 +501,14 @@
 {
 	struct acpicpu_softc *sc = device_private(self);
 
-	sc->sc_cold = false;
-
 	if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
 		(void)acpicpu_cstate_resume(self);
 
 	if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
 		(void)acpicpu_pstate_resume(self);
 
+	sc->sc_cold = false;
+
 	return true;
 }
 

Index: src/sys/dev/acpi/acpi_cpu_pstate.c
diff -u src/sys/dev/acpi/acpi_cpu_pstate.c:1.10 src/sys/dev/acpi/acpi_cpu_pstate.c:1.11
--- src/sys/dev/acpi/acpi_cpu_pstate.c:1.10	Wed Aug 11 13:02:59 2010
+++ src/sys/dev/acpi/acpi_cpu_pstate.c	Wed Aug 11 16:22:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.10 2010/08/11 13:02:59 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.11 2010/08/11 16:22:18 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruoho...@iki.fi>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.10 2010/08/11 13:02:59 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.11 2010/08/11 16:22:18 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/evcnt.h>
@@ -537,6 +537,11 @@
 	uint8_t width;
 	int rv;
 
+	if (sc->sc_cold != false) {
+		rv = EBUSY;
+		goto fail;
+	}
+
 	if ((sc->sc_flags & ACPICPU_FLAG_P) == 0) {
 		rv = ENODEV;
 		goto fail;
@@ -621,6 +626,11 @@
 	uint8_t width;
 	int rv;
 
+	if (sc->sc_cold != false) {
+		rv = EBUSY;
+		goto fail;
+	}
+
 	if ((sc->sc_flags & ACPICPU_FLAG_P) == 0) {
 		rv = ENODEV;
 		goto fail;

Reply via email to