summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-12-25 12:59:54 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-12-25 12:59:54 +0000
commit0ddae2e43bde351e699797b713fdfd0c4d71688b (patch)
tree5c305222f703a8c48618339303894fe5bf0e271e /sys/dev/usb
parentd5d6ba970dd241df83e52a3f686a5b3c47e2b215 (diff)
Refactor klist insertion and removal
Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/ugen.c6
-rw-r--r--sys/dev/usb/uhid.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 5b8bdc30393..6a27d3f6410 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ugen.c,v 1.108 2020/09/29 09:11:44 mpi Exp $ */
+/* $OpenBSD: ugen.c,v 1.109 2020/12/25 12:59:52 visa Exp $ */
/* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */
/* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -1304,7 +1304,7 @@ filt_ugenrdetach(struct knote *kn)
int s;
s = splusb();
- klist_remove(&sce->rsel.si_note, kn);
+ klist_remove_locked(&sce->rsel.si_note, kn);
splx(s);
}
@@ -1413,7 +1413,7 @@ ugenkqfilter(dev_t dev, struct knote *kn)
kn->kn_hook = (void *)sce;
s = splusb();
- klist_insert(klist, kn);
+ klist_insert_locked(klist, kn);
splx(s);
return (0);
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index d8e5f8f7ddc..f43eaa13a13 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhid.c,v 1.80 2020/05/13 08:13:42 mpi Exp $ */
+/* $OpenBSD: uhid.c,v 1.81 2020/12/25 12:59:52 visa Exp $ */
/* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -447,7 +447,7 @@ filt_uhidrdetach(struct knote *kn)
int s;
s = splusb();
- klist_remove(&sc->sc_rsel.si_note, kn);
+ klist_remove_locked(&sc->sc_rsel.si_note, kn);
splx(s);
}
@@ -496,7 +496,7 @@ uhidkqfilter(dev_t dev, struct knote *kn)
kn->kn_hook = (void *)sc;
s = splusb();
- klist_insert(klist, kn);
+ klist_insert_locked(klist, kn);
splx(s);
return (0);