diff options
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r-- | sys/dev/audio.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index d1847f1ef42..f06eead7760 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.207 2024/06/07 08:48:10 jsg Exp $ */ +/* $OpenBSD: audio.c,v 1.208 2024/08/20 07:44:36 mvs Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org> * @@ -27,11 +27,17 @@ #include <sys/malloc.h> #include <sys/device.h> #include <sys/audioio.h> +#include <sys/atomic.h> #include <dev/audio_if.h> #include <dev/mulaw.h> #include "audio.h" #include "wskbd.h" +/* + * Locks used to protect data: + * a atomic + */ + #ifdef AUDIO_DEBUG #define DPRINTF(...) \ do { \ @@ -225,7 +231,7 @@ struct mutex audio_lock = MUTEX_INITIALIZER(IPL_AUDIO); * Global flag to control if audio recording is enabled when the * mixerctl setting is record.enable=sysctl */ -int audio_record_enable = 0; +int audio_record_enable = 0; /* [a] */ #ifdef AUDIO_DEBUG /* @@ -590,7 +596,7 @@ audio_rintr(void *addr) sc->rec.pos += sc->rec.blksz; if ((sc->record_enable == MIXER_RECORD_ENABLE_SYSCTL && - !audio_record_enable) || + atomic_load_int(&audio_record_enable) == 0) || sc->record_enable == MIXER_RECORD_ENABLE_OFF) { ptr = audio_buf_wgetblk(&sc->rec, &count); audio_fill_sil(sc, ptr, sc->rec.blksz); |