diff mbox series

[24/25] ASoC: soc-component: move snd_soc_component_stream_event()

Message ID 874l3ctd42.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: add soc-component.c | expand

Commit Message

Kuninori Morimoto July 24, 2019, 1:53 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch moves snd_soc_component_stream_event() to soc-component.c
It will be used at soc-dapm.c :: dapm_power_widgets(),
but no effect by this patch.

	static int dapm_power_widgets(struct snd_soc_card *card, int event)
	{
		...
		list_for_each_entry(d, &card->dapm_list, list) {
=>			if (d->stream_event)
=>				d->stream_event(d, event);
		}
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-component.h |  2 ++
 sound/soc/soc-component.c     | 10 ++++++++++
 sound/soc/soc-core.c          | 11 +----------
 3 files changed, 13 insertions(+), 10 deletions(-)

Comments

Charles Keepax July 24, 2019, 9:37 a.m. UTC | #1
On Wed, Jul 24, 2019 at 10:53:37AM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch moves snd_soc_component_stream_event() to soc-component.c
> It will be used at soc-dapm.c :: dapm_power_widgets(),
> but no effect by this patch.
> 
> 	static int dapm_power_widgets(struct snd_soc_card *card, int event)
> 	{
> 		...
> 		list_for_each_entry(d, &card->dapm_list, list) {
> =>			if (d->stream_event)
> =>				d->stream_event(d, event);
> 		}
> 		...
> 	}
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index e4e8fc4..ab8e7cc 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -61,6 +61,16 @@ void snd_soc_component_seq_notifier(struct snd_soc_dapm_context *dapm,
>  		component->driver->seq_notifier(component, type, subseq);
>  }
>  
> +int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
> +				   int event)
> +{
> +	struct snd_soc_component *component = dapm->component;
> +
> +	if (component->driver->stream_event)
> +		return component->driver->stream_event(component, event);
> +	return 0;

Minor nitpick but a blank line before the return would be more
normal and consistent with your other patches.

> @@ -2729,8 +2721,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
>  	dapm->idle_bias_off = !driver->idle_bias_on;
>  	dapm->suspend_bias_off = driver->suspend_bias_off;
>  	dapm->seq_notifier = snd_soc_component_seq_notifier;
> -	if (driver->stream_event)
> -		dapm->stream_event = snd_soc_component_stream_event;
> +	dapm->stream_event = snd_soc_component_stream_event;

Obviously same comment regarding the NULL checks in DAPM applies
here.

Thanks,
Charles
Kuninori Morimoto July 25, 2019, 1:54 a.m. UTC | #2
Hi Charles

Thank you for your feedback
I will fix it at v2

> > +int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
> > +				   int event)
> > +{
> > +	struct snd_soc_component *component = dapm->component;
> > +
> > +	if (component->driver->stream_event)
> > +		return component->driver->stream_event(component, event);
> > +	return 0;
> 
> Minor nitpick but a blank line before the return would be more
> normal and consistent with your other patches.
> 
> > @@ -2729,8 +2721,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
> >  	dapm->idle_bias_off = !driver->idle_bias_on;
> >  	dapm->suspend_bias_off = driver->suspend_bias_off;
> >  	dapm->seq_notifier = snd_soc_component_seq_notifier;
> > -	if (driver->stream_event)
> > -		dapm->stream_event = snd_soc_component_stream_event;
> > +	dapm->stream_event = snd_soc_component_stream_event;
> 
> Obviously same comment regarding the NULL checks in DAPM applies
> here.
> 
> Thanks,
> Charles
diff mbox series

Patch

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 4711138..8c88058 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -276,6 +276,8 @@  int snd_soc_component_set_jack(struct snd_soc_component *component,
 /* for dapm */
 void snd_soc_component_seq_notifier(struct snd_soc_dapm_context *dapm,
 				    enum snd_soc_dapm_type type, int subseq);
+int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
+				   int event);
 
 #ifdef CONFIG_REGMAP
 void snd_soc_component_init_regmap(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index e4e8fc4..ab8e7cc 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -61,6 +61,16 @@  void snd_soc_component_seq_notifier(struct snd_soc_dapm_context *dapm,
 		component->driver->seq_notifier(component, type, subseq);
 }
 
+int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
+				   int event)
+{
+	struct snd_soc_component *component = dapm->component;
+
+	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 84ded01..6f7de6a 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)
 {
@@ -2729,8 +2721,7 @@  static int snd_soc_component_initialize(struct snd_soc_component *component,
 	dapm->idle_bias_off = !driver->idle_bias_on;
 	dapm->suspend_bias_off = driver->suspend_bias_off;
 	dapm->seq_notifier = snd_soc_component_seq_notifier;
-	if (driver->stream_event)
-		dapm->stream_event = snd_soc_component_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;