summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-06-13 23:09:22 +0000
committerriastradh <riastradh@NetBSD.org>2021-06-13 23:09:22 +0000
commit93d26f5d3526ced908bf64394209cb91386df1a3 (patch)
tree44dc22b14b06f27a1543025f03784a2c1277f72a /sys/dev
parent45c07264514db3101569df7e37d6b7c4b4603429 (diff)
pad(4): Take kernel lock around autoconf stuff.
This is not really enough -- the padconfig locking logic violates rules about sleeping while holding locks, might be deadlocky, and may also be racy. But, it'll serve to make progress.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pad/pad.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/pad/pad.c b/sys/dev/pad/pad.c
index 4f4426c98c2..7253da979ed 100644
--- a/sys/dev/pad/pad.c
+++ b/sys/dev/pad/pad.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $ */
+/* $NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -362,7 +362,9 @@ cdev_pad_open(dev_t dev, int flags, int fmt, struct lwp *l)
sc->sc_swvol = 255;
sc->sc_buflen = 0;
sc->sc_rpos = sc->sc_wpos = 0;
+ KERNEL_LOCK(1, NULL);
sc->sc_audiodev = audio_attach_mi(&pad_hw_if, sc, sc->sc_dev);
+ KERNEL_UNLOCK_ONE(NULL);
if (!pmf_device_register(sc->sc_dev, NULL, NULL))
aprint_error_dev(sc->sc_dev,