diff mbox series

[3/4] ASoC: intel: haswell: don't use snd_soc_rtdcom_lookup()

Message ID 878siounvz.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC:: don't use snd_soc_rtdcom_lookup() | expand

Commit Message

Kuninori Morimoto April 22, 2020, 4:48 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We shouldn't use snd_soc_rtdcom_lookup() as much as possible.
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple same driver
named component.

intel haswell driver is using it, but we can avoid it easily
by having component pointer at hsw_pcm_data.
This patch removes snd_soc_rtdcom_lookup() from this driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/haswell/sst-haswell-pcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
index c183f8e94ee4..15e94dae45de 100644
--- a/sound/soc/intel/haswell/sst-haswell-pcm.c
+++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
@@ -108,6 +108,7 @@  struct hsw_pcm_data {
 	struct snd_pcm *hsw_pcm;
 	u32 volume[2];
 	struct snd_pcm_substream *substream;
+	struct snd_soc_component *component;
 	struct snd_compr_stream *cstream;
 	unsigned int wpos;
 	struct mutex mutex;
@@ -696,7 +697,7 @@  static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data)
 	struct snd_pcm_substream *substream = pcm_data->substream;
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+	struct snd_soc_component *component = pcm_data->component;
 	struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
 	struct sst_hsw *hsw = pdata->hsw;
 	u32 pos;
@@ -798,6 +799,7 @@  static int hsw_pcm_open(struct snd_soc_component *component,
 	pm_runtime_get_sync(pdata->dev);
 
 	pcm_data->substream = substream;
+	pcm_data->component = component;
 
 	snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware);