Commit 395f8fd6 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Use for loop instead of while

The 'while' loop can be replaced with a 'for' loop, making it more clear
about what possible values there are, by having all of it in one place,
instead of scattered around.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220401120200.4047867-2-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 31231092
...@@ -2550,10 +2550,8 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg) ...@@ -2550,10 +2550,8 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg)
{ {
int ret; int ret;
tplg->pass = SOC_TPLG_PASS_START;
/* process the header types from start to end */ /* process the header types from start to end */
while (tplg->pass <= SOC_TPLG_PASS_END) { for (tplg->pass = SOC_TPLG_PASS_START; tplg->pass <= SOC_TPLG_PASS_END; tplg->pass++) {
struct snd_soc_tplg_hdr *hdr; struct snd_soc_tplg_hdr *hdr;
tplg->hdr_pos = tplg->fw->data; tplg->hdr_pos = tplg->fw->data;
...@@ -2585,8 +2583,6 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg) ...@@ -2585,8 +2583,6 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg)
hdr = (struct snd_soc_tplg_hdr *)tplg->hdr_pos; hdr = (struct snd_soc_tplg_hdr *)tplg->hdr_pos;
} }
/* next data type pass */
tplg->pass++;
} }
/* signal DAPM we are complete */ /* signal DAPM we are complete */
...@@ -2653,10 +2649,10 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp) ...@@ -2653,10 +2649,10 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp)
{ {
struct snd_card *card = comp->card->snd_card; struct snd_card *card = comp->card->snd_card;
struct snd_soc_dobj *dobj, *next_dobj; struct snd_soc_dobj *dobj, *next_dobj;
int pass = SOC_TPLG_PASS_END; int pass;
/* process the header types from end to start */ /* process the header types from end to start */
while (pass >= SOC_TPLG_PASS_START) { for (pass = SOC_TPLG_PASS_END; pass >= SOC_TPLG_PASS_START; pass--) {
/* remove mixer controls */ /* remove mixer controls */
down_write(&card->controls_rwsem); down_write(&card->controls_rwsem);
...@@ -2699,7 +2695,6 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp) ...@@ -2699,7 +2695,6 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp)
} }
} }
up_write(&card->controls_rwsem); up_write(&card->controls_rwsem);
pass--;
} }
/* let caller know if FW can be freed when no objects are left */ /* let caller know if FW can be freed when no objects are left */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment