summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorjruoho <jruoho@NetBSD.org>2010-08-13 18:44:24 +0000
committerjruoho <jruoho@NetBSD.org>2010-08-13 18:44:24 +0000
commit3d52b10fd5cda3c30e2f3edce5eb76f3ffb79e81 (patch)
tree6a443b787339ee40979715d3a713eabf72cb4bfd /sys/dev/acpi
parent9b987001abc66288bd8d1400f0cf63923ae0cc01 (diff)
Remove some unnecessary locking. Mainly a leftover from previous revisions
where the dynamic maximum/minimum was used also when retrieving the current state. The state-array itself changes only in C-states.
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/acpi_cpu_pstate.c13
-rw-r--r--sys/dev/acpi/acpi_cpu_tstate.c11
2 files changed, 6 insertions, 18 deletions
diff --git a/sys/dev/acpi/acpi_cpu_pstate.c b/sys/dev/acpi/acpi_cpu_pstate.c
index 8f303d6bf8c..6e375a016bf 100644
--- a/sys/dev/acpi/acpi_cpu_pstate.c
+++ b/sys/dev/acpi/acpi_cpu_pstate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.15 2010/08/13 16:21:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.16 2010/08/13 18:44:24 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.15 2010/08/13 16:21:50 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.16 2010/08/13 18:44:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/evcnt.h>
@@ -241,11 +241,9 @@ acpicpu_pstate_callback(void *aux)
sc = device_private(self);
mutex_enter(&sc->sc_mtx);
-
old = sc->sc_pstate_max;
acpicpu_pstate_change(sc);
new = sc->sc_pstate_max;
-
mutex_exit(&sc->sc_mtx);
if (old != new) {
@@ -595,8 +593,6 @@ acpicpu_pstate_get(struct acpicpu_softc *sc, uint32_t *freq)
goto fail;
}
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_pstate_count; i++) {
if (sc->sc_pstate[i].ps_freq == 0)
@@ -608,8 +604,6 @@ acpicpu_pstate_get(struct acpicpu_softc *sc, uint32_t *freq)
}
}
- mutex_exit(&sc->sc_mtx);
-
if (__predict_false(ps == NULL)) {
rv = EIO;
goto fail;
@@ -727,9 +721,8 @@ acpicpu_pstate_set(struct acpicpu_softc *sc, uint32_t freq)
goto fail;
}
- ps->ps_evcnt.ev_count++;
-
mutex_enter(&sc->sc_mtx);
+ ps->ps_evcnt.ev_count++;
sc->sc_pstate_current = freq;
mutex_exit(&sc->sc_mtx);
diff --git a/sys/dev/acpi/acpi_cpu_tstate.c b/sys/dev/acpi/acpi_cpu_tstate.c
index b2cf95a2529..4b501f5e9f1 100644
--- a/sys/dev/acpi/acpi_cpu_tstate.c
+++ b/sys/dev/acpi/acpi_cpu_tstate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_tstate.c,v 1.1 2010/08/13 16:21:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_tstate.c,v 1.2 2010/08/13 18:44:24 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.1 2010/08/13 16:21:50 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.2 2010/08/13 18:44:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -655,8 +655,6 @@ acpicpu_tstate_get(struct acpicpu_softc *sc, uint32_t *percent)
val = (val >> offset) & 0x0F;
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_tstate_count; i++) {
if (sc->sc_tstate[i].ts_percent == 0)
@@ -677,8 +675,6 @@ acpicpu_tstate_get(struct acpicpu_softc *sc, uint32_t *percent)
}
}
- mutex_exit(&sc->sc_mtx);
-
if (__predict_false(ts == NULL)) {
rv = EIO;
goto fail;
@@ -816,9 +812,8 @@ acpicpu_tstate_set(struct acpicpu_softc *sc, uint32_t percent)
goto fail;
}
- ts->ts_evcnt.ev_count++;
-
mutex_enter(&sc->sc_mtx);
+ ts->ts_evcnt.ev_count++;
sc->sc_tstate_current = percent;
mutex_exit(&sc->sc_mtx);