From nobody Sat Jul 06 18:24:13 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WGf0s59hkz5PMZh; Sat, 06 Jul 2024 18:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WGf0s3pcbz54Fj; Sat, 6 Jul 2024 18:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720290253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JVg5AnNs2EWTO3y1Hi4EZwFUVVTbAxFznd0/1FpZD5g=; b=dzhq56lNwyVQoXnUSm0+wbzt80MW408ptARhSxUJsIs3t9Vkq+bIXru0BM9HYdg1d03dqw 9m1DRU4gJImpBjA6d1WhoU+NIeTJ93nazhLK7lrMKIYc9MAE+EJMAj5SYkID2vH6NZeuoN QaWkkS/9hkjZXZMNOCxXSl2aZmiG5wGMgg01EWKnUaUZDGiUzoz8mpI3R7nc2tqOWDkONg rYPaplNAfeR/1Z71rjhwAyx9QzUMbM+EJiP0Vr1BPFEBTe5i5OcNEkzZHzXwZBSRGyd/iz E+TLKr1TZ31wR3bHOb5/XPXKNtHo1FDQWC8qXnUr9JSKI4ohFf0qXr36UmS60w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720290253; a=rsa-sha256; cv=none; b=rZEQbAC0CF5zbF2AeBWEI745uw1Lk+Xk9Ae/B44Wts85z/DsWel4uVrmmmTLPVHlR3dp5V kJE5Czg4JQrGzmsDU+T9A9AXnClsAXf9cLSW8XPTQlFZdZoJe684K1n0PdVixKRcbwYsBs iDuXBezrro/knGdin0341Dj1kz7EyylJWYRGmKyWyp0TChETDp7AQmBFEHWawOGQjUDz+3 GeD1cpIVv/4iCHcxtiE0SOP+9vG4bCrJN/EASdISYtNnAKGA9xvRVRGo8MMblfIqMZI42Y Tk+qf8eFMqGQj/09Z90/a55C3fRYaqCJXXiAVnifo6QpaQiO7z38dbHuNwh6ew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720290253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JVg5AnNs2EWTO3y1Hi4EZwFUVVTbAxFznd0/1FpZD5g=; b=ZfxTJ9aTQO12BG+6EbIdOTF0GeBir2jkBZsNzPKWpRRsNyeimi2X46JSSJv0xTOueL3cv5 FJMTip8ERBi9mVnjDr7JDh4o/QG/jCk8hymp91kcHgeYSYyl0zP28qEr597viDL+6dyK6p 5+Kh1yygdfP48Ru7yUZQXMkTxJsLJ/wHYkBUBSJiWZTiejE/TyFbc+9f9pxXsVLlIGAg8H BqrgjRYxfYl3fNVhBz+Tl76jcdao0g48ok7ni4nAtU20wz5pWyYipUyVANhGBvnTzJ4xTJ xQh0xwtqusvp0i07HeI2WjslNpSjSh7qghJ9ErGZ9VMWSmHaoT5CeSfpxkH3QQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WGf0s2hYpzqwB; Sat, 6 Jul 2024 18:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 466IODvI090840; Sat, 6 Jul 2024 18:24:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 466IODAx090837; Sat, 6 Jul 2024 18:24:13 GMT (envelope-from git) Date: Sat, 6 Jul 2024 18:24:13 GMT Message-Id: <202407061824.466IODAx090837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: adc1713fb13f - main - sound: Make DSP_FIXUP_ERROR() regular code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adc1713fb13f89a6eb33f5de840c981d0e17e4b7 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=adc1713fb13f89a6eb33f5de840c981d0e17e4b7 commit adc1713fb13f89a6eb33f5de840c981d0e17e4b7 Author: Christos Margiolis AuthorDate: 2024-07-06 18:22:50 +0000 Commit: Christos Margiolis CommitDate: 2024-07-06 18:22:50 +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 --- 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)) { /*