Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit ae2f4849 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: soc-component: add snd_soc_component_open()



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_open() and use it.

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ftmt5rnx.wl-kuninori.morimoto.gx@renesas.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4a81e8f3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -338,4 +338,8 @@ int snd_soc_component_force_enable_pin_unlocked(
	struct snd_soc_component *component,
	const char *pin);

/* component driver ops */
int snd_soc_component_open(struct snd_soc_component *component,
			   struct snd_pcm_substream *substream);

#endif /* __SOC_COMPONENT_H */
+10 −0
Original line number Diff line number Diff line
@@ -285,3 +285,13 @@ void snd_soc_component_module_put(struct snd_soc_component *component,
	if (component->driver->module_get_upon_open == !!upon_open)
		module_put(component->dev->driver->owner);
}

int snd_soc_component_open(struct snd_soc_component *component,
			   struct snd_pcm_substream *substream)
{
	if (component->driver->ops &&
	    component->driver->ops->open)
		return component->driver->ops->open(substream);

	return 0;
}
+1 −5
Original line number Diff line number Diff line
@@ -447,11 +447,7 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
			return ret;
		}

		if (!component->driver->ops ||
		    !component->driver->ops->open)
			continue;

		ret = component->driver->ops->open(substream);
		ret = snd_soc_component_open(component, substream);
		if (ret < 0) {
			dev_err(component->dev,
				"ASoC: can't open component %s: %d\n",