Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-core: remove snd_soc_rtdcom_list

Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.

struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};

struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};

The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()

int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...

/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...

/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}

}

It shows, it is possible to know how many components will be
connected to rtd by using

dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms

If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
613fb500 a84188ec

+91 -134
+7 -11
include/sound/soc.h
··· 736 736 int (*trigger)(struct snd_compr_stream *); 737 737 }; 738 738 739 - struct snd_soc_rtdcom_list { 740 - struct snd_soc_component *component; 741 - struct list_head list; /* rtd::component_list */ 742 - }; 743 739 struct snd_soc_component* 744 740 snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, 745 741 const char *driver_name); 746 - #define for_each_rtd_components(rtd, rtdcom, _component) \ 747 - for (rtdcom = list_first_entry(&(rtd)->component_list, \ 748 - typeof(*rtdcom), list); \ 749 - (&rtdcom->list != &(rtd)->component_list) && \ 750 - (_component = rtdcom->component); \ 751 - rtdcom = list_next_entry(rtdcom, list)) 752 742 753 743 struct snd_soc_dai_link_component { 754 744 const char *name; ··· 1140 1150 1141 1151 unsigned int num; /* 0-based and monotonic increasing */ 1142 1152 struct list_head list; /* rtd list of the soc card */ 1143 - struct list_head component_list; /* list of connected components */ 1144 1153 1145 1154 /* bit field */ 1146 1155 unsigned int pop_wait:1; 1147 1156 unsigned int fe_compr:1; /* for Dynamic PCM */ 1157 + 1158 + int num_components; 1159 + struct snd_soc_component *components[0]; /* CPU/Codec/Platform */ 1148 1160 }; 1161 + #define for_each_rtd_components(rtd, i, component) \ 1162 + for ((i) = 0; \ 1163 + ((i) < rtd->num_components) && ((component) = rtd->components[i]);\ 1164 + (i)++) 1149 1165 #define for_each_rtd_codec_dai(rtd, i, dai)\ 1150 1166 for ((i) = 0; \ 1151 1167 ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
+16 -17
sound/soc/soc-component.c
··· 418 418 { 419 419 struct snd_soc_pcm_runtime *rtd = substream->private_data; 420 420 struct snd_soc_component *component; 421 - struct snd_soc_rtdcom_list *rtdcom; 421 + int i; 422 422 423 423 /* FIXME: use 1st pointer */ 424 - for_each_rtd_components(rtd, rtdcom, component) 424 + for_each_rtd_components(rtd, i, component) 425 425 if (component->driver->pointer) 426 426 return component->driver->pointer(component, substream); 427 427 ··· 433 433 { 434 434 struct snd_soc_pcm_runtime *rtd = substream->private_data; 435 435 struct snd_soc_component *component; 436 - struct snd_soc_rtdcom_list *rtdcom; 436 + int i; 437 437 438 438 /* FIXME: use 1st ioctl */ 439 - for_each_rtd_components(rtd, rtdcom, component) 439 + for_each_rtd_components(rtd, i, component) 440 440 if (component->driver->ioctl) 441 441 return component->driver->ioctl(component, substream, 442 442 cmd, arg); ··· 448 448 { 449 449 struct snd_soc_pcm_runtime *rtd = substream->private_data; 450 450 struct snd_soc_component *component; 451 - struct snd_soc_rtdcom_list *rtdcom; 452 - int ret; 451 + int i, ret; 453 452 454 - for_each_rtd_components(rtd, rtdcom, component) { 453 + for_each_rtd_components(rtd, i, component) { 455 454 if (component->driver->ioctl) { 456 455 ret = component->driver->sync_stop(component, 457 456 substream); ··· 467 468 void __user *buf, unsigned long bytes) 468 469 { 469 470 struct snd_soc_pcm_runtime *rtd = substream->private_data; 470 - struct snd_soc_rtdcom_list *rtdcom; 471 471 struct snd_soc_component *component; 472 + int i; 472 473 473 474 /* FIXME. it returns 1st copy now */ 474 - for_each_rtd_components(rtd, rtdcom, component) 475 + for_each_rtd_components(rtd, i, component) 475 476 if (component->driver->copy_user) 476 477 return component->driver->copy_user( 477 478 component, substream, channel, pos, buf, bytes); ··· 483 484 unsigned long offset) 484 485 { 485 486 struct snd_soc_pcm_runtime *rtd = substream->private_data; 486 - struct snd_soc_rtdcom_list *rtdcom; 487 487 struct snd_soc_component *component; 488 488 struct page *page; 489 + int i; 489 490 490 491 /* FIXME. it returns 1st page now */ 491 - for_each_rtd_components(rtd, rtdcom, component) { 492 + for_each_rtd_components(rtd, i, component) { 492 493 if (component->driver->page) { 493 494 page = component->driver->page(component, 494 495 substream, offset); ··· 504 505 struct vm_area_struct *vma) 505 506 { 506 507 struct snd_soc_pcm_runtime *rtd = substream->private_data; 507 - struct snd_soc_rtdcom_list *rtdcom; 508 508 struct snd_soc_component *component; 509 + int i; 509 510 510 511 /* FIXME. it returns 1st mmap now */ 511 - for_each_rtd_components(rtd, rtdcom, component) 512 + for_each_rtd_components(rtd, i, component) 512 513 if (component->driver->mmap) 513 514 return component->driver->mmap(component, 514 515 substream, vma); ··· 518 519 519 520 int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd) 520 521 { 521 - struct snd_soc_rtdcom_list *rtdcom; 522 522 struct snd_soc_component *component; 523 523 int ret; 524 + int i; 524 525 525 - for_each_rtd_components(rtd, rtdcom, component) { 526 + for_each_rtd_components(rtd, i, component) { 526 527 if (component->driver->pcm_construct) { 527 528 ret = component->driver->pcm_construct(component, rtd); 528 529 if (ret < 0) ··· 535 536 536 537 void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd) 537 538 { 538 - struct snd_soc_rtdcom_list *rtdcom; 539 539 struct snd_soc_component *component; 540 + int i; 540 541 541 542 if (!rtd->pcm) 542 543 return; 543 544 544 - for_each_rtd_components(rtd, rtdcom, component) 545 + for_each_rtd_components(rtd, i, component) 545 546 if (component->driver->pcm_destruct) 546 547 component->driver->pcm_destruct(component, rtd->pcm); 547 548 }
+31 -44
sound/soc/soc-compress.c
··· 26 26 { 27 27 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 28 28 struct snd_soc_component *component; 29 - struct snd_soc_rtdcom_list *rtdcom; 30 - int ret; 29 + int i, ret; 31 30 32 - for_each_rtd_components(rtd, rtdcom, component) { 31 + for_each_rtd_components(rtd, i, component) { 33 32 if (!component->driver->compr_ops || 34 33 !component->driver->compr_ops->open) 35 34 continue; ··· 53 54 { 54 55 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 55 56 struct snd_soc_component *component; 56 - struct snd_soc_rtdcom_list *rtdcom; 57 + int i; 57 58 58 - for_each_rtd_components(rtd, rtdcom, component) { 59 + for_each_rtd_components(rtd, i, component) { 59 60 if (component == last) 60 61 break; 61 62 ··· 73 74 { 74 75 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 75 76 struct snd_soc_component *component, *save = NULL; 76 - struct snd_soc_rtdcom_list *rtdcom; 77 77 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 78 - int ret; 78 + int ret, i; 79 79 80 - for_each_rtd_components(rtd, rtdcom, component) { 80 + for_each_rtd_components(rtd, i, component) { 81 81 ret = pm_runtime_get_sync(component->dev); 82 82 if (ret < 0 && ret != -EACCES) { 83 83 pm_runtime_put_noidle(component->dev); ··· 125 127 out: 126 128 mutex_unlock(&rtd->card->pcm_mutex); 127 129 pm_err: 128 - for_each_rtd_components(rtd, rtdcom, component) { 130 + for_each_rtd_components(rtd, i, component) { 129 131 if (component == save) 130 132 break; 131 133 pm_runtime_mark_last_busy(component->dev); ··· 257 259 { 258 260 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 259 261 struct snd_soc_component *component; 260 - struct snd_soc_rtdcom_list *rtdcom; 261 262 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 262 263 struct snd_soc_dai *codec_dai = rtd->codec_dai; 263 - int stream; 264 + int stream, i; 264 265 265 266 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 266 267 ··· 306 309 307 310 mutex_unlock(&rtd->card->pcm_mutex); 308 311 309 - for_each_rtd_components(rtd, rtdcom, component) { 312 + for_each_rtd_components(rtd, i, component) { 310 313 pm_runtime_mark_last_busy(component->dev); 311 314 pm_runtime_put_autosuspend(component->dev); 312 315 } ··· 368 371 { 369 372 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 370 373 struct snd_soc_component *component; 371 - struct snd_soc_rtdcom_list *rtdcom; 372 - int ret; 374 + int i, ret; 373 375 374 - for_each_rtd_components(rtd, rtdcom, component) { 376 + for_each_rtd_components(rtd, i, component) { 375 377 if (!component->driver->compr_ops || 376 378 !component->driver->compr_ops->trigger) 377 379 continue; ··· 470 474 { 471 475 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 472 476 struct snd_soc_component *component; 473 - struct snd_soc_rtdcom_list *rtdcom; 474 - int ret; 477 + int i, ret; 475 478 476 - for_each_rtd_components(rtd, rtdcom, component) { 479 + for_each_rtd_components(rtd, i, component) { 477 480 if (!component->driver->compr_ops || 478 481 !component->driver->compr_ops->set_params) 479 482 continue; ··· 601 606 { 602 607 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 603 608 struct snd_soc_component *component; 604 - struct snd_soc_rtdcom_list *rtdcom; 605 609 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 606 - int ret = 0; 610 + int i, ret = 0; 607 611 608 612 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 609 613 ··· 612 618 goto err; 613 619 } 614 620 615 - for_each_rtd_components(rtd, rtdcom, component) { 621 + for_each_rtd_components(rtd, i, component) { 616 622 if (!component->driver->compr_ops || 617 623 !component->driver->compr_ops->get_params) 618 624 continue; ··· 631 637 { 632 638 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 633 639 struct snd_soc_component *component; 634 - struct snd_soc_rtdcom_list *rtdcom; 635 - int ret = 0; 640 + int i, ret = 0; 636 641 637 642 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 638 643 639 - for_each_rtd_components(rtd, rtdcom, component) { 644 + for_each_rtd_components(rtd, i, component) { 640 645 if (!component->driver->compr_ops || 641 646 !component->driver->compr_ops->get_caps) 642 647 continue; ··· 653 660 { 654 661 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 655 662 struct snd_soc_component *component; 656 - struct snd_soc_rtdcom_list *rtdcom; 657 - int ret = 0; 663 + int i, ret = 0; 658 664 659 665 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 660 666 661 - for_each_rtd_components(rtd, rtdcom, component) { 667 + for_each_rtd_components(rtd, i, component) { 662 668 if (!component->driver->compr_ops || 663 669 !component->driver->compr_ops->get_codec_caps) 664 670 continue; ··· 675 683 { 676 684 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 677 685 struct snd_soc_component *component; 678 - struct snd_soc_rtdcom_list *rtdcom; 679 686 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 680 - int ret = 0; 687 + int i, ret = 0; 681 688 682 689 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 683 690 ··· 686 695 goto err; 687 696 } 688 697 689 - for_each_rtd_components(rtd, rtdcom, component) { 698 + for_each_rtd_components(rtd, i, component) { 690 699 if (!component->driver->compr_ops || 691 700 !component->driver->compr_ops->ack) 692 701 continue; ··· 706 715 { 707 716 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 708 717 struct snd_soc_component *component; 709 - struct snd_soc_rtdcom_list *rtdcom; 710 - int ret = 0; 718 + int i, ret = 0; 711 719 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 712 720 713 721 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); ··· 714 724 if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) 715 725 cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); 716 726 717 - for_each_rtd_components(rtd, rtdcom, component) { 727 + for_each_rtd_components(rtd, i, component) { 718 728 if (!component->driver->compr_ops || 719 729 !component->driver->compr_ops->pointer) 720 730 continue; ··· 732 742 { 733 743 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 734 744 struct snd_soc_component *component; 735 - struct snd_soc_rtdcom_list *rtdcom; 736 - int ret = 0; 745 + int i, ret = 0; 737 746 738 747 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 739 748 740 - for_each_rtd_components(rtd, rtdcom, component) { 749 + for_each_rtd_components(rtd, i, component) { 741 750 if (!component->driver->compr_ops || 742 751 !component->driver->compr_ops->copy) 743 752 continue; ··· 754 765 { 755 766 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 756 767 struct snd_soc_component *component; 757 - struct snd_soc_rtdcom_list *rtdcom; 758 768 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 759 - int ret; 769 + int i, ret; 760 770 761 771 if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) { 762 772 ret = cpu_dai->driver->cops->set_metadata(cstream, metadata, cpu_dai); ··· 763 775 return ret; 764 776 } 765 777 766 - for_each_rtd_components(rtd, rtdcom, component) { 778 + for_each_rtd_components(rtd, i, component) { 767 779 if (!component->driver->compr_ops || 768 780 !component->driver->compr_ops->set_metadata) 769 781 continue; ··· 782 794 { 783 795 struct snd_soc_pcm_runtime *rtd = cstream->private_data; 784 796 struct snd_soc_component *component; 785 - struct snd_soc_rtdcom_list *rtdcom; 786 797 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 787 - int ret; 798 + int i, ret; 788 799 789 800 if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) { 790 801 ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai); ··· 791 804 return ret; 792 805 } 793 806 794 - for_each_rtd_components(rtd, rtdcom, component) { 807 + for_each_rtd_components(rtd, i, component) { 795 808 if (!component->driver->compr_ops || 796 809 !component->driver->compr_ops->get_metadata) 797 810 continue; ··· 844 857 int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) 845 858 { 846 859 struct snd_soc_component *component; 847 - struct snd_soc_rtdcom_list *rtdcom; 848 860 struct snd_soc_dai *codec_dai = rtd->codec_dai; 849 861 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 850 862 struct snd_compr *compr; ··· 851 865 char new_name[64]; 852 866 int ret = 0, direction = 0; 853 867 int playback = 0, capture = 0; 868 + int i; 854 869 855 870 if (rtd->num_codecs > 1) { 856 871 dev_err(rtd->card->dev, ··· 920 933 memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); 921 934 } 922 935 923 - for_each_rtd_components(rtd, rtdcom, component) { 936 + for_each_rtd_components(rtd, i, component) { 924 937 if (!component->driver->compr_ops || 925 938 !component->driver->compr_ops->copy) 926 939 continue;
+21 -35
sound/soc/soc-core.c
··· 261 261 static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, 262 262 struct snd_soc_component *component) 263 263 { 264 - struct snd_soc_rtdcom_list *rtdcom; 265 264 struct snd_soc_component *comp; 265 + int i; 266 266 267 - for_each_rtd_components(rtd, rtdcom, comp) { 267 + for_each_rtd_components(rtd, i, comp) { 268 268 /* already connected */ 269 269 if (comp == component) 270 270 return 0; 271 271 } 272 272 273 - /* 274 - * created rtdcom here will be freed when rtd->dev was freed. 275 - * see 276 - * soc_free_pcm_runtime() :: device_unregister(rtd->dev) 277 - */ 278 - rtdcom = devm_kzalloc(rtd->dev, sizeof(*rtdcom), GFP_KERNEL); 279 - if (!rtdcom) 280 - return -ENOMEM; 281 - 282 - rtdcom->component = component; 283 - INIT_LIST_HEAD(&rtdcom->list); 284 - 285 - /* 286 - * When rtd was freed, created rtdcom here will be 287 - * also freed. 288 - * And we don't need to call list_del(&rtdcom->list) 289 - * when freed, because rtd is also freed. 290 - */ 291 - list_add_tail(&rtdcom->list, &rtd->component_list); 273 + /* see for_each_rtd_components */ 274 + rtd->components[rtd->num_components] = component; 275 + rtd->num_components++; 292 276 293 277 return 0; 294 278 } ··· 280 296 struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, 281 297 const char *driver_name) 282 298 { 283 - struct snd_soc_rtdcom_list *rtdcom; 284 299 struct snd_soc_component *component; 300 + int i; 285 301 286 302 if (!driver_name) 287 303 return NULL; ··· 294 310 * But, if many components which have same driver name are connected 295 311 * to 1 rtd, this function will return 1st found component. 296 312 */ 297 - for_each_rtd_components(rtd, rtdcom, component) { 313 + for_each_rtd_components(rtd, i, component) { 298 314 const char *component_name = component->driver->name; 299 315 300 316 if (!component_name) ··· 302 318 303 319 if ((component_name == driver_name) || 304 320 strcmp(component_name, driver_name) == 0) 305 - return rtdcom->component; 321 + return component; 306 322 } 307 323 308 324 return NULL; ··· 402 418 struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) 403 419 { 404 420 struct snd_soc_pcm_runtime *rtd; 421 + struct snd_soc_component *component; 405 422 struct device *dev; 406 423 int ret; 407 424 ··· 428 443 /* 429 444 * for rtd 430 445 */ 431 - rtd = devm_kzalloc(dev, sizeof(*rtd), GFP_KERNEL); 446 + rtd = devm_kzalloc(dev, 447 + sizeof(*rtd) + 448 + sizeof(*component) * (dai_link->num_cpus + 449 + dai_link->num_codecs + 450 + dai_link->num_platforms), 451 + GFP_KERNEL); 432 452 if (!rtd) 433 453 goto free_rtd; 434 454 435 455 rtd->dev = dev; 436 456 INIT_LIST_HEAD(&rtd->list); 437 - INIT_LIST_HEAD(&rtd->component_list); 438 457 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); 439 458 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); 440 459 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); ··· 1097 1108 { 1098 1109 struct snd_soc_dai_link *dai_link = rtd->dai_link; 1099 1110 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 1100 - struct snd_soc_rtdcom_list *rtdcom; 1101 1111 struct snd_soc_component *component; 1102 - int ret, num; 1112 + int ret, num, i; 1103 1113 1104 1114 /* set default power off timeout */ 1105 1115 rtd->pmdown_time = pmdown_time; ··· 1129 1141 * topology based drivers can use the DAI link id field to set PCM 1130 1142 * device number and then use rtd + a base offset of the BEs. 1131 1143 */ 1132 - for_each_rtd_components(rtd, rtdcom, component) { 1144 + for_each_rtd_components(rtd, i, component) { 1133 1145 if (!component->driver->use_dai_pcm_id) 1134 1146 continue; 1135 1147 ··· 1394 1406 { 1395 1407 struct snd_soc_component *component; 1396 1408 struct snd_soc_pcm_runtime *rtd; 1397 - struct snd_soc_rtdcom_list *rtdcom; 1398 - int order; 1409 + int i, order; 1399 1410 1400 1411 for_each_comp_order(order) { 1401 1412 for_each_card_rtds(card, rtd) { 1402 - for_each_rtd_components(rtd, rtdcom, component) { 1413 + for_each_rtd_components(rtd, i, component) { 1403 1414 if (component->driver->remove_order != order) 1404 1415 continue; 1405 1416 ··· 1412 1425 { 1413 1426 struct snd_soc_component *component; 1414 1427 struct snd_soc_pcm_runtime *rtd; 1415 - struct snd_soc_rtdcom_list *rtdcom; 1416 - int ret, order; 1428 + int i, ret, order; 1417 1429 1418 1430 for_each_comp_order(order) { 1419 1431 for_each_card_rtds(card, rtd) { 1420 - for_each_rtd_components(rtd, rtdcom, component) { 1432 + for_each_rtd_components(rtd, i, component) { 1421 1433 if (component->driver->probe_order != order) 1422 1434 continue; 1423 1435
+16 -27
sound/soc/soc-pcm.c
··· 111 111 */ 112 112 bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd) 113 113 { 114 - struct snd_soc_rtdcom_list *rtdcom; 115 114 struct snd_soc_component *component; 116 115 bool ignore = true; 116 + int i; 117 117 118 118 if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) 119 119 return true; 120 120 121 - for_each_rtd_components(rtd, rtdcom, component) 121 + for_each_rtd_components(rtd, i, component) 122 122 ignore &= !component->driver->use_pmdown_time; 123 123 124 124 return ignore; ··· 428 428 struct snd_soc_component **last) 429 429 { 430 430 struct snd_soc_pcm_runtime *rtd = substream->private_data; 431 - struct snd_soc_rtdcom_list *rtdcom; 432 431 struct snd_soc_component *component; 433 - int ret = 0; 432 + int i, ret = 0; 434 433 435 - for_each_rtd_components(rtd, rtdcom, component) { 434 + for_each_rtd_components(rtd, i, component) { 436 435 *last = component; 437 436 438 437 ret = snd_soc_component_module_get_when_open(component); ··· 458 459 struct snd_soc_component *last) 459 460 { 460 461 struct snd_soc_pcm_runtime *rtd = substream->private_data; 461 - struct snd_soc_rtdcom_list *rtdcom; 462 462 struct snd_soc_component *component; 463 - int ret = 0; 463 + int i, ret = 0; 464 464 465 - for_each_rtd_components(rtd, rtdcom, component) { 465 + for_each_rtd_components(rtd, i, component) { 466 466 if (component == last) 467 467 break; 468 468 ··· 482 484 struct snd_soc_pcm_runtime *rtd = substream->private_data; 483 485 struct snd_pcm_runtime *runtime = substream->runtime; 484 486 struct snd_soc_component *component; 485 - struct snd_soc_rtdcom_list *rtdcom; 486 487 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 487 488 struct snd_soc_dai *codec_dai; 488 489 const char *codec_dai_name = "multicodec"; ··· 491 494 for_each_rtd_codec_dai(rtd, i, codec_dai) 492 495 pinctrl_pm_select_default_state(codec_dai->dev); 493 496 494 - for_each_rtd_components(rtd, rtdcom, component) { 497 + for_each_rtd_components(rtd, i, component) 495 498 pm_runtime_get_sync(component->dev); 496 - } 497 499 498 500 mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); 499 501 ··· 613 617 out: 614 618 mutex_unlock(&rtd->card->pcm_mutex); 615 619 616 - for_each_rtd_components(rtd, rtdcom, component) { 620 + for_each_rtd_components(rtd, i, component) { 617 621 pm_runtime_mark_last_busy(component->dev); 618 622 pm_runtime_put_autosuspend(component->dev); 619 623 } ··· 673 677 { 674 678 struct snd_soc_pcm_runtime *rtd = substream->private_data; 675 679 struct snd_soc_component *component; 676 - struct snd_soc_rtdcom_list *rtdcom; 677 680 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 678 681 struct snd_soc_dai *codec_dai; 679 682 int i; ··· 723 728 724 729 mutex_unlock(&rtd->card->pcm_mutex); 725 730 726 - for_each_rtd_components(rtd, rtdcom, component) { 731 + for_each_rtd_components(rtd, i, component) { 727 732 pm_runtime_mark_last_busy(component->dev); 728 733 pm_runtime_put_autosuspend(component->dev); 729 734 } ··· 747 752 { 748 753 struct snd_soc_pcm_runtime *rtd = substream->private_data; 749 754 struct snd_soc_component *component; 750 - struct snd_soc_rtdcom_list *rtdcom; 751 755 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 752 756 struct snd_soc_dai *codec_dai; 753 757 int i, ret = 0; ··· 762 768 } 763 769 } 764 770 765 - for_each_rtd_components(rtd, rtdcom, component) { 771 + for_each_rtd_components(rtd, i, component) { 766 772 ret = snd_soc_component_prepare(component, substream); 767 773 if (ret < 0) { 768 774 dev_err(component->dev, ··· 823 829 struct snd_soc_component *last) 824 830 { 825 831 struct snd_soc_pcm_runtime *rtd = substream->private_data; 826 - struct snd_soc_rtdcom_list *rtdcom; 827 832 struct snd_soc_component *component; 828 - int ret = 0; 833 + int i, ret = 0; 829 834 830 - for_each_rtd_components(rtd, rtdcom, component) { 835 + for_each_rtd_components(rtd, i, component) { 831 836 if (component == last) 832 837 break; 833 838 ··· 846 853 { 847 854 struct snd_soc_pcm_runtime *rtd = substream->private_data; 848 855 struct snd_soc_component *component; 849 - struct snd_soc_rtdcom_list *rtdcom; 850 856 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 851 857 struct snd_soc_dai *codec_dai; 852 858 int i, ret = 0; ··· 924 932 925 933 snd_soc_dapm_update_dai(substream, params, cpu_dai); 926 934 927 - for_each_rtd_components(rtd, rtdcom, component) { 935 + for_each_rtd_components(rtd, i, component) { 928 936 ret = snd_soc_component_hw_params(component, substream, params); 929 937 if (ret < 0) { 930 938 dev_err(component->dev, ··· 1025 1033 { 1026 1034 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1027 1035 struct snd_soc_component *component; 1028 - struct snd_soc_rtdcom_list *rtdcom; 1029 1036 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 1030 1037 struct snd_soc_dai *codec_dai; 1031 1038 int i, ret; ··· 1035 1044 return ret; 1036 1045 } 1037 1046 1038 - for_each_rtd_components(rtd, rtdcom, component) { 1047 + for_each_rtd_components(rtd, i, component) { 1039 1048 ret = snd_soc_component_trigger(component, substream, cmd); 1040 1049 if (ret < 0) 1041 1050 return ret; ··· 1058 1067 { 1059 1068 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1060 1069 struct snd_soc_component *component; 1061 - struct snd_soc_rtdcom_list *rtdcom; 1062 1070 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 1063 1071 struct snd_soc_dai *codec_dai; 1064 1072 int i, ret; ··· 1072 1082 if (ret < 0) 1073 1083 return ret; 1074 1084 1075 - for_each_rtd_components(rtd, rtdcom, component) { 1085 + for_each_rtd_components(rtd, i, component) { 1076 1086 ret = snd_soc_component_trigger(component, substream, cmd); 1077 1087 if (ret < 0) 1078 1088 return ret; ··· 2887 2897 { 2888 2898 struct snd_soc_dai *codec_dai; 2889 2899 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 2890 - struct snd_soc_rtdcom_list *rtdcom; 2891 2900 struct snd_soc_component *component; 2892 2901 struct snd_pcm *pcm; 2893 2902 char new_name[64]; ··· 2996 3007 rtd->ops.pointer = soc_pcm_pointer; 2997 3008 } 2998 3009 2999 - for_each_rtd_components(rtd, rtdcom, component) { 3010 + for_each_rtd_components(rtd, i, component) { 3000 3011 const struct snd_soc_component_driver *drv = component->driver; 3001 3012 3002 3013 if (drv->ioctl)