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

index d07f288f9752ce75cdda493f94941ee9c234d418..5e7e85b4c98a103ac3608f00c595fe2e6132139b 100644 (file)
@@ -1046,7 +1046,7 @@ static const struct soc_enum btcvsd_enum[] = {
 static int btcvsd_band_get(struct snd_kcontrol *kcontrol,
                           struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        ucontrol->value.integer.value[0] = bt->band;
@@ -1056,7 +1056,7 @@ static int btcvsd_band_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_band_set(struct snd_kcontrol *kcontrol,
                           struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 
@@ -1071,7 +1071,7 @@ static int btcvsd_band_set(struct snd_kcontrol *kcontrol,
 static int btcvsd_loopback_get(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
        bool lpbk_en = bt->tx->state == BT_SCO_STATE_LOOPBACK;
 
@@ -1082,7 +1082,7 @@ static int btcvsd_loopback_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_loopback_set(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (ucontrol->value.integer.value[0]) {
@@ -1098,7 +1098,7 @@ static int btcvsd_loopback_set(struct snd_kcontrol *kcontrol,
 static int btcvsd_tx_mute_get(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (!bt->tx) {
@@ -1113,7 +1113,7 @@ static int btcvsd_tx_mute_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_tx_mute_set(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (!bt->tx)
@@ -1126,7 +1126,7 @@ static int btcvsd_tx_mute_set(struct snd_kcontrol *kcontrol,
 static int btcvsd_rx_irq_received_get(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (!bt->rx)
@@ -1139,7 +1139,7 @@ static int btcvsd_rx_irq_received_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_rx_timeout_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (!bt->rx)
@@ -1153,7 +1153,7 @@ static int btcvsd_rx_timeout_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_rx_timestamp_get(struct snd_kcontrol *kcontrol,
                                   unsigned int __user *data, unsigned int size)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
        int ret = 0;
        struct mtk_btcvsd_snd_time_buffer_info time_buffer_info_rx;
@@ -1180,7 +1180,7 @@ static int btcvsd_rx_timestamp_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_tx_irq_received_get(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        if (!bt->tx)
@@ -1193,7 +1193,7 @@ static int btcvsd_tx_irq_received_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_tx_timeout_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
 
        ucontrol->value.integer.value[0] = bt->tx->timeout;
@@ -1203,7 +1203,7 @@ static int btcvsd_tx_timeout_get(struct snd_kcontrol *kcontrol,
 static int btcvsd_tx_timestamp_get(struct snd_kcontrol *kcontrol,
                                   unsigned int __user *data, unsigned int size)
 {
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(cmpnt);
        int ret = 0;
        struct mtk_btcvsd_snd_time_buffer_info time_buffer_info_tx;