Commit 52f4f727 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Cleanup soc_tplg_dapm_widget_dbytes_create

Minor cleanups to increase readability.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-5-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8ec2a264
...@@ -1249,25 +1249,22 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_ ...@@ -1249,25 +1249,22 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_
be = (struct snd_soc_tplg_bytes_control *)tplg->pos; be = (struct snd_soc_tplg_bytes_control *)tplg->pos;
/* validate kcontrol */ /* validate kcontrol */
if (strnlen(be->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == if (strnlen(be->hdr.name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
return -EINVAL; return -EINVAL;
sbe = devm_kzalloc(tplg->dev, sizeof(*sbe), GFP_KERNEL); sbe = devm_kzalloc(tplg->dev, sizeof(*sbe), GFP_KERNEL);
if (!sbe) if (!sbe)
return -ENOMEM; return -ENOMEM;
tplg->pos += (sizeof(struct snd_soc_tplg_bytes_control) + tplg->pos += (sizeof(struct snd_soc_tplg_bytes_control) + le32_to_cpu(be->priv.size));
le32_to_cpu(be->priv.size));
dev_dbg(tplg->dev, dev_dbg(tplg->dev, "ASoC: adding bytes kcontrol %s with access 0x%x\n",
"ASoC: adding bytes kcontrol %s with access 0x%x\n",
be->hdr.name, be->hdr.access); be->hdr.name, be->hdr.access);
kc->private_value = (long)sbe;
kc->name = devm_kstrdup(tplg->dev, be->hdr.name, GFP_KERNEL); kc->name = devm_kstrdup(tplg->dev, be->hdr.name, GFP_KERNEL);
if (!kc->name) if (!kc->name)
return -ENOMEM; return -ENOMEM;
kc->private_value = (long)sbe;
kc->iface = SNDRV_CTL_ELEM_IFACE_MIXER; kc->iface = SNDRV_CTL_ELEM_IFACE_MIXER;
kc->access = le32_to_cpu(be->hdr.access); kc->access = le32_to_cpu(be->hdr.access);
...@@ -1281,11 +1278,7 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_ ...@@ -1281,11 +1278,7 @@ static int soc_tplg_dapm_widget_dbytes_create(struct soc_tplg *tplg, struct snd_
} }
/* pass control to driver for optional further init */ /* pass control to driver for optional further init */
err = soc_tplg_control_load(tplg, kc, &be->hdr); return soc_tplg_control_load(tplg, kc, &be->hdr);
if (err < 0)
return err;
return 0;
} }
static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
......
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