Module Name: src
Committed By: nia
Date: Tue May 26 10:07:29 UTC 2020
Modified Files:
src/sys/dev/audio: audio.c
Log Message:
audio: Fix logic for resuming when the device is in use.
audio_[r/p]mixer_start should never be called when the device is
marked busy.
Resolves a panic on resume when audio is playing, PR kern/55301
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.70 src/sys/dev/audio/audio.c:1.71
--- src/sys/dev/audio/audio.c:1.70 Sat May 23 23:42:42 2020
+++ src/sys/dev/audio/audio.c Tue May 26 10:07:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.70 2020/05/23 23:42:42 ad Exp $ */
+/* $NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.70 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -7755,11 +7755,9 @@ audio_suspend(device_t dv, const pmf_qua
/* Halts mixers but don't clear busy flag for resume */
if (sc->sc_pbusy) {
audio_pmixer_halt(sc);
- sc->sc_pbusy = true;
}
if (sc->sc_rbusy) {
audio_rmixer_halt(sc);
- sc->sc_rbusy = true;
}
#ifdef AUDIO_PM_IDLE
@@ -7786,9 +7784,9 @@ audio_resume(device_t dv, const pmf_qual
AUDIO_INITINFO(&ai);
audio_hw_setinfo(sc, &ai, NULL);
- if (sc->sc_pbusy)
+ if (!sc->sc_pbusy)
audio_pmixer_start(sc, true);
- if (sc->sc_rbusy)
+ if (!sc->sc_rbusy)
audio_rmixer_start(sc);
audio_exlock_mutex_exit(sc);