diff options
Diffstat (limited to 'sound/soc/soc-ops.c')
| -rw-r--r-- | sound/soc/soc-ops.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index acacbce2a821..793c4fd2c825 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -201,7 +201,10 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1; uinfo->value.integer.min = 0; - uinfo->value.integer.max = platform_max - mc->min; + if (uinfo->type == SNDRV_CTL_ELEM_TYPE_INTEGER) + uinfo->value.integer.max = platform_max - mc->min; + else + uinfo->value.integer.max = platform_max; return 0; } EXPORT_SYMBOL_GPL(snd_soc_info_volsw); @@ -221,14 +224,12 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw); int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - snd_soc_info_volsw(kcontrol, uinfo); /* Max represents the number of levels in an SX control not the - * maximum value, so add the minimum value back on + * maximum value. + * uinfo->value.integer.max is set to number of levels + * in snd_soc_info_volsw_sx. No further adjustment is necessary. */ - uinfo->value.integer.max += mc->min; return 0; } @@ -378,7 +379,7 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol, unsigned int rshift = mc->rshift; int max = mc->max; int min = mc->min; - int mask = (1 << (fls(min + max) - 1)) - 1; + unsigned int mask = (1U << (fls(min + max) - 1)) - 1; unsigned int val; int ret; @@ -423,7 +424,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, unsigned int rshift = mc->rshift; int max = mc->max; int min = mc->min; - int mask = (1 << (fls(min + max) - 1)) - 1; + unsigned int mask = (1U << (fls(min + max) - 1)) - 1; int err = 0; unsigned int val, val_mask, val2 = 0; |
