Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c ims(4): Sprinkle KERNEL_LOCKED_P assertions.



details:   https://anonhg.NetBSD.org/src/rev/318f31f2888a
branches:  trunk
changeset: 359625:318f31f2888a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jan 14 22:28:42 2022 +0000

description:
ims(4): Sprinkle KERNEL_LOCKED_P assertions.

Access to the softc and hidms state is currently kernel-locked.

diffstat:

 sys/dev/i2c/ims.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r 3051380aa520 -r 318f31f2888a sys/dev/i2c/ims.c
--- a/sys/dev/i2c/ims.c Fri Jan 14 22:28:23 2022 +0000
+++ b/sys/dev/i2c/ims.c Fri Jan 14 22:28:42 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ims.c,v 1.3 2019/07/09 12:56:30 ryoon Exp $ */
+/* $NetBSD: ims.c,v 1.4 2022/01/14 22:28:42 riastradh Exp $ */
 /* $OpenBSD ims.c,v 1.1 2016/01/12 01:11:15 jcs Exp $ */
 
 /*
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ims.c,v 1.3 2019/07/09 12:56:30 ryoon Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ims.c,v 1.4 2022/01/14 22:28:42 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,11 +158,13 @@
        return rv;
 }
 
-void 
+void
 ims_childdet(device_t self, device_t child)
 {
        struct ims_softc *sc = device_private(self);
 
+       KASSERT(KERNEL_LOCKED_P());
+
        KASSERT(sc->sc_ms.hidms_wsmousedev == child);
        sc->sc_ms.hidms_wsmousedev = NULL;
 }
@@ -184,6 +186,8 @@
        struct ims_softc *sc = v;
        int error;
 
+       KASSERT(KERNEL_LOCKED_P());
+
        if (sc->sc_enabled)
                return EBUSY;
 
@@ -201,6 +205,8 @@
 {
        struct ims_softc *sc = v;
 
+       KASSERT(KERNEL_LOCKED_P());
+
 #ifdef DIAGNOSTIC
        if (!sc->sc_enabled) {
                printf("ums_disable: not enabled\n");



Home | Main Index | Thread Index | Old Index