Use a mutex(9) rather than a rwlock(9), it's cheaper.
This commit is contained in:
parent
6673d94694
commit
112f996fbc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: aiboost.c,v 1.13 2007/08/30 18:29:11 xtraeme Exp $ */
|
||||
/* $NetBSD: aiboost.c,v 1.14 2007/10/13 00:56:16 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Juan Romero Pardines
|
||||
|
@ -28,13 +28,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.13 2007/08/30 18:29:11 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aiboost.c,v 1.14 2007/10/13 00:56:16 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/rwlock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
#include <dev/acpi/acpica.h>
|
||||
#include <dev/acpi/acpireg.h>
|
||||
|
@ -67,7 +67,7 @@ struct aiboost_softc {
|
|||
struct aiboost_comp *sc_aitemp, *sc_aivolt, *sc_aifan;
|
||||
struct sysmon_envsys sc_sme;
|
||||
struct envsys_data sc_data[AIBOOST_MAX_SENSORS];
|
||||
krwlock_t sc_rwlock;
|
||||
kmutex_t sc_mtx;
|
||||
};
|
||||
|
||||
static ACPI_STATUS aiboost_getcomp(ACPI_HANDLE *,
|
||||
|
@ -134,7 +134,7 @@ aiboost_acpi_attach(struct device *parent, struct device *self, void *aux)
|
|||
if (ACPI_FAILURE(aiboost_getcomp(handl, "FSIF", &sc->sc_aifan)))
|
||||
return;
|
||||
|
||||
rw_init(&sc->sc_rwlock);
|
||||
mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE);
|
||||
/* Initialize sensors */
|
||||
maxsens = sc->sc_aivolt->num + sc->sc_aitemp->num + sc->sc_aifan->num;
|
||||
DPRINTF(("%s: maxsens=%d\n", __func__, maxsens));
|
||||
|
@ -208,7 +208,7 @@ aiboost_refresh_sensors(struct aiboost_softc *sc, envsys_data_t *edata)
|
|||
ACPI_HANDLE *h = sc->sc_node->ad_handle;
|
||||
int i, j, val;
|
||||
|
||||
rw_enter(&sc->sc_rwlock, RW_READER);
|
||||
mutex_enter(&sc->sc_mtx);
|
||||
j = 0;
|
||||
i = edata->sensor; /* sensor number */
|
||||
|
||||
|
@ -253,7 +253,7 @@ aiboost_refresh_sensors(struct aiboost_softc *sc, envsys_data_t *edata)
|
|||
|
||||
edata->state = ENVSYS_SVALID;
|
||||
out:
|
||||
rw_exit(&sc->sc_rwlock);
|
||||
mutex_exit(&sc->sc_mtx);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue