Skip to content

Commit 8b12da9

Browse files
morimotobroonie
authored andcommitted
ASoC: cleanup function parameter for rtd and its id
some functions had parameter like below xxx(..., rtd, ..., id); This "id" is rtd->id. We don't need to have "id" on each functions because we can get it from "rtd". Let's cleanup it. Signed-off-by: Kuninori Morimoto <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent cb18cd2 commit 8b12da9

File tree

6 files changed

+22
-26
lines changed

6 files changed

+22
-26
lines changed

include/sound/soc-dai.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
216216
struct snd_pcm_substream *substream, int rollback);
217217
void snd_soc_dai_suspend(struct snd_soc_dai *dai);
218218
void snd_soc_dai_resume(struct snd_soc_dai *dai);
219-
int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
220-
struct snd_soc_pcm_runtime *rtd, int id);
219+
int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd);
221220
bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream);
222221
void snd_soc_dai_action(struct snd_soc_dai *dai,
223222
int stream, int action);
@@ -275,7 +274,7 @@ struct snd_soc_dai_ops {
275274
int (*probe)(struct snd_soc_dai *dai);
276275
int (*remove)(struct snd_soc_dai *dai);
277276
/* compress dai */
278-
int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int id);
277+
int (*compress_new)(struct snd_soc_pcm_runtime *rtd);
279278
/* Optional Callback used at pcm creation*/
280279
int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
281280
struct snd_soc_dai *dai);

include/sound/soc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,11 @@ struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev,
486486
struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
487487
const char *driver_name);
488488

489-
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id);
489+
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd);
490490
#ifdef CONFIG_SND_SOC_COMPRESS
491-
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id);
491+
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd);
492492
#else
493-
static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
493+
static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd)
494494
{
495495
return 0;
496496
}

sound/soc/soc-compress.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,10 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
537537
* snd_soc_new_compress - create a new compress.
538538
*
539539
* @rtd: The runtime for which we will create compress
540-
* @id: the device index number (zero based - shared with normal PCMs)
541540
*
542541
* Return: 0 for success, else error.
543542
*/
544-
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
543+
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd)
545544
{
546545
struct snd_soc_component *component;
547546
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
@@ -617,7 +616,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
617616
snprintf(new_name, sizeof(new_name), "(%s)",
618617
rtd->dai_link->stream_name);
619618

620-
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
619+
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
621620
playback, capture, &be_pcm);
622621
if (ret < 0) {
623622
dev_err(rtd->card->dev,
@@ -638,7 +637,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
638637
memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops));
639638
} else {
640639
snprintf(new_name, sizeof(new_name), "%s %s-%d",
641-
rtd->dai_link->stream_name, codec_dai->name, id);
640+
rtd->dai_link->stream_name, codec_dai->name, rtd->id);
642641

643642
memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
644643
}
@@ -652,7 +651,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
652651
break;
653652
}
654653

655-
ret = snd_compress_new(rtd->card->snd_card, id, direction,
654+
ret = snd_compress_new(rtd->card->snd_card, rtd->id, direction,
656655
new_name, compr);
657656
if (ret < 0) {
658657
component = snd_soc_rtd_to_codec(rtd, 0)->component;

sound/soc/soc-core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
14791479
{
14801480
struct snd_soc_dai_link *dai_link = rtd->dai_link;
14811481
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
1482-
int ret, id;
1482+
int ret;
14831483

14841484
/* do machine specific initialization */
14851485
ret = snd_soc_link_init(rtd);
@@ -1494,15 +1494,13 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
14941494
/* add DPCM sysfs entries */
14951495
soc_dpcm_debugfs_add(rtd);
14961496

1497-
id = rtd->id;
1498-
14991497
/* create compress_device if possible */
1500-
ret = snd_soc_dai_compress_new(cpu_dai, rtd, id);
1498+
ret = snd_soc_dai_compress_new(cpu_dai, rtd);
15011499
if (ret != -ENOTSUPP)
15021500
goto err;
15031501

15041502
/* create the pcm */
1505-
ret = soc_new_pcm(rtd, id);
1503+
ret = soc_new_pcm(rtd);
15061504
if (ret < 0) {
15071505
dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
15081506
dai_link->stream_name, ret);

sound/soc/soc-dai.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,12 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
457457
}
458458

459459
int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
460-
struct snd_soc_pcm_runtime *rtd, int id)
460+
struct snd_soc_pcm_runtime *rtd)
461461
{
462462
int ret = -ENOTSUPP;
463463
if (dai->driver->ops &&
464464
dai->driver->ops->compress_new)
465-
ret = dai->driver->ops->compress_new(rtd, id);
465+
ret = dai->driver->ops->compress_new(rtd);
466466
return soc_dai_ret(dai, ret);
467467
}
468468

sound/soc/soc-pcm.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
28912891

28922892
static int soc_create_pcm(struct snd_pcm **pcm,
28932893
struct snd_soc_pcm_runtime *rtd,
2894-
int playback, int capture, int id)
2894+
int playback, int capture)
28952895
{
28962896
char new_name[64];
28972897
int ret;
@@ -2901,13 +2901,13 @@ static int soc_create_pcm(struct snd_pcm **pcm,
29012901
snprintf(new_name, sizeof(new_name), "codec2codec(%s)",
29022902
rtd->dai_link->stream_name);
29032903

2904-
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
2904+
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
29052905
playback, capture, pcm);
29062906
} else if (rtd->dai_link->no_pcm) {
29072907
snprintf(new_name, sizeof(new_name), "(%s)",
29082908
rtd->dai_link->stream_name);
29092909

2910-
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
2910+
ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
29112911
playback, capture, pcm);
29122912
} else {
29132913
if (rtd->dai_link->dynamic)
@@ -2916,23 +2916,23 @@ static int soc_create_pcm(struct snd_pcm **pcm,
29162916
else
29172917
snprintf(new_name, sizeof(new_name), "%s %s-%d",
29182918
rtd->dai_link->stream_name,
2919-
soc_codec_dai_name(rtd), id);
2919+
soc_codec_dai_name(rtd), rtd->id);
29202920

2921-
ret = snd_pcm_new(rtd->card->snd_card, new_name, id, playback,
2921+
ret = snd_pcm_new(rtd->card->snd_card, new_name, rtd->id, playback,
29222922
capture, pcm);
29232923
}
29242924
if (ret < 0) {
29252925
dev_err(rtd->card->dev, "ASoC: can't create pcm %s for dailink %s: %d\n",
29262926
new_name, rtd->dai_link->name, ret);
29272927
return ret;
29282928
}
2929-
dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", id, new_name);
2929+
dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", rtd->id, new_name);
29302930

29312931
return 0;
29322932
}
29332933

29342934
/* create a new pcm */
2935-
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id)
2935+
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd)
29362936
{
29372937
struct snd_soc_component *component;
29382938
struct snd_pcm *pcm;
@@ -2943,7 +2943,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id)
29432943
if (ret < 0)
29442944
return ret;
29452945

2946-
ret = soc_create_pcm(&pcm, rtd, playback, capture, id);
2946+
ret = soc_create_pcm(&pcm, rtd, playback, capture);
29472947
if (ret < 0)
29482948
return ret;
29492949

0 commit comments

Comments
 (0)