git: d4b65f3f53ee - stable/14 - sound: Make DSP_FIXUP_ERROR() regular code
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Jul 2024 16:49:06 UTC
The branch stable/14 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=d4b65f3f53ee84a1f744bc74111911d61e86304d
commit d4b65f3f53ee84a1f744bc74111911d61e86304d
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-06 18:22:50 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-10 16:48:13 +0000
sound: Make DSP_FIXUP_ERROR() regular code
No reason to have this as a macro.
While here, change the second case to an "else if" as there is no reason
to check it if the open flags are invalid.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch, markj, emaste
Differential Revision: https://reviews.freebsd.org/D45776
(cherry picked from commit adc1713fb13f89a6eb33f5de840c981d0e17e4b7)
---
sys/dev/sound/pcm/dsp.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 26a2919ed1da..27c89c3231b7 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -287,15 +287,6 @@ skip:
priv = NULL;
}
-#define DSP_FIXUP_ERROR() do { \
- if (!DSP_F_VALID(flags)) \
- error = EINVAL; \
- if (!DSP_F_DUPLEX(flags) && \
- ((DSP_F_READ(flags) && d->reccount == 0) || \
- (DSP_F_WRITE(flags) && d->playcount == 0))) \
- error = ENOTSUP; \
-} while (0)
-
static int
dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
{
@@ -330,7 +321,12 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
PCM_WAIT(d);
error = 0;
- DSP_FIXUP_ERROR();
+ if (!DSP_F_VALID(flags))
+ error = EINVAL;
+ else if (!DSP_F_DUPLEX(flags) &&
+ ((DSP_F_READ(flags) && d->reccount == 0) ||
+ (DSP_F_WRITE(flags) && d->playcount == 0)))
+ error = ENOTSUP;
if (pcm_getflags(d->dev) & SD_F_SIMPLEX) {
if (DSP_F_DUPLEX(flags)) {
/*