Commit a9830fc3 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

catpt: Switch to use list_entry_is_head() helper

Since we got list_entry_is_head() helper in the generic header,
we may switch catpt to use it. It removes the need in additional variable.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20201214172138.44267-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 984fcd3f
...@@ -331,7 +331,7 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai, ...@@ -331,7 +331,7 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai,
{ {
struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct snd_kcontrol *pos, *kctl = NULL; struct snd_kcontrol *pos;
const char *name; const char *name;
int ret; int ret;
u32 id = stream->info.stream_hw_id; u32 id = stream->info.stream_hw_id;
...@@ -356,17 +356,15 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai, ...@@ -356,17 +356,15 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai,
list_for_each_entry(pos, &component->card->snd_card->controls, list) { list_for_each_entry(pos, &component->card->snd_card->controls, list) {
if (pos->private_data == component && if (pos->private_data == component &&
!strncmp(name, pos->id.name, sizeof(pos->id.name))) { !strncmp(name, pos->id.name, sizeof(pos->id.name)))
kctl = pos;
break; break;
}
} }
if (!kctl) if (list_entry_is_head(pos, &component->card->snd_card->controls, list))
return -ENOENT; return -ENOENT;
if (stream->template->type != CATPT_STRM_TYPE_LOOPBACK) if (stream->template->type != CATPT_STRM_TYPE_LOOPBACK)
return catpt_set_dspvol(cdev, id, (long *)kctl->private_value); return catpt_set_dspvol(cdev, id, (long *)pos->private_value);
ret = catpt_ipc_mute_loopback(cdev, id, *(bool *)kctl->private_value); ret = catpt_ipc_mute_loopback(cdev, id, *(bool *)pos->private_value);
if (ret) if (ret)
return CATPT_IPC_ERROR(ret); return CATPT_IPC_ERROR(ret);
return 0; return 0;
......
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