Module Name: src Committed By: ozaki-r Date: Sat Nov 22 15:00:05 UTC 2014
Modified Files: src/sys/dev/sysmon: sysmon_envsys_events.c sysmonvar.h Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/dev/sysmon/sysmon_envsys_events.c cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sysmon/sysmonvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/sysmon/sysmon_envsys_events.c diff -u src/sys/dev/sysmon/sysmon_envsys_events.c:1.110 src/sys/dev/sysmon/sysmon_envsys_events.c:1.111 --- src/sys/dev/sysmon/sysmon_envsys_events.c:1.110 Sun Sep 15 14:40:56 2013 +++ src/sys/dev/sysmon/sysmon_envsys_events.c Sat Nov 22 15:00:05 2014 @@ -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 *sm 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 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); } /* Index: src/sys/dev/sysmon/sysmonvar.h diff -u src/sys/dev/sysmon/sysmonvar.h:1.44 src/sys/dev/sysmon/sysmonvar.h:1.45 --- src/sys/dev/sysmon/sysmonvar.h:1.44 Tue Dec 11 15:39:06 2012 +++ src/sys/dev/sysmon/sysmonvar.h Sat Nov 22 15:00:05 2014 @@ -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; };