Kill sme_callout_mtx and use sme_mtx instead

We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.

Discussed with riastradh@ in http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
This commit is contained in:
ozaki-r 2014-11-22 15:00:05 +00:00
parent 9405b4121e
commit 881a9e1b06
2 changed files with 5 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysmon_envsys_events.c,v 1.110 2013/09/15 14:40:56 martin Exp $ */
/* $NetBSD: sysmon_envsys_events.c,v 1.111 2014/11/22 15:00:05 ozaki-r Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.110 2013/09/15 14:40:56 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.111 2014/11/22 15:00:05 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -566,7 +566,6 @@ sme_events_init(struct sysmon_envsys *sme)
if (error)
return error;
mutex_init(&sme->sme_callout_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK);
callout_init(&sme->sme_callout, CALLOUT_MPSAFE);
callout_setfunc(&sme->sme_callout, sme_events_check, sme);
sme->sme_flags |= SME_CALLOUT_INITIALIZED;
@ -614,7 +613,6 @@ sme_events_destroy(struct sysmon_envsys *sme)
callout_stop(&sme->sme_callout);
workqueue_destroy(sme->sme_wq);
mutex_destroy(&sme->sme_callout_mtx);
callout_destroy(&sme->sme_callout);
sme->sme_flags &= ~SME_CALLOUT_INITIALIZED;
DPRINTF(("%s: events framework destroyed for '%s'\n",
@ -708,14 +706,14 @@ sme_events_check(void *arg)
KASSERT(sme != NULL);
mutex_enter(&sme->sme_callout_mtx);
mutex_enter(&sme->sme_mtx);
LIST_FOREACH(see, &sme->sme_events_list, see_list) {
workqueue_enqueue(sme->sme_wq, &see->see_wk, NULL);
see->see_edata->flags |= ENVSYS_FNEED_REFRESH;
}
if (!sysmon_low_power)
sme_schedule_callout(sme);
mutex_exit(&sme->sme_callout_mtx);
mutex_exit(&sme->sme_mtx);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysmonvar.h,v 1.44 2012/12/11 15:39:06 pgoyette Exp $ */
/* $NetBSD: sysmonvar.h,v 1.45 2014/11/22 15:00:05 ozaki-r Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@ -208,7 +208,6 @@ struct sysmon_envsys {
* Locking/synchronization.
*/
kmutex_t sme_mtx;
kmutex_t sme_callout_mtx;
kcondvar_t sme_condvar;
};