Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codecs: max9759: use snd_kcontrol_chip() instead of snd_soc_kcontrol_component()

We have very similar name functions (A)(B). Both gets component from
snd_kcontrol, but (A) is used in callback functions which is registered
through snd_soc_add_component_controls(), (B) is used through
snd_soc_dapm_new_widgets().

(A) snd_soc_kcontrol_component()
(B) snd_soc_dapm_kcontrol_component()

(B) is using very picky way to get component but using it is necessary in
ASoC. But (A) is just wrapper function to snd_kcontrol_chip(), and directly
using it without wrapper is very common way on ALSA.
To reduce confusions of similar function, let's use common way on (A).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87347mru2t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
ee4ac04e b1daca03

+4 -4
+4 -4
sound/soc/codecs/max9759.c
··· 42 42 static int speaker_gain_control_get(struct snd_kcontrol *kcontrol, 43 43 struct snd_ctl_elem_value *ucontrol) 44 44 { 45 - struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); 45 + struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); 46 46 struct max9759 *priv = snd_soc_component_get_drvdata(c); 47 47 48 48 ucontrol->value.integer.value[0] = priv->gain; ··· 61 61 static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, 62 62 struct snd_ctl_elem_value *ucontrol) 63 63 { 64 - struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); 64 + struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); 65 65 struct max9759 *priv = snd_soc_component_get_drvdata(c); 66 66 67 67 if (ucontrol->value.integer.value[0] < 0 || ··· 83 83 static int speaker_mute_get(struct snd_kcontrol *kcontrol, 84 84 struct snd_ctl_elem_value *ucontrol) 85 85 { 86 - struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); 86 + struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); 87 87 struct max9759 *priv = snd_soc_component_get_drvdata(c); 88 88 89 89 ucontrol->value.integer.value[0] = !priv->is_mute; ··· 94 94 static int speaker_mute_put(struct snd_kcontrol *kcontrol, 95 95 struct snd_ctl_elem_value *ucontrol) 96 96 { 97 - struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); 97 + struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); 98 98 struct max9759 *priv = snd_soc_component_get_drvdata(c); 99 99 100 100 priv->is_mute = !ucontrol->value.integer.value[0];