Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/audio Add missing curlwp_bindx() corresponding to cu...
details: https://anonhg.NetBSD.org/src/rev/838b7ffb7021
branches: trunk
changeset: 959433:838b7ffb7021
user: isaki <isaki%NetBSD.org@localhost>
date: Sun Feb 14 03:41:13 2021 +0000
description:
Add missing curlwp_bindx() corresponding to curlwp_bind().
Pointed out by riastradh@.
diffstat:
sys/dev/audio/audio.c | 122 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 92 insertions(+), 30 deletions(-)
diffs (truncated from 415 to 300 lines):
diff -r d0cb92d075b1 -r 838b7ffb7021 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c Sun Feb 14 01:27:33 2021 +0000
+++ b/sys/dev/audio/audio.c Sun Feb 14 03:41:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.90 2021/02/09 12:36:34 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.91 2021/02/14 03:41:13 isaki Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.90 2021/02/09 12:36:34 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91 2021/02/14 03:41:13 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -1544,9 +1544,6 @@
{
int s;
- /* psref(9) forbids to migrate CPUs */
- curlwp_bind();
-
/* Block audiodetach while we acquire a reference */
s = pserialize_read_enter();
@@ -1574,9 +1571,6 @@
int s;
bool dying;
- /* psref(9) forbids to migrate CPUs */
- curlwp_bind();
-
/* Block audiodetach while we acquire a reference */
s = pserialize_read_enter();
@@ -1679,6 +1673,7 @@
{
struct audio_softc *sc;
struct psref sc_ref;
+ int bound;
int error;
/* Find the device */
@@ -1686,6 +1681,7 @@
if (sc == NULL || sc->hw_if == NULL)
return ENXIO;
+ bound = curlwp_bind();
audio_sc_acquire_foropen(sc, &sc_ref);
error = audio_exlock_enter(sc);
@@ -1712,6 +1708,7 @@
done:
audio_sc_release(sc, &sc_ref);
+ curlwp_bindx(bound);
return error;
}
@@ -1721,6 +1718,7 @@
struct audio_softc *sc;
struct psref sc_ref;
audio_file_t *file;
+ int bound;
int error;
dev_t dev;
@@ -1736,6 +1734,7 @@
* - free all memory objects, regardless of sc.
*/
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
if (sc) {
switch (AUDIODEV(dev)) {
@@ -1756,6 +1755,7 @@
audio_sc_release(sc, &sc_ref);
}
+ curlwp_bindx(bound);
/* Free memory objects anyway */
TRACEF(2, file, "free memory");
@@ -1776,6 +1776,7 @@
struct audio_softc *sc;
struct psref sc_ref;
audio_file_t *file;
+ int bound;
int error;
dev_t dev;
@@ -1783,9 +1784,12 @@
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
if (fp->f_flag & O_NONBLOCK)
ioflag |= IO_NDELAY;
@@ -1805,6 +1809,8 @@
}
audio_sc_release(sc, &sc_ref);
+done:
+ curlwp_bindx(bound);
return error;
}
@@ -1815,6 +1821,7 @@
struct audio_softc *sc;
struct psref sc_ref;
audio_file_t *file;
+ int bound;
int error;
dev_t dev;
@@ -1822,9 +1829,12 @@
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
if (fp->f_flag & O_NONBLOCK)
ioflag |= IO_NDELAY;
@@ -1844,6 +1854,8 @@
}
audio_sc_release(sc, &sc_ref);
+done:
+ curlwp_bindx(bound);
return error;
}
@@ -1854,6 +1866,7 @@
struct psref sc_ref;
audio_file_t *file;
struct lwp *l = curlwp;
+ int bound;
int error;
dev_t dev;
@@ -1861,9 +1874,12 @@
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
switch (AUDIODEV(dev)) {
case SOUND_DEVICE:
@@ -1887,6 +1903,8 @@
}
audio_sc_release(sc, &sc_ref);
+done:
+ curlwp_bindx(bound);
return error;
}
@@ -1896,14 +1914,20 @@
struct audio_softc *sc;
struct psref sc_ref;
audio_file_t *file;
+ int bound;
+ int error;
KASSERT(fp->f_audioctx);
file = fp->f_audioctx;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
-
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
+
+ error = 0;
memset(st, 0, sizeof(*st));
st->st_dev = file->dev;
@@ -1912,7 +1936,9 @@
st->st_mode = S_IFCHR;
audio_sc_release(sc, &sc_ref);
- return 0;
+done:
+ curlwp_bindx(bound);
+ return error;
}
static int
@@ -1922,6 +1948,7 @@
struct psref sc_ref;
audio_file_t *file;
struct lwp *l = curlwp;
+ int bound;
int revents;
dev_t dev;
@@ -1929,9 +1956,12 @@
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return POLLERR;
+ if (sc == NULL) {
+ revents = POLLERR;
+ goto done;
+ }
switch (AUDIODEV(dev)) {
case SOUND_DEVICE:
@@ -1948,6 +1978,8 @@
}
audio_sc_release(sc, &sc_ref);
+done:
+ curlwp_bindx(bound);
return revents;
}
@@ -1958,15 +1990,19 @@
struct psref sc_ref;
audio_file_t *file;
dev_t dev;
+ int bound;
int error;
KASSERT(fp->f_audioctx);
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
switch (AUDIODEV(dev)) {
case SOUND_DEVICE:
@@ -1983,6 +2019,8 @@
}
audio_sc_release(sc, &sc_ref);
+done:
+ curlwp_bindx(bound);
return error;
}
@@ -1994,15 +2032,19 @@
struct psref sc_ref;
audio_file_t *file;
dev_t dev;
+ int bound;
int error;
KASSERT(fp->f_audioctx);
file = fp->f_audioctx;
dev = file->dev;
+ bound = curlwp_bind();
sc = audio_sc_acquire_fromfile(file, &sc_ref);
- if (sc == NULL)
- return EIO;
+ if (sc == NULL) {
+ error = EIO;
+ goto done;
+ }
Home |
Main Index |
Thread Index |
Old Index