]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: rename rtd->num to rtd->id
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 24 Oct 2024 01:29:13 +0000 (01:29 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 1 Nov 2024 14:48:09 +0000 (14:48 +0000)
Current rtd has "num". It sounds/looks like size of rtd or something,
but it will be mainly used at snd_pcm_new() as "device index".
This naming is confusable. Let's rename it to "id"

Some drivers are using rtd->num, so let's keep it so far, and remove
it if all user was switched.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87zfmub85z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
include/sound/soc.h
sound/soc/soc-compress.c
sound/soc/soc-core.c
sound/soc/soc-dai.c
sound/soc/soc-pcm.c

index 0d1b215f24f4f020eae052f0ce9ca4ebb8f24d5e..9dbeedf6da13bc7e8a31e3e32aa20482ff6926af 100644 (file)
@@ -217,7 +217,7 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
 void snd_soc_dai_suspend(struct snd_soc_dai *dai);
 void snd_soc_dai_resume(struct snd_soc_dai *dai);
 int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
-                            struct snd_soc_pcm_runtime *rtd, int num);
+                            struct snd_soc_pcm_runtime *rtd, int id);
 bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream);
 void snd_soc_dai_action(struct snd_soc_dai *dai,
                        int stream, int action);
@@ -275,7 +275,7 @@ struct snd_soc_dai_ops {
        int (*probe)(struct snd_soc_dai *dai);
        int (*remove)(struct snd_soc_dai *dai);
        /* compress dai */
-       int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
+       int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int id);
        /* Optional Callback used at pcm creation*/
        int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
                       struct snd_soc_dai *dai);
index 5c240ea340276a42c06c1e493c84c7b7f3d5fc81..51840ceb3cd4209f0ba103e345c2574c2e6b64cd 100644 (file)
@@ -486,11 +486,11 @@ struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev,
 struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
                                                   const char *driver_name);
 
-int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
+int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id);
 #ifdef CONFIG_SND_SOC_COMPRESS
-int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id);
 #else
-static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
+static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
 {
        return 0;
 }
@@ -1195,7 +1195,8 @@ struct snd_soc_pcm_runtime {
        struct dentry *debugfs_dpcm_root;
 #endif
 
-       unsigned int num; /* 0-based and monotonic increasing */
+       unsigned int num; /* REMOVE ME */
+       unsigned int id; /* 0-based and monotonic increasing */
        struct list_head list; /* rtd list of the soc card */
 
        /* function mark */
index a0c55246f424b6e0dcf4ec13c7d3ef41b9747dc5..fb664c775dda50dc1b8b7c9b762b1b86eeab54dc 100644 (file)
@@ -537,11 +537,11 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
  * snd_soc_new_compress - create a new compress.
  *
  * @rtd: The runtime for which we will create compress
- * @num: the device index number (zero based - shared with normal PCMs)
+ * @id: the device index number (zero based - shared with normal PCMs)
  *
  * Return: 0 for success, else error.
  */
-int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
 {
        struct snd_soc_component *component;
        struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
@@ -617,7 +617,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
                snprintf(new_name, sizeof(new_name), "(%s)",
                        rtd->dai_link->stream_name);
 
-               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num,
+               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
                                playback, capture, &be_pcm);
                if (ret < 0) {
                        dev_err(rtd->card->dev,
@@ -638,7 +638,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
                memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops));
        } else {
                snprintf(new_name, sizeof(new_name), "%s %s-%d",
-                       rtd->dai_link->stream_name, codec_dai->name, num);
+                       rtd->dai_link->stream_name, codec_dai->name, id);
 
                memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
        }
@@ -652,7 +652,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
                break;
        }
 
-       ret = snd_compress_new(rtd->card->snd_card, num, direction,
+       ret = snd_compress_new(rtd->card->snd_card, id, direction,
                                new_name, compr);
        if (ret < 0) {
                component = snd_soc_rtd_to_codec(rtd, 0)->component;
index f04b671ce33ea67cae3bc4a41abcc3b0ae672c6c..3cb7482791669cef95b1132d8e46d110e65a5dd3 100644 (file)
@@ -558,7 +558,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
         */
        rtd->card       = card;
        rtd->dai_link   = dai_link;
-       rtd->num        = card->num_rtd++;
+       rtd->id         = card->num_rtd++;
+       rtd->num        = rtd->id;                      /* REMOVE ME */
        rtd->pmdown_time = pmdown_time;                 /* default power off timeout */
 
        /* see for_each_card_rtds */
@@ -1458,7 +1459,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
        struct snd_soc_dai_link *dai_link = rtd->dai_link;
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
        struct snd_soc_component *component;
-       int ret, num, i;
+       int ret, id, i;
 
        /* do machine specific initialization */
        ret = snd_soc_link_init(rtd);
@@ -1473,7 +1474,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
        /* add DPCM sysfs entries */
        soc_dpcm_debugfs_add(rtd);
 
-       num = rtd->num;
+       id = rtd->id;
 
        /*
         * most drivers will register their PCMs using DAI link ordering but
@@ -1485,18 +1486,18 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
                        continue;
 
                if (rtd->dai_link->no_pcm)
-                       num += component->driver->be_pcm_base;
+                       id += component->driver->be_pcm_base;
                else
-                       num = rtd->dai_link->id;
+                       id = rtd->dai_link->id;
        }
 
        /* create compress_device if possible */
-       ret = snd_soc_dai_compress_new(cpu_dai, rtd, num);
+       ret = snd_soc_dai_compress_new(cpu_dai, rtd, id);
        if (ret != -ENOTSUPP)
                goto err;
 
        /* create the pcm */
-       ret = soc_new_pcm(rtd, num);
+       ret = soc_new_pcm(rtd, id);
        if (ret < 0) {
                dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
                        dai_link->stream_name, ret);
index 4a1c85ad5a8d60eb1cd71773102b97551f9acd71..2feb76bf57bb72ab9596c65eed704c6b61d550c4 100644 (file)
@@ -457,12 +457,12 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
 }
 
 int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
-                            struct snd_soc_pcm_runtime *rtd, int num)
+                            struct snd_soc_pcm_runtime *rtd, int id)
 {
        int ret = -ENOTSUPP;
        if (dai->driver->ops &&
            dai->driver->ops->compress_new)
-               ret = dai->driver->ops->compress_new(rtd, num);
+               ret = dai->driver->ops->compress_new(rtd, id);
        return soc_dai_ret(dai, ret);
 }
 
index 678400e76e53b74576b118ca024f0bfe79895d9e..81b63e547a0996afcf405ad44975e817a89e451a 100644 (file)
@@ -2891,7 +2891,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
 
 static int soc_create_pcm(struct snd_pcm **pcm,
                          struct snd_soc_pcm_runtime *rtd,
-                         int playback, int capture, int num)
+                         int playback, int capture, int id)
 {
        char new_name[64];
        int ret;
@@ -2901,13 +2901,13 @@ static int soc_create_pcm(struct snd_pcm **pcm,
                snprintf(new_name, sizeof(new_name), "codec2codec(%s)",
                         rtd->dai_link->stream_name);
 
-               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num,
+               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
                                           playback, capture, pcm);
        } else if (rtd->dai_link->no_pcm) {
                snprintf(new_name, sizeof(new_name), "(%s)",
                        rtd->dai_link->stream_name);
 
-               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num,
+               ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
                                playback, capture, pcm);
        } else {
                if (rtd->dai_link->dynamic)
@@ -2916,9 +2916,9 @@ static int soc_create_pcm(struct snd_pcm **pcm,
                else
                        snprintf(new_name, sizeof(new_name), "%s %s-%d",
                                rtd->dai_link->stream_name,
-                               soc_codec_dai_name(rtd), num);
+                               soc_codec_dai_name(rtd), id);
 
-               ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback,
+               ret = snd_pcm_new(rtd->card->snd_card, new_name, id, playback,
                        capture, pcm);
        }
        if (ret < 0) {
@@ -2926,13 +2926,13 @@ static int soc_create_pcm(struct snd_pcm **pcm,
                        new_name, rtd->dai_link->name, ret);
                return ret;
        }
-       dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name);
+       dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", id, new_name);
 
        return 0;
 }
 
 /* create a new pcm */
-int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
+int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id)
 {
        struct snd_soc_component *component;
        struct snd_pcm *pcm;
@@ -2943,7 +2943,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
        if (ret < 0)
                return ret;
 
-       ret = soc_create_pcm(&pcm, rtd, playback, capture, num);
+       ret = soc_create_pcm(&pcm, rtd, playback, capture, id);
        if (ret < 0)
                return ret;