The branch main has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e5d50a679aa1a72a7cbcb0281b9420aad4a7dc7a

commit e5d50a679aa1a72a7cbcb0281b9420aad4a7dc7a
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2025-11-28 14:35:56 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2025-11-28 14:35:56 +0000

    sound: Retire snd_mixer->busy
    
    Does not really serve any real purpose. It gets set on mixer_open() and
    unset on mixer_close(), so it essentially tells us whether the mixer is
    open or not.
    
    mixer_close() uses it to return EBADF in case the mixer is not busied,
    as in, the mixer has not been open()'d yet. This is redundant. The other
    place where this is used is to decide whether to serve an ioctl issued
    by userland, in which case it won't if, again, the mixer has not been
    busied (i.e., opened). Again, seems redundant.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D53859
---
 sys/dev/sound/pci/es137x.c |  4 ----
 sys/dev/sound/pcm/mixer.c  | 30 +-----------------------------
 sys/dev/sound/pcm/mixer.h  |  2 --
 3 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c
index cc51005309b0..4e8c7911e95e 100644
--- a/sys/dev/sound/pci/es137x.c
+++ b/sys/dev/sound/pci/es137x.c
@@ -1540,10 +1540,6 @@ sysctl_es137x_single_pcm_mixer(SYSCTL_HANDLER_ARGS)
                PCM_RELEASE_QUICK(d);
                return (ENODEV);
        }
-       if (mixer_busy(m) != 0) {
-               PCM_RELEASE_QUICK(d);
-               return (EBUSY);
-       }
        level = mix_get(m, SOUND_MIXER_PCM);
        recsrc = mix_getrecsrc(m);
        if (level < 0 || recsrc < 0) {
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index 55ce9596dde9..f6eb669010b5 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -48,7 +48,6 @@ SYSCTL_INT(_hw_snd, OID_AUTO, vpc_mixer_bypass, CTLFLAG_RWTUN,
 struct snd_mixer {
        KOBJ_FIELDS;
        void *devinfo;
-       int busy;
        int hwvol_mixer;
        int hwvol_step;
        int type;
@@ -651,7 +650,6 @@ mixer_obj_create(device_t dev, kobj_class_t cls, void 
*devinfo,
            "primary pcm mixer" : "secondary pcm mixer", MTX_DEF);
        m->type = type;
        m->devinfo = devinfo;
-       m->busy = 0;
        m->dev = dev;
        for (i = 0; i < nitems(m->parent); i++) {
                m->parent[i] = SOUND_MIXER_NONE;
@@ -947,14 +945,6 @@ mixer_hwvol_step(device_t dev, int left_step, int 
right_step)
        mtx_unlock(&m->lock);
 }
 
-int
-mixer_busy(struct snd_mixer *m)
-{
-       KASSERT(m != NULL, ("NULL snd_mixer"));
-
-       return (m->busy);
-}
-
 int
 mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right)
 {
@@ -1035,12 +1025,6 @@ mixer_open(struct cdev *i_dev, int flags, int mode, 
struct thread *td)
        if (!PCM_REGISTERED(d))
                return (EBADF);
 
-       /* XXX Need Giant magic entry ??? */
-
-       mtx_lock(&m->lock);
-       m->busy = 1;
-       mtx_unlock(&m->lock);
-
        return (0);
 }
 
@@ -1049,7 +1033,6 @@ mixer_close(struct cdev *i_dev, int flags, int mode, 
struct thread *td)
 {
        struct snddev_info *d;
        struct snd_mixer *m;
-       int ret;
 
        if (i_dev == NULL || i_dev->si_drv1 == NULL)
                return (EBADF);
@@ -1059,14 +1042,7 @@ mixer_close(struct cdev *i_dev, int flags, int mode, 
struct thread *td)
        if (!PCM_REGISTERED(d))
                return (EBADF);
 
-       /* XXX Need Giant magic entry ??? */
-
-       mtx_lock(&m->lock);
-       ret = (m->busy == 0) ? EBADF : 0;
-       m->busy = 0;
-       mtx_unlock(&m->lock);
-
-       return (ret);
+       return (0);
 }
 
 static int
@@ -1262,10 +1238,6 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t 
arg, int mode,
                return (EBADF);
 
        mtx_lock(&m->lock);
-       if (from == MIXER_CMD_CDEV && !m->busy) {
-               mtx_unlock(&m->lock);
-               return (EBADF);
-       }
        switch (cmd) {
        case SNDCTL_DSP_GET_RECSRC_NAMES:
                bcopy((void *)&m->enuminfo, arg, sizeof(oss_mixer_enuminfo));
diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h
index c47247ab570d..3ce8a4f5adee 100644
--- a/sys/dev/sound/pcm/mixer.h
+++ b/sys/dev/sound/pcm/mixer.h
@@ -45,8 +45,6 @@ void mixer_hwvol_mute(device_t dev);
 void mixer_hwvol_step_locked(struct snd_mixer *m, int l_step, int r_step);
 void mixer_hwvol_step(device_t dev, int left_step, int right_step);
 
-int mixer_busy(struct snd_mixer *m);
-
 int mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right);
 int mix_get(struct snd_mixer *m, u_int dev);
 int mix_setrecsrc(struct snd_mixer *m, u_int32_t src);

Reply via email to