Module Name: src
Committed By: nat
Date: Sat Jul 1 23:27:17 UTC 2017
Modified Files:
src/sys/dev: spkr.c
Log Message:
On a forcefull detach wait for spkr to close as the detach has to
succeed.
Ok christos@.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/spkr.c
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/spkr.c
diff -u src/sys/dev/spkr.c:1.13 src/sys/dev/spkr.c:1.14
--- src/sys/dev/spkr.c:1.13 Wed Jun 14 06:55:37 2017
+++ src/sys/dev/spkr.c Sat Jul 1 23:27:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.13 2017/06/14 06:55:37 nat Exp $ */
+/* $NetBSD: spkr.c,v 1.14 2017/07/01 23:27:17 nat Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond ([email protected])
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.13 2017/06/14 06:55:37 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.14 2017/07/01 23:27:17 nat Exp $");
#if defined(_KERNEL_OPT)
#include "wsmux.h"
@@ -388,6 +388,10 @@ spkr_detach(device_t self, int flags)
#endif /* SPKRDEBUG */
if (sc == NULL)
return ENXIO;
+
+ /* XXXNS If speaker never closes, we cannot complete the detach. */
+ while ((flags & DETACH_FORCE) != 0 && sc->sc_inbuf != NULL)
+ kpause("spkrwait", TRUE, 1, NULL);
if (sc->sc_inbuf != NULL)
return EBUSY;