diff options
author | Mengdong Lin <mengdong.lin@intel.com> | 2015-08-18 06:12:01 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-21 18:26:52 -0400 |
commit | 2b5cdb9156f76162d5302e2847f84a79de8a3ad1 (patch) | |
tree | 15a34894248ef33af07b8e7288725b873411b72f | |
parent | 88a17d8fb7c4a156ec13e6668b46dbbedf670ff7 (diff) |
ASoC: topology: Reduce arguments of soc_tplg_kcontrol_bind_io()
Add the pointer of struct soc_tplg as one argument, so no need to
pass standard/vendor specific kcontrol handlers and their count.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/soc-topology.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index ca551b9fd100..c4a58d7337b5 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c | |||
@@ -508,20 +508,22 @@ static void remove_pcm_dai(struct snd_soc_component *comp, | |||
508 | /* bind a kcontrol to it's IO handlers */ | 508 | /* bind a kcontrol to it's IO handlers */ |
509 | static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, | 509 | static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, |
510 | struct snd_kcontrol_new *k, | 510 | struct snd_kcontrol_new *k, |
511 | const struct snd_soc_tplg_kcontrol_ops *ops, int num_ops, | 511 | const struct soc_tplg *tplg) |
512 | const struct snd_soc_tplg_kcontrol_ops *bops, int num_bops) | ||
513 | { | 512 | { |
514 | int i; | 513 | const struct snd_soc_tplg_kcontrol_ops *ops; |
514 | int num_ops, i; | ||
515 | 515 | ||
516 | /* try and map vendor specific kcontrol handlers first */ | 516 | /* try and map vendor specific kcontrol handlers first */ |
517 | for (i = 0; i < num_bops; i++) { | 517 | ops = tplg->io_ops; |
518 | 518 | num_ops = tplg->io_ops_count; | |
519 | if (k->put == NULL && bops[i].id == hdr->ops.put) | 519 | for (i = 0; i < num_ops; i++) { |
520 | k->put = bops[i].put; | 520 | |
521 | if (k->get == NULL && bops[i].id == hdr->ops.get) | 521 | if (k->put == NULL && ops[i].id == hdr->ops.put) |
522 | k->get = bops[i].get; | 522 | k->put = ops[i].put; |
523 | if (k->info == NULL && bops[i].id == hdr->ops.info) | 523 | if (k->get == NULL && ops[i].id == hdr->ops.get) |
524 | k->info = bops[i].info; | 524 | k->get = ops[i].get; |
525 | if (k->info == NULL && ops[i].id == hdr->ops.info) | ||
526 | k->info = ops[i].info; | ||
525 | } | 527 | } |
526 | 528 | ||
527 | /* vendor specific handlers found ? */ | 529 | /* vendor specific handlers found ? */ |
@@ -529,6 +531,8 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, | |||
529 | return 0; | 531 | return 0; |
530 | 532 | ||
531 | /* none found so try standard kcontrol handlers */ | 533 | /* none found so try standard kcontrol handlers */ |
534 | ops = io_ops; | ||
535 | num_ops = ARRAY_SIZE(io_ops); | ||
532 | for (i = 0; i < num_ops; i++) { | 536 | for (i = 0; i < num_ops; i++) { |
533 | 537 | ||
534 | if (k->put == NULL && ops[i].id == hdr->ops.put) | 538 | if (k->put == NULL && ops[i].id == hdr->ops.put) |
@@ -682,8 +686,7 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, unsigned int count, | |||
682 | INIT_LIST_HEAD(&sbe->dobj.list); | 686 | INIT_LIST_HEAD(&sbe->dobj.list); |
683 | 687 | ||
684 | /* map io handlers */ | 688 | /* map io handlers */ |
685 | err = soc_tplg_kcontrol_bind_io(&be->hdr, &kc, io_ops, | 689 | err = soc_tplg_kcontrol_bind_io(&be->hdr, &kc, tplg); |
686 | ARRAY_SIZE(io_ops), tplg->io_ops, tplg->io_ops_count); | ||
687 | if (err) { | 690 | if (err) { |
688 | soc_control_err(tplg, &be->hdr, be->hdr.name); | 691 | soc_control_err(tplg, &be->hdr, be->hdr.name); |
689 | kfree(sbe); | 692 | kfree(sbe); |
@@ -777,8 +780,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, | |||
777 | INIT_LIST_HEAD(&sm->dobj.list); | 780 | INIT_LIST_HEAD(&sm->dobj.list); |
778 | 781 | ||
779 | /* map io handlers */ | 782 | /* map io handlers */ |
780 | err = soc_tplg_kcontrol_bind_io(&mc->hdr, &kc, io_ops, | 783 | err = soc_tplg_kcontrol_bind_io(&mc->hdr, &kc, tplg); |
781 | ARRAY_SIZE(io_ops), tplg->io_ops, tplg->io_ops_count); | ||
782 | if (err) { | 784 | if (err) { |
783 | soc_control_err(tplg, &mc->hdr, mc->hdr.name); | 785 | soc_control_err(tplg, &mc->hdr, mc->hdr.name); |
784 | kfree(sm); | 786 | kfree(sm); |
@@ -950,8 +952,7 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, | |||
950 | } | 952 | } |
951 | 953 | ||
952 | /* map io handlers */ | 954 | /* map io handlers */ |
953 | err = soc_tplg_kcontrol_bind_io(&ec->hdr, &kc, io_ops, | 955 | err = soc_tplg_kcontrol_bind_io(&ec->hdr, &kc, tplg); |
954 | ARRAY_SIZE(io_ops), tplg->io_ops, tplg->io_ops_count); | ||
955 | if (err) { | 956 | if (err) { |
956 | soc_control_err(tplg, &ec->hdr, ec->hdr.name); | 957 | soc_control_err(tplg, &ec->hdr, ec->hdr.name); |
957 | kfree(se); | 958 | kfree(se); |
@@ -1137,8 +1138,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create( | |||
1137 | INIT_LIST_HEAD(&sm->dobj.list); | 1138 | INIT_LIST_HEAD(&sm->dobj.list); |
1138 | 1139 | ||
1139 | /* map io handlers */ | 1140 | /* map io handlers */ |
1140 | err = soc_tplg_kcontrol_bind_io(&mc->hdr, &kc[i], io_ops, | 1141 | err = soc_tplg_kcontrol_bind_io(&mc->hdr, &kc[i], tplg); |
1141 | ARRAY_SIZE(io_ops), tplg->io_ops, tplg->io_ops_count); | ||
1142 | if (err) { | 1142 | if (err) { |
1143 | soc_control_err(tplg, &mc->hdr, mc->hdr.name); | 1143 | soc_control_err(tplg, &mc->hdr, mc->hdr.name); |
1144 | kfree(sm); | 1144 | kfree(sm); |
@@ -1235,8 +1235,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create( | |||
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | /* map io handlers */ | 1237 | /* map io handlers */ |
1238 | err = soc_tplg_kcontrol_bind_io(&ec->hdr, kc, io_ops, | 1238 | err = soc_tplg_kcontrol_bind_io(&ec->hdr, kc, tplg); |
1239 | ARRAY_SIZE(io_ops), tplg->io_ops, tplg->io_ops_count); | ||
1240 | if (err) { | 1239 | if (err) { |
1241 | soc_control_err(tplg, &ec->hdr, ec->hdr.name); | 1240 | soc_control_err(tplg, &ec->hdr, ec->hdr.name); |
1242 | goto err_se; | 1241 | goto err_se; |
@@ -1306,9 +1305,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create( | |||
1306 | INIT_LIST_HEAD(&sbe->dobj.list); | 1305 | INIT_LIST_HEAD(&sbe->dobj.list); |
1307 | 1306 | ||
1308 | /* map standard io handlers and check for external handlers */ | 1307 | /* map standard io handlers and check for external handlers */ |
1309 | err = soc_tplg_kcontrol_bind_io(&be->hdr, &kc[i], io_ops, | 1308 | err = soc_tplg_kcontrol_bind_io(&be->hdr, &kc[i], tplg); |
1310 | ARRAY_SIZE(io_ops), tplg->io_ops, | ||
1311 | tplg->io_ops_count); | ||
1312 | if (err) { | 1309 | if (err) { |
1313 | soc_control_err(tplg, &be->hdr, be->hdr.name); | 1310 | soc_control_err(tplg, &be->hdr, be->hdr.name); |
1314 | kfree(sbe); | 1311 | kfree(sbe); |