ASoC: soc-component: add snd_soc_component_ack()
A message that is not in the archive (sent off-list or not yet received): CGME20200403041724epcas2p233810a68ae04a15427c33e5b82bc200a@epcas2p2.samsung.com
PATCH v2 1/1 ASoC: soc-component: add snd_soc_component_ack()
Current ALSA SoC is directly using component->driver->ops->xxx, thus, it is deep nested, and makes code difficult to read, and is not good for encapsulation.
This patch adds new snd_soc_component_ack() and use it. Ack callback is revived because some ASoC driver is using it.
Signed-off-by Gyeongtaek Lee <[email protected]>
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 18 ++++++++++++++++++ sound/soc/soc-pcm.c | 2 ++ 3 files changed, 21 insertions(+)
include/sound/soc-component.h +1 -0
@@ -381,6 +381,7 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream, unsigned long offset);int snd_soc_pcm_component_mmap (struct snd_pcm_substream *substream,struct vm_area_struct *vma); +int snd_soc_pcm_component_ack (struct snd_pcm_substream *substream);int snd_soc_pcm_component_new (struct snd_pcm *pcm);void snd_soc_pcm_component_free (struct snd_pcm *pcm);
sound/soc/soc-component.c +18 -0
@@ -526,6 +526,24 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,return -EINVAL ; } +int snd_soc_pcm_component_ack (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_rtdcom_list *rtdcom; +struct snd_soc_component *component; + +for_each_rtdcom (rtd, rtdcom) { + component = rtdcom->component; + +/* FIXME. it returns 1st ack now */ +if (component->driver->ops && + component->driver->ops->ack) +return component->driver->ops->ack (substream); + } + +return -EINVAL ; +} +int snd_soc_pcm_component_new (struct snd_pcm *pcm) {struct snd_soc_pcm_runtime *rtd = pcm->private_data;
sound/soc/soc-pcm.c +2 -0
@@ -2941,6 +2941,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)if (!ops)continue ; +if (ops->ack) + rtd->ops.ack = snd_soc_pcm_component_ack;if (ops->copy_user) rtd->ops.copy_user = snd_soc_pcm_component_copy_user;if (ops->page)
base-commit: ef8e14794308a428b194f8b06ad9ae06b43466e4
Signature · 1 line
2.21.0