The branch main has been updated by christos:

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

commit f5d6e5cb5c3e0593d24c90671d72654aa59cdd1a
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2026-04-17 15:14:46 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2026-05-27 15:27:11 +0000

    sound: Retire FEEDEQ_DISABLE
    
    We can do this more efficiently by just using the SD_F_EQ* flags. In
    fact, the dev.pcm.%d.eq handler will (un)set SD_F_EQ_ENABLED and this is
    what we actually test with when choosing to creating the EQ feeder or
    not, so setting the state to FEEDEQ_DISABLE does not really an effect in
    the first place.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
---
 sys/dev/sound/pcm/channel.c   | 12 ++++--------
 sys/dev/sound/pcm/feeder.h    |  1 -
 sys/dev/sound/pcm/feeder_eq.c |  5 ++---
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index be6d7f82f502..c97a3158dbd9 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2177,7 +2177,7 @@ chn_syncstate(struct pcm_channel *c)
 
        if (c->feederflags & (1 << FEEDER_EQ)) {
                struct pcm_feeder *f;
-               int treble, bass, state;
+               int treble, bass;
 
                /* CHN_UNLOCK(c); */
                treble = mix_get(m, SOUND_MIXER_TREBLE);
@@ -2209,13 +2209,9 @@ chn_syncstate(struct pcm_channel *c)
                                device_printf(c->dev,
                                    "EQ: Failed to set preamp -- %d\n",
                                    d->eqpreamp);
-                       if (d->flags & SD_F_EQ_ENABLED)
-                               state = FEEDEQ_ENABLE;
-                       else
-                               state = FEEDEQ_DISABLE;
-                       if (FEEDER_SET(f, FEEDEQ_STATE, state) != 0)
-                               device_printf(c->dev,
-                                   "EQ: Failed to set state -- %d\n", state);
+                       if (d->flags & SD_F_EQ_ENABLED &&
+                           FEEDER_SET(f, FEEDEQ_STATE, FEEDEQ_ENABLE) != 0)
+                               device_printf(c->dev, "EQ: Failed to enable\n");
                }
        }
 }
diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h
index 7d14022c6849..10bfe9dca8f3 100644
--- a/sys/dev/sound/pcm/feeder.h
+++ b/sys/dev/sound/pcm/feeder.h
@@ -120,7 +120,6 @@ enum {
        FEEDEQ_BASS,
        FEEDEQ_PREAMP,
        FEEDEQ_STATE,
-       FEEDEQ_DISABLE,
        FEEDEQ_ENABLE,
        FEEDEQ_UNKNOWN
 };
diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c
index fe47a9d7e434..6fd7d7f2bfff 100644
--- a/sys/dev/sound/pcm/feeder_eq.c
+++ b/sys/dev/sound/pcm/feeder_eq.c
@@ -321,7 +321,7 @@ feed_eq_set(struct pcm_feeder *f, int what, int value)
                info->preamp = FEEDEQ_PREAMP2IDX(value);
                break;
        case FEEDEQ_STATE:
-               if (!(value == FEEDEQ_ENABLE || value == FEEDEQ_DISABLE))
+               if (value != FEEDEQ_ENABLE)
                        return (EINVAL);
                info->state = value;
                feed_eq_reset(info);
@@ -477,12 +477,11 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS)
 
                PCM_LOCK(d);
 
-               d->flags &= ~(SD_F_EQ_ENABLED);
                if (val == 1) {
                        val = FEEDEQ_ENABLE;
                        d->flags |= SD_F_EQ_ENABLED;
                } else
-                       val = FEEDEQ_DISABLE;
+                       d->flags &= ~SD_F_EQ_ENABLED;
 
                CHN_FOREACH(c, d, channels.pcm.busy) {
                        CHN_LOCK(c);

Reply via email to