From nobody Fri Nov 29 12:28:24 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 4Y0CBw74Rgz5f5yL; Fri, 29 Nov 2024 12:28:24 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0CBw4vKpz47h0; Fri, 29 Nov 2024 12:28:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732883304; 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=JZ31DOZ7nPEqXnYFLBZPIFOawOzAqnrvG7cXa5ztBys=; b=RRUYtWS2Caa8KNm3dC7YaMACqfyAaFm7vhy77d/DX32ooIdxnX1GinEbMRdwJubuR+SykT eAVsKjuKBkx/EoFes4/UVSaQUGMZkDmGCT54Tb1OqO9twjlM9wDEpWriyKz2zgEEKJp+If HF6jNjtwF0yb66bCO2CYDwLmzN9pgH9zziuQ8kMVT6dFFWlO1/A5wes8XkseCyedd799yT qOu8yyy05s0MKIsvZH7rsc4niqHZ0RJr8gpLTzhbEce+X6gown+UMUFThzZWgm7yy26rbl +MAk8Ul1GFtT959X6FIJNxzfFzx69jG9kZiRfbItf91lSmfCMbb/g1QgqTTYqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732883304; 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=JZ31DOZ7nPEqXnYFLBZPIFOawOzAqnrvG7cXa5ztBys=; b=pG8j/NKfw3w8Nus9EsEKpUZqOHTAIBV7S7RzWWZSAQmYC1He/1m0zOjk6eR8t53xRBFXAJ kLxsMVxOJmcKsI5M0O3O7YR/dmcxgghCldy+T16a1/nFBYk1TaWZueb3KJOJUsLIh0b6r9 Sf/X7F4wj26qPGstMArxcF/KoUZgTiA4OuDmnsR6w01i6abe+CTTtQB24RXxaXvlrmhAwy 0f1UWusO75HrGrT+CWUg3769bnXLos3FXzR+EyK5jBtymDksrPWcE3lmaUal8QM4Y15iim a7iHkR1y7rCLmL0fIuFc43j+vbgiu4p4ZPkj5qFQHIMrmtPbdcT0Z19WhqUlgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732883304; a=rsa-sha256; cv=none; b=ZHAedkHT/SP1fy/kV6ZmA266uO/YjXZdDnzDsO3HShXbcotPIeRRfEIXmWOyfLx9B1anUr 6w7FuEbprIk1khvUWmYpYvTnAuL72yL/21EMJLr3a5TDEL6DQmiId+oCuwyuQ603e1+h5n 2YWcT8khnw3nhXDk0oO4vF1p+yZc5xpOQoWiAAeHkv45TrEetu7wvFcy+J2v/2ctps+7ZM vu4vky+amd7FQqDYDJNkInk7spA0mtcJjrY3TbFnv2zxqxcuQDn2TvxKDGSFX5PW2VzeMu 6oOiz8xfi9UWwocSWoGbhbtcCUePftmcVxAqn7OHRLCH4FBMtJWNlQzIHOVTbA== 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 4Y0CBw3xg3zNmJ; Fri, 29 Nov 2024 12:28:24 +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 4ATCSO46070380; Fri, 29 Nov 2024 12:28:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ATCSOJm070377; Fri, 29 Nov 2024 12:28:24 GMT (envelope-from git) Date: Fri, 29 Nov 2024 12:28:24 GMT Message-Id: <202411291228.4ATCSOJm070377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 3397443e50d2 - stable/14 - sound: Remove PCM_DETACHING(), SD_F_DETACHING and SD_F_DYING 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3397443e50d2a34c953cb3d13fe2c2fb50e4ea7c Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3397443e50d2a34c953cb3d13fe2c2fb50e4ea7c commit 3397443e50d2a34c953cb3d13fe2c2fb50e4ea7c Author: Christos Margiolis AuthorDate: 2024-11-26 14:48:30 +0000 Commit: Christos Margiolis CommitDate: 2024-11-29 12:28:06 +0000 sound: Remove PCM_DETACHING(), SD_F_DETACHING and SD_F_DYING Since SD_F_REGISTERED is cleared at the same time SD_F_DETACHING and SD_F_DYING are set, and since PCM_DETACHING() is always used in conjuction with PCM_REGISTERED()/DSP_REGISTERED(), it is enough to just check SD_F_REGISTERED. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D47463 (cherry picked from commit 6d4c59e26189a8c19fd0832e89f9b089330cbfcb) --- sys/dev/sound/pcm/dsp.c | 12 ++++++------ sys/dev/sound/pcm/mixer.c | 10 +++++----- sys/dev/sound/pcm/sound.c | 2 -- sys/dev/sound/pcm/sound.h | 48 ++++++++++++++++++++--------------------------- 4 files changed, 31 insertions(+), 41 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0f19f064a227..ccf240681a25 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -177,7 +177,7 @@ dsp_close(void *data) d = priv->sc; /* At this point pcm_unregister() will destroy all channels anyway. */ - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) + if (!DSP_REGISTERED(d)) goto skip; PCM_GIANT_ENTER(d); @@ -264,7 +264,7 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) return (ENODEV); d = i_dev->si_drv1; - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) + if (!DSP_REGISTERED(d)) return (EBADF); priv = malloc(sizeof(*priv), M_DEVBUF, M_WAITOK | M_ZERO); @@ -445,7 +445,7 @@ dsp_io_ops(struct dsp_cdevpriv *priv, struct uio *buf) ("%s(): io train wreck!", __func__)); d = priv->sc; - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) + if (!DSP_REGISTERED(d)) return (EBADF); PCM_GIANT_ENTER(d); @@ -664,7 +664,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, return (err); d = priv->sc; - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) + if (!DSP_REGISTERED(d)) return (EBADF); PCM_GIANT_ENTER(d); @@ -1783,7 +1783,7 @@ dsp_poll(struct cdev *i_dev, int events, struct thread *td) if ((err = devfs_get_cdevpriv((void **)&priv)) != 0) return (err); d = priv->sc; - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) { + if (!DSP_REGISTERED(d)) { /* XXX many clients don't understand POLLNVAL */ return (events & (POLLHUP | POLLPRI | POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM)); @@ -1865,7 +1865,7 @@ dsp_mmap_single(struct cdev *i_dev, vm_ooffset_t *offset, if ((err = devfs_get_cdevpriv((void **)&priv)) != 0) return (err); d = priv->sc; - if (!DSP_REGISTERED(d) || PCM_DETACHING(d)) + if (!DSP_REGISTERED(d)) return (EINVAL); PCM_GIANT_ENTER(d); diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 6d74fa975f03..b5b5814e667b 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -146,7 +146,7 @@ mixer_set_softpcmvol(struct snd_mixer *m, struct snddev_info *d, struct pcm_channel *c; int dropmtx, acquiremtx; - if (!PCM_REGISTERED(d) || PCM_DETACHING(d)) + if (!PCM_REGISTERED(d)) return (EINVAL); if (mtx_owned(m->lock)) @@ -199,7 +199,7 @@ mixer_set_eq(struct snd_mixer *m, struct snddev_info *d, else return (EINVAL); - if (!PCM_REGISTERED(d) || PCM_DETACHING(d)) + if (!PCM_REGISTERED(d)) return (EINVAL); if (mtx_owned(m->lock)) @@ -1053,7 +1053,7 @@ mixer_open(struct cdev *i_dev, int flags, int mode, struct thread *td) m = i_dev->si_drv1; d = device_get_softc(m->dev); - if (!PCM_REGISTERED(d) || PCM_DETACHING(d)) + if (!PCM_REGISTERED(d)) return (EBADF); /* XXX Need Giant magic entry ??? */ @@ -1209,7 +1209,7 @@ mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, return (EBADF); d = device_get_softc(((struct snd_mixer *)i_dev->si_drv1)->dev); - if (!PCM_REGISTERED(d) || PCM_DETACHING(d)) + if (!PCM_REGISTERED(d)) return (EBADF); PCM_GIANT_ENTER(d); @@ -1447,7 +1447,7 @@ mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi) for (i = 0; pcm_devclass != NULL && i < devclass_get_maxunit(pcm_devclass); i++) { d = devclass_get_softc(pcm_devclass, i); - if (!PCM_REGISTERED(d) || PCM_DETACHING(d)) { + if (!PCM_REGISTERED(d)) { if ((mi->dev == -1 && i == snd_unit) || mi->dev == i) { mixer_oss_mixerinfo_unavail(mi, i); return (0); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index ebd2e2d697f8..44ba4805462d 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -535,8 +535,6 @@ pcm_unregister(device_t dev) PCM_LOCK(d); PCM_WAIT(d); - d->flags |= SD_F_DETACHING; - d->flags |= SD_F_DYING; d->flags &= ~SD_F_REGISTERED; PCM_ACQUIRE(d); diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index c5013e76034a..467adad2ddff 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -104,17 +104,15 @@ struct snd_mixer; #define SD_F_SIMPLEX 0x00000001 #define SD_F_AUTOVCHAN 0x00000002 #define SD_F_SOFTPCMVOL 0x00000004 -#define SD_F_DYING 0x00000008 -#define SD_F_DETACHING 0x00000010 -#define SD_F_BUSY 0x00000020 -#define SD_F_MPSAFE 0x00000040 -#define SD_F_REGISTERED 0x00000080 -#define SD_F_BITPERFECT 0x00000100 -#define SD_F_VPC 0x00000200 /* volume-per-channel */ -#define SD_F_EQ 0x00000400 /* EQ */ -#define SD_F_EQ_ENABLED 0x00000800 /* EQ enabled */ -#define SD_F_EQ_BYPASSED 0x00001000 /* EQ bypassed */ -#define SD_F_EQ_PC 0x00002000 /* EQ per-channel */ +#define SD_F_BUSY 0x00000008 +#define SD_F_MPSAFE 0x00000010 +#define SD_F_REGISTERED 0x00000020 +#define SD_F_BITPERFECT 0x00000040 +#define SD_F_VPC 0x00000080 /* volume-per-channel */ +#define SD_F_EQ 0x00000100 /* EQ */ +#define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */ +#define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */ +#define SD_F_EQ_PC 0x00000800 /* EQ per-channel */ #define SD_F_EQ_DEFAULT (SD_F_EQ | SD_F_EQ_ENABLED) #define SD_F_EQ_MASK (SD_F_EQ | SD_F_EQ_ENABLED | \ @@ -127,26 +125,20 @@ struct snd_mixer; "\001SIMPLEX" \ "\002AUTOVCHAN" \ "\003SOFTPCMVOL" \ - "\004DYING" \ - "\005DETACHING" \ - "\006BUSY" \ - "\007MPSAFE" \ - "\010REGISTERED" \ - "\011BITPERFECT" \ - "\012VPC" \ - "\013EQ" \ - "\014EQ_ENABLED" \ - "\015EQ_BYPASSED" \ - "\016EQ_PC" \ + "\004BUSY" \ + "\005MPSAFE" \ + "\006REGISTERED" \ + "\007BITPERFECT" \ + "\010VPC" \ + "\011EQ" \ + "\012EQ_ENABLED" \ + "\013EQ_BYPASSED" \ + "\014EQ_PC" \ "\035PRIO_RD" \ "\036PRIO_WR" -#define PCM_ALIVE(x) ((x) != NULL && (x)->lock != NULL && \ - !((x)->flags & SD_F_DYING)) -#define PCM_REGISTERED(x) (PCM_ALIVE(x) && \ - ((x)->flags & SD_F_REGISTERED)) - -#define PCM_DETACHING(x) ((x)->flags & SD_F_DETACHING) +#define PCM_ALIVE(x) ((x) != NULL && (x)->lock != NULL) +#define PCM_REGISTERED(x) (PCM_ALIVE(x) && ((x)->flags & SD_F_REGISTERED)) #define PCM_CHANCOUNT(d) \ (d->playcount + d->pvchancount + d->reccount + d->rvchancount)