From nobody Tue Nov 26 14:48:57 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 4XyQST56g4z5fYtl; Tue, 26 Nov 2024 14:48:57 +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 4XyQST2n1fz4Wdk; Tue, 26 Nov 2024 14:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732632537; 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=GssVo29AwvJ0rl077w8/pmWLdndBRea6FWwQ6GDX/X4=; b=oX2FxgsCfCjn+o0psPvGa2/bdWzEzu5lgBXjr1TWCMeUg2KNW5a5eSI7bH0nZ965wQtsKi TRN1kYgH45bKErdRLgPmp4thVvgLghVnLXReDgBRzQSRkAlFMsXk0JIlj50qZU0wp54oRg ldRngiQuc73vUEgFZg+qIcnhclgROTOj9XDJLOCzb85DotI3U+A1zyYVVmDQ9nzKlzp2SN j2hFvIpq4uisI6dXwagNgXJp/nW/17vIrHs6eMtTU0mxtbCi6DD5JHVEynYubHB1Lr3trf wNc9xZgYiDnPIQ2u+5RmPI/PDWRKyYs/F2NxoKR5+G9TBzrraclwc1gwmx3qxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732632537; 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=GssVo29AwvJ0rl077w8/pmWLdndBRea6FWwQ6GDX/X4=; b=XR00fmm1Y1r9rFQn/fxc+BWI7MHP7bKW9eXBw65HaKp36eHvSfFiRppXHKg4k0/h9mMZfE TPMfYRPXSZp7bfuFbjH+pgPOOmrJe+wucpaCyLzCt6QMmnlISdotdf/DlDh5hUtWt49Kbb DOfGIUVAlhWOfZYiS/BFpPQzy27K9J4urJ6/RYEcXQjxqr+ndjZkJK3OwzZjiK2TrsLN6e ZFHgda8zL2rhEDKNlmVgwjDXzgqn4jDS229EILgFNJmh+GWb3OsXtxIgNYtnvY7nE/ph/7 BovN8VDLiFURL/6eB0c2V8ScaMdUG0xchufVVeS7e8iAn4cQHRJrXVxWOY3S+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732632537; a=rsa-sha256; cv=none; b=xL35QDNKOw+YJqqbdj6e5HoG5FOS0De24orniaDjBxuYfXaM3gZvk+iJJZ+nOk4nWlT6hQ hMeuY3DXqjdSRujtC9s2u2x58gkKYpDTZeWLtHR0LS+l5TLB2Xk+x69xIMFzZHYBSyEsSD Uvq0Cc1IAFBkJn10kYOZzIByABopaGGcglIm5FpWC1Ke3SiSpFSNzJPHSYkRZ+o3gyo68V wbXfGjKO8+OaY5rT2QaRiwv8hWLHCqskc1HmhLpfnU5FbC7GH41ynfMWEsAaNFZQ+PCWnN grw5yqQgfn5fOrg7cXlBiKaeNWmNSaZta7ZZ0GEc1Aqw1ywg7QVoSt/sJ06RhQ== 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 4XyQST2LP5zTxL; Tue, 26 Nov 2024 14:48:57 +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 4AQEmvux084172; Tue, 26 Nov 2024 14:48:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AQEmvXE084169; Tue, 26 Nov 2024 14:48:57 GMT (envelope-from git) Date: Tue, 26 Nov 2024 14:48:57 GMT Message-Id: <202411261448.4AQEmvXE084169@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: 6d4c59e26189 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 6d4c59e26189a8c19fd0832e89f9b089330cbfcb Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6d4c59e26189a8c19fd0832e89f9b089330cbfcb commit 6d4c59e26189a8c19fd0832e89f9b089330cbfcb Author: Christos Margiolis AuthorDate: 2024-11-26 14:48:30 +0000 Commit: Christos Margiolis CommitDate: 2024-11-26 14:48:30 +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 --- 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 c3e7fee41ab3..4b7bcc64397f 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -536,8 +536,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 1d09c48fc06b..f1d435369d36 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)