]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: ops: Remove snd_soc_info_volsw_range()
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 18 Mar 2025 17:14:52 +0000 (17:14 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 19 Mar 2025 12:48:04 +0000 (12:48 +0000)
The only difference between snd_soc_info_volsw() and
snd_soc_info_volsw_range() is that the later will not force a 2
value control to be of type integer if the name ends in "Volume".

The kernel currently contains no users of snd_soc_info_volsw_range()
that would return a boolean control with this code, so the risk is
quite low and it seems appropriate that it should contain volume
control detection. So remove snd_soc_info_volsw_range() and point its
users at snd_soc_info_volsw().

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250318171459.3203730-9-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/pci/hda/tas2781_hda_i2c.c
sound/pci/hda/tas2781_hda_spi.c
sound/soc/soc-ops.c
sound/soc/soc-topology.c

index d73fe26de1669abb6f6da0dbf02e06566dd6e045..b310f2c599f875ae4060bed65da39475f1617fd8 100644 (file)
@@ -65,7 +65,7 @@ struct platform_device;
        .private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
 #define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
-       .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
+       .info = snd_soc_info_volsw, .get = snd_soc_get_volsw_range, \
        .put = snd_soc_put_volsw_range, \
        .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
@@ -90,7 +90,7 @@ struct platform_device;
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
                 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
        .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
        .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
@@ -116,7 +116,7 @@ struct platform_device;
 #define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \
                           xmax, xinvert)               \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
        .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
                                            xshift, xmin, xmax, xinvert) }
@@ -164,7 +164,7 @@ struct platform_device;
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
                 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
        .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
        .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
                                            xshift, xmin, xmax, xinvert) }
@@ -266,7 +266,7 @@ struct platform_device;
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
                 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
        .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
@@ -569,8 +569,6 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
-int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_info *uinfo);
 int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
index be9a90f643ebb3079ca23a9531bd5c901cf5a8c8..50c5e5f2658953fdb2b0bb4211717ff1cd433d0f 100644 (file)
@@ -45,7 +45,7 @@
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
                 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
        .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = (unsigned long)&(struct soc_mixer_control) \
                {.reg = xreg, .rreg = xreg, .shift = xshift, \
index 00676cbb2c8e46da6ab19fc2d8740d344cd4b226..399f2e4c3b62b41b549660a92f91a98a0d073043 100644 (file)
@@ -52,7 +52,7 @@
        .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
                SNDRV_CTL_ELEM_ACCESS_READWRITE, \
        .tlv.p = (tlv_array), \
-       .info = snd_soc_info_volsw_range, \
+       .info = snd_soc_info_volsw, \
        .get = xhandler_get, .put = xhandler_put, \
        .private_value = (unsigned long)&(struct soc_mixer_control) { \
                .reg = xreg, .rreg = xreg, \
index 888afdd23f84eb7e88199dc28f9175dc058224bd..1b52ba12df8df7ed80db7c03f477ea0babe07904 100644 (file)
@@ -169,12 +169,12 @@ static int soc_mixer_sx_mask(struct soc_mixer_control *mc)
 }
 
 /**
- * snd_soc_info_volsw - single mixer info callback
+ * snd_soc_info_volsw - single mixer info callback with range.
  * @kcontrol: mixer control
  * @uinfo: control element information
  *
- * Callback to provide information about a single mixer control, or a double
- * mixer control that spans 2 registers.
+ * Callback to provide information, with a range, about a single mixer control,
+ * or a double mixer control that spans 2 registers.
  *
  * Returns 0 for success.
  */
@@ -450,36 +450,6 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 }
 EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
 
-/**
- * snd_soc_info_volsw_range - single mixer info callback with range.
- * @kcontrol: mixer control
- * @uinfo: control element information
- *
- * Callback to provide information, within a range, about a single
- * mixer control.
- *
- * returns 0 for success.
- */
-int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
-                            struct snd_ctl_elem_info *uinfo)
-{
-       struct soc_mixer_control *mc =
-               (struct soc_mixer_control *)kcontrol->private_value;
-       int max;
-
-       max = mc->max - mc->min;
-       if (mc->platform_max && mc->platform_max < max)
-               max = mc->platform_max;
-
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-       uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = max;
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(snd_soc_info_volsw_range);
-
 /**
  * snd_soc_put_volsw_range - single mixer put value callback with range.
  * @kcontrol: mixer control
index 2b86cc3311f760c3f5c91ddae8c9646e77e7ba65..9cbddfbbc556b7ac6a706d0b9c2e5ac6f5203cd7 100644 (file)
@@ -132,7 +132,7 @@ static const struct snd_soc_tplg_kcontrol_ops io_ops[] = {
        {SND_SOC_TPLG_CTL_BYTES, snd_soc_bytes_get,
                snd_soc_bytes_put, snd_soc_bytes_info},
        {SND_SOC_TPLG_CTL_RANGE, snd_soc_get_volsw_range,
-               snd_soc_put_volsw_range, snd_soc_info_volsw_range},
+               snd_soc_put_volsw_range, snd_soc_info_volsw},
        {SND_SOC_TPLG_CTL_VOLSW_XR_SX, snd_soc_get_xr_sx,
                snd_soc_put_xr_sx, snd_soc_info_xr_sx},
        {SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe,