Add a few KASSERT(mutex_owned(&foo_lock)) as suggested by Andrew Doran.
This commit is contained in:
parent
3301f9a5e5
commit
d67fa603fc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysmon_envsys.c,v 1.49 2007/08/30 23:44:32 xtraeme Exp $ */
|
||||
/* $NetBSD: sysmon_envsys.c,v 1.50 2007/08/31 00:35:08 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.49 2007/08/30 23:44:32 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.50 2007/08/31 00:35:08 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -703,6 +703,7 @@ sme_register_sensorname(struct sysmon_envsys *sme, envsys_data_t *edata)
|
|||
struct sme_sensor_names *snames, *snames2 = NULL;
|
||||
|
||||
KASSERT(edata != NULL);
|
||||
KASSERT(mutex_owned(&sme_list_mtx));
|
||||
|
||||
SLIST_FOREACH(snames2, &sme->sme_names_list, sme_names) {
|
||||
/*
|
||||
|
@ -748,6 +749,8 @@ sme_add_sensor_dictionary(struct sysmon_envsys *sme, prop_array_t array,
|
|||
|
||||
i = j = 0;
|
||||
|
||||
KASSERT(mutex_owned(&sme_list_mtx));
|
||||
|
||||
/* find the correct unit for this sensor. */
|
||||
for (i = 0; est[i].type != -1; i++)
|
||||
if (est[i].type == edata->units)
|
||||
|
@ -961,6 +964,8 @@ sme_update_dictionary(struct sysmon_envsys *sme)
|
|||
prop_object_t array, dict;
|
||||
int i, j, error, invalid;
|
||||
|
||||
KASSERT(mutex_owned(&sme_list_mtx));
|
||||
|
||||
error = invalid = 0;
|
||||
array = dict = NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysmon_envsys_events.c,v 1.21 2007/08/30 23:44:32 xtraeme Exp $ */
|
||||
/* $NetBSD: sysmon_envsys_events.c,v 1.22 2007/08/31 00:35:08 xtraeme Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.21 2007/08/30 23:44:32 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.22 2007/08/31 00:35:08 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -343,12 +343,12 @@ do { \
|
|||
"error=%d sensor=%s event=%s\n", \
|
||||
__func__, error, sed_t->edata->desc, (c)); \
|
||||
else { \
|
||||
mutex_enter(&sme_list_mtx); \
|
||||
(void)strlcat(str, (c), sizeof(str)); \
|
||||
mutex_enter(&sme_event_mtx); \
|
||||
prop_dictionary_set_bool(sed_t->sdict, \
|
||||
str, \
|
||||
true); \
|
||||
mutex_exit(&sme_list_mtx); \
|
||||
mutex_exit(&sme_event_mtx); \
|
||||
} \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
@ -479,6 +479,8 @@ sme_events_init(void)
|
|||
{
|
||||
int error;
|
||||
|
||||
KASSERT(mutex_owned(&sme_event_init_mtx));
|
||||
|
||||
error = workqueue_create(&seewq, "envsysev",
|
||||
sme_events_worker, NULL, 0, IPL_SOFTCLOCK, WQ_MPSAFE);
|
||||
if (error)
|
||||
|
@ -504,6 +506,8 @@ out:
|
|||
void
|
||||
sme_events_destroy(void)
|
||||
{
|
||||
KASSERT(mutex_owned(&sme_event_init_mtx));
|
||||
|
||||
callout_stop(&seeco);
|
||||
sme_events_initialized = false;
|
||||
DPRINTF(("%s: events framework destroyed\n", __func__));
|
||||
|
|
Loading…
Reference in New Issue