OSDN Git Service

ASoC: soc-core: add for_each_rtd_components() and replace
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 15 Oct 2019 03:59:31 +0000 (12:59 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 23 Oct 2019 16:44:24 +0000 (17:44 +0100)
commit2b544dd7b43b19fb55ea4fbb3e30b60eb20b7828
tree2a16a821a1fcb7b788bcba134bb8c2ee9fca9966
parent5a4c9f054ceeaa90caef033f5a52eca2d7975364
ASoC: soc-core: add for_each_rtd_components() and replace

ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below

       rtdcom    rtdcom      rtdcom
       component   component   component
rtd->component_list -> list -> list     -> list ...

Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component

for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}

but usually, user want to get pointer from for_each_xxx is component
directly, like below.

for_each_rtd_component(rtd, rtdcom, component) {
...
}

This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-component.c
sound/soc/soc-compress.c
sound/soc/soc-core.c
sound/soc/soc-pcm.c