All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH v2 21/29] ASoC: soc-component: move snd_soc_component_stream_event()
Date: 26 Jul 2019 13:51:39 +0900	[thread overview]
Message-ID: <87v9vp4d0r.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87pnlx5rq3.wl-kuninori.morimoto.gx@renesas.com>

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current soc-dapm / soc-core are using a long way round to call
.stream_event.

	if (driver->stream_event)
		dapm->stream_event = ...;
	...
	if (dapm->stream_event)
		ret = dapm->stream_event(...);

We can directly call it via driver->stream_event.
One note here is that both Card and Component have dapm,
but, Card's dapm doesn't have dapm->component.
We need to check it.

This patch moves snd_soc_component_stream_event() to soc-component.c
and updates parameters.
dapm->stream_event is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

	- remove dapm->stream_event

 include/sound/soc-component.h |  2 ++
 include/sound/soc-dapm.h      |  1 -
 sound/soc/soc-component.c     |  9 +++++++++
 sound/soc/soc-core.c          | 10 ----------
 sound/soc/soc-dapm.c          |  9 +++++++--
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 7ac903c..1f84f04 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -283,6 +283,8 @@ int snd_soc_component_set_jack(struct snd_soc_component *component,
 
 void snd_soc_component_seq_notifier(struct snd_soc_component *component,
 				    enum snd_soc_dapm_type type, int subseq);
+int snd_soc_component_stream_event(struct snd_soc_component *component,
+				   int event);
 
 #ifdef CONFIG_REGMAP
 void snd_soc_component_init_regmap(struct snd_soc_component *component,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index a03db6f..c2f14a3 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -670,7 +670,6 @@ struct snd_soc_dapm_context {
 	enum snd_soc_bias_level target_bias_level;
 	struct list_head list;
 
-	int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
 	int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
 			      enum snd_soc_bias_level level);
 
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index ca0b28b..f33dda8 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -59,6 +59,15 @@ void snd_soc_component_seq_notifier(struct snd_soc_component *component,
 		component->driver->seq_notifier(component, type, subseq);
 }
 
+int snd_soc_component_stream_event(struct snd_soc_component *component,
+				   int event)
+{
+	if (component->driver->stream_event)
+		return component->driver->stream_event(component, event);
+
+	return 0;
+}
+
 int snd_soc_component_enable_pin(struct snd_soc_component *component,
 				 const char *pin)
 {
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 99ec2b6..a10c443 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2692,14 +2692,6 @@ int snd_soc_register_dai(struct snd_soc_component *component,
 }
 EXPORT_SYMBOL_GPL(snd_soc_register_dai);
 
-static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
-	int event)
-{
-	struct snd_soc_component *component = dapm->component;
-
-	return component->driver->stream_event(component, event);
-}
-
 static int snd_soc_component_set_bias_level(struct snd_soc_dapm_context *dapm,
 					enum snd_soc_bias_level level)
 {
@@ -2728,8 +2720,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	dapm->bias_level = SND_SOC_BIAS_OFF;
 	dapm->idle_bias_off = !driver->idle_bias_on;
 	dapm->suspend_bias_off = driver->suspend_bias_off;
-	if (driver->stream_event)
-		dapm->stream_event = snd_soc_component_stream_event;
 	if (driver->set_bias_level)
 		dapm->set_bias_level = snd_soc_component_set_bias_level;
 
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7a9bff9..14afc56 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1913,6 +1913,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 	LIST_HEAD(down_list);
 	ASYNC_DOMAIN_EXCLUSIVE(async_domain);
 	enum snd_soc_bias_level bias;
+	int ret;
 
 	lockdep_assert_held(&card->dapm_mutex);
 
@@ -2029,8 +2030,12 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
 
 	/* do we need to notify any clients that DAPM event is complete */
 	list_for_each_entry(d, &card->dapm_list, list) {
-		if (d->stream_event)
-			d->stream_event(d, event);
+		if (!d->component)
+			continue;
+
+		ret = snd_soc_component_stream_event(d->component, event);
+		if (ret < 0)
+			return ret;
 	}
 
 	pop_dbg(card->dev, card->pop_time,
-- 
2.7.4

  parent reply	other threads:[~2019-07-26  4:51 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  4:48 [PATCH v2 00/29] ASoC: add soc-component.c Kuninori Morimoto
2019-07-26  4:49 ` [PATCH v2 01/29] ASoC: Intel: skl-pcm: disable skl_get_time_info Kuninori Morimoto
2019-08-05 15:45   ` Mark Brown
2019-08-05 16:06     ` Pierre-Louis Bossart
2019-08-06  0:00       ` Kuninori Morimoto
2019-07-26  4:49 ` [PATCH v2 02/29] ASoC: soc-pcm: remove soc_rtdcom_ack() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_rtdcom_ack()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 03/29] ASoC: soc-pcm: remove soc_rtdcom_copy_kernel() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_rtdcom_copy_kernel()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 04/29] ASoC: soc-pcm: remove soc_fill_silence() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_fill_silence()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 05/29] ASoC: add soc-component.c Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: add soc-component.c" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 06/29] ASoC: soc-component: add snd_soc_component_get/put() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_get/put()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 07/29] ASoC: soc-component: add snd_soc_component_open() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_open()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 08/29] ASoC: soc-component: add snd_soc_component_close() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_close()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 09/29] ASoC: soc-component: add snd_soc_component_prepare() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_prepare()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 10/29] ASoC: soc-component: add snd_soc_component_hw_params() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_hw_params()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 11/29] ASoC: soc-component: add snd_soc_component_hw_free() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_hw_free()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 12/29] ASoC: soc-component: add snd_soc_component_trigger() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_trigger()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 13/29] ASoC: soc-component: add snd_soc_component_suspend() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_suspend()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 14/29] ASoC: soc-component: add snd_soc_component_resume() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_resume()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 15/29] ASoC: soc-component: add snd_soc_component_is_suspended() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_is_suspended()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 16/29] ASoC: soc-component: add snd_soc_component_probe() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_probe()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 17/29] ASoC: soc-component: add snd_soc_component_remove() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_remove()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 18/29] ASoC: soc-component: add snd_soc_component_of_xlate_dai_id() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_of_xlate_dai_id()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 19/29] ASoC: soc-component: add snd_soc_component_of_xlate_dai_name() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_of_xlate_dai_name()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 20/29] ASoC: soc-component: move snd_soc_component_seq_notifier() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_seq_notifier()" to the asoc tree Mark Brown
2019-07-26  4:51 ` Kuninori Morimoto [this message]
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_stream_event()" " Mark Brown
2019-07-26  4:51 ` [PATCH v2 22/29] ASoC: soc-component: move snd_soc_component_set_bias_level() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_set_bias_level()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 23/29] ASoC: soc-component: add snd_soc_pcm_component_pointer() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pointer()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 24/29] ASoC: soc-component: add snd_soc_pcm_component_ioctrl() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_ioctrl()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 25/29] ASoC: soc-component: add snd_soc_pcm_component_copy_user() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_copy_user()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 26/29] ASoC: soc-component: add snd_soc_pcm_component_page() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_page()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 27/29] ASoC: soc-component: add snd_soc_pcm_component_mmap() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_mmap()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 28/29] ASoC: soc-component: add snd_soc_pcm_component_pcm_new() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pcm_new()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 29/29] ASoC: soc-component: add snd_soc_pcm_component_pcm_free() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pcm_free()" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9vp4d0r.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.