]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: cs48l32: use snd_kcontrol_chip() instead of snd_soc_kcontrol_component()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 14 Oct 2025 04:21:16 +0000 (04:21 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2025 01:42:42 +0000 (02:42 +0100)
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/87plaqru4j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs48l32.c

index a306af4289adfb232ada005ce4777ca3d2355e7e..657f0697e8569c304dbe58782a8de25695957c71 100644 (file)
@@ -231,7 +231,7 @@ static_assert(ARRAY_SIZE(cs48l32_rate_val) == ARRAY_SIZE(cs48l32_rate_text));
 
 static int cs48l32_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        int ret;
 
@@ -704,7 +704,7 @@ static bool cs48l32_is_input_enabled(struct snd_soc_component *component,
 static int cs48l32_in_rate_put(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        int ret;
@@ -755,7 +755,7 @@ static int cs48l32_low_power_mode_put(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        int ret;
 
@@ -912,7 +912,7 @@ static const struct soc_enum cs48l32_lhpf_mode[] = {
 static int cs48l32_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
                                  struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        __be32 *data = (__be32 *)ucontrol->value.bytes.data;
        s16 val = (s16)be32_to_cpu(*data);
@@ -947,7 +947,7 @@ static const struct soc_enum cs48l32_eq_mode[] = {
 static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
        unsigned int item;
@@ -961,7 +961,7 @@ static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol,
 static int cs48l32_eq_mode_put(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
@@ -1000,7 +1000,7 @@ static int cs48l32_eq_coeff_info(struct snd_kcontrol *kcontrol,
 static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct cs48l32_eq_control *params = (void *)kcontrol->private_value;
        __be16 *coeffs;
@@ -1025,7 +1025,7 @@ static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol,
 static int cs48l32_eq_coeff_put(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct cs48l32_eq_control *params = (void *)kcontrol->private_value;
@@ -1062,7 +1062,7 @@ static const struct snd_kcontrol_new cs48l32_dsp_trigger_output_mux[] = {
 static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
        unsigned int cached_rate;
@@ -1082,7 +1082,7 @@ static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol,
 static int cs48l32_dsp_rate_put(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
@@ -2465,7 +2465,7 @@ static int cs48l32_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kco
 static int cs48l32_in_put_volsw(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component);
        int ret;