[alsa-devel] [PATCH 23/25] ASoC: soc-component: move snd_soc_component_seq_notifier()
Charles Keepax
ckeepax at opensource.cirrus.com
Wed Jul 24 11:35:35 CEST 2019
On Wed, Jul 24, 2019 at 10:53:22AM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
>
> This patch moves snd_soc_component_seq_notifier() to soc-component.c
> It will be used at soc-dapm.c :: dapm_seq_run(),
> but no effect by this patch.
>
> static void dapm_seq_run(...)
> {
> ...
> => if (cur_dapm && cur_dapm->seq_notifier) {
> for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++)
> if (sort[i] == cur_sort)
> => cur_dapm->seq_notifier(cur_dapm,
> i,
> cur_subseq);
> }
> ...
> }
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
> +void snd_soc_component_seq_notifier(struct snd_soc_dapm_context *dapm,
> + enum snd_soc_dapm_type type, int subseq)
> +{
> + struct snd_soc_component *component = dapm->component;
> +
> + if (component->driver->seq_notifier)
> + component->driver->seq_notifier(component, type, subseq);
> +}
> +
> 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 573192d..84ded01 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
> int event)
> {
> @@ -2736,8 +2728,7 @@ 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->seq_notifier)
> - dapm->seq_notifier = snd_soc_component_seq_notifier;
> + dapm->seq_notifier = snd_soc_component_seq_notifier;
If we are updating this to always set a seq_notifier would it be
worth removing the NULL checks in soc-dapm.c? At the moment I
guess it will end up checking twice, DAPM checks if dapm->seq_notifier
is NULL but it never will be, then the helper checks if
driver->seq_notifier is NULL.
Thanks,
Charles
More information about the Alsa-devel
mailing list