Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Check the cached value also when setting a state.



details:   https://anonhg.NetBSD.org/src/rev/f14f65cf98b5
branches:  trunk
changeset: 757218:f14f65cf98b5
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Aug 20 04:16:00 2010 +0000

description:
Check the cached value also when setting a state.

diffstat:

 sys/dev/acpi/acpi_cpu_pstate.c |  9 +++++++--
 sys/dev/acpi/acpi_cpu_tstate.c |  9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (60 lines):

diff -r cf82eabd59f3 -r f14f65cf98b5 sys/dev/acpi/acpi_cpu_pstate.c
--- a/sys/dev/acpi/acpi_cpu_pstate.c    Thu Aug 19 21:40:45 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_pstate.c    Fri Aug 20 04:16:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.30 2010/08/18 18:32:20 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.31 2010/08/20 04:16:00 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.30 2010/08/18 18:32:20 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.31 2010/08/20 04:16:00 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/evcnt.h>
@@ -978,6 +978,11 @@
 
        mutex_enter(&sc->sc_mtx);
 
+       if (sc->sc_pstate_current == freq) {
+               mutex_exit(&sc->sc_mtx);
+               return 0;
+       }
+
        for (i = sc->sc_pstate_max; i <= sc->sc_pstate_min; i++) {
 
                if (sc->sc_pstate[i].ps_freq == 0)
diff -r cf82eabd59f3 -r f14f65cf98b5 sys/dev/acpi/acpi_cpu_tstate.c
--- a/sys/dev/acpi/acpi_cpu_tstate.c    Thu Aug 19 21:40:45 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_tstate.c    Fri Aug 20 04:16:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_tstate.c,v 1.14 2010/08/17 10:57:30 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_tstate.c,v 1.15 2010/08/20 04:16:00 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.14 2010/08/17 10:57:30 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.15 2010/08/20 04:16:00 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/evcnt.h>
@@ -750,6 +750,11 @@
 
        mutex_enter(&sc->sc_mtx);
 
+       if (sc->sc_tstate_current == percent) {
+               mutex_exit(&sc->sc_mtx);
+               return 0;
+       }
+
        for (i = sc->sc_tstate_max; i <= sc->sc_tstate_min; i++) {
 
                if (sc->sc_tstate[i].ts_percent == 0)



Home | Main Index | Thread Index | Old Index