Skip to content

Commit 894a37c

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: ops: Remove snd_soc_info_volsw_range()
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ed33606 commit 894a37c

File tree

5 files changed

+11
-43
lines changed

5 files changed

+11
-43
lines changed

include/sound/soc.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct platform_device;
6565
.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
6666
#define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
6767
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
68-
.info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
68+
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw_range, \
6969
.put = snd_soc_put_volsw_range, \
7070
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
7171
#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
@@ -90,7 +90,7 @@ struct platform_device;
9090
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
9191
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
9292
.tlv.p = (tlv_array), \
93-
.info = snd_soc_info_volsw_range, \
93+
.info = snd_soc_info_volsw, \
9494
.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
9595
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
9696
#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
@@ -116,7 +116,7 @@ struct platform_device;
116116
#define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \
117117
xmax, xinvert) \
118118
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
119-
.info = snd_soc_info_volsw_range, \
119+
.info = snd_soc_info_volsw, \
120120
.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
121121
.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
122122
xshift, xmin, xmax, xinvert) }
@@ -164,7 +164,7 @@ struct platform_device;
164164
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
165165
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
166166
.tlv.p = (tlv_array), \
167-
.info = snd_soc_info_volsw_range, \
167+
.info = snd_soc_info_volsw, \
168168
.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
169169
.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
170170
xshift, xmin, xmax, xinvert) }
@@ -266,7 +266,7 @@ struct platform_device;
266266
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
267267
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
268268
.tlv.p = (tlv_array), \
269-
.info = snd_soc_info_volsw_range, \
269+
.info = snd_soc_info_volsw, \
270270
.get = xhandler_get, .put = xhandler_put, \
271271
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
272272
#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,
569569
struct snd_ctl_elem_value *ucontrol);
570570
int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
571571
struct snd_ctl_elem_value *ucontrol);
572-
int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
573-
struct snd_ctl_elem_info *uinfo);
574572
int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
575573
struct snd_ctl_elem_value *ucontrol);
576574
int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,

sound/pci/hda/tas2781_hda_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
4646
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
4747
.tlv.p = (tlv_array), \
48-
.info = snd_soc_info_volsw_range, \
48+
.info = snd_soc_info_volsw, \
4949
.get = xhandler_get, .put = xhandler_put, \
5050
.private_value = (unsigned long)&(struct soc_mixer_control) \
5151
{.reg = xreg, .rreg = xreg, .shift = xshift, \

sound/pci/hda/tas2781_hda_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
5353
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
5454
.tlv.p = (tlv_array), \
55-
.info = snd_soc_info_volsw_range, \
55+
.info = snd_soc_info_volsw, \
5656
.get = xhandler_get, .put = xhandler_put, \
5757
.private_value = (unsigned long)&(struct soc_mixer_control) { \
5858
.reg = xreg, .rreg = xreg, \

sound/soc/soc-ops.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ static int soc_mixer_sx_mask(struct soc_mixer_control *mc)
169169
}
170170

171171
/**
172-
* snd_soc_info_volsw - single mixer info callback
172+
* snd_soc_info_volsw - single mixer info callback with range.
173173
* @kcontrol: mixer control
174174
* @uinfo: control element information
175175
*
176-
* Callback to provide information about a single mixer control, or a double
177-
* mixer control that spans 2 registers.
176+
* Callback to provide information, with a range, about a single mixer control,
177+
* or a double mixer control that spans 2 registers.
178178
*
179179
* Returns 0 for success.
180180
*/
@@ -450,36 +450,6 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
450450
}
451451
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
452452

453-
/**
454-
* snd_soc_info_volsw_range - single mixer info callback with range.
455-
* @kcontrol: mixer control
456-
* @uinfo: control element information
457-
*
458-
* Callback to provide information, within a range, about a single
459-
* mixer control.
460-
*
461-
* returns 0 for success.
462-
*/
463-
int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
464-
struct snd_ctl_elem_info *uinfo)
465-
{
466-
struct soc_mixer_control *mc =
467-
(struct soc_mixer_control *)kcontrol->private_value;
468-
int max;
469-
470-
max = mc->max - mc->min;
471-
if (mc->platform_max && mc->platform_max < max)
472-
max = mc->platform_max;
473-
474-
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
475-
uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
476-
uinfo->value.integer.min = 0;
477-
uinfo->value.integer.max = max;
478-
479-
return 0;
480-
}
481-
EXPORT_SYMBOL_GPL(snd_soc_info_volsw_range);
482-
483453
/**
484454
* snd_soc_put_volsw_range - single mixer put value callback with range.
485455
* @kcontrol: mixer control

sound/soc/soc-topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static const struct snd_soc_tplg_kcontrol_ops io_ops[] = {
132132
{SND_SOC_TPLG_CTL_BYTES, snd_soc_bytes_get,
133133
snd_soc_bytes_put, snd_soc_bytes_info},
134134
{SND_SOC_TPLG_CTL_RANGE, snd_soc_get_volsw_range,
135-
snd_soc_put_volsw_range, snd_soc_info_volsw_range},
135+
snd_soc_put_volsw_range, snd_soc_info_volsw},
136136
{SND_SOC_TPLG_CTL_VOLSW_XR_SX, snd_soc_get_xr_sx,
137137
snd_soc_put_xr_sx, snd_soc_info_xr_sx},
138138
{SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe,

0 commit comments

Comments
 (0)