diff mbox

[RFC,06/11] ASoC: dapm: Create API to add a single route element

Message ID 1466999284-14782-7-git-send-email-subhransu.s.prusty@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Subhransu S. Prusty June 27, 2016, 3:47 a.m. UTC
This is useful when one route element is added at a time.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
---
 include/sound/soc-dapm.h |  2 ++
 sound/soc/soc-dapm.c     | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

Comments

Mark Brown June 27, 2016, 6:02 p.m. UTC | #1
On Mon, Jun 27, 2016 at 09:17:59AM +0530, Subhransu S. Prusty wrote:

>  int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
>  			    const struct snd_soc_dapm_route *route, int num);
> +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm,
> +			    const struct snd_soc_dapm_route *route);

Just snd_soc_dapm_add_route() and rename the existing internal function.
Subhransu S. Prusty June 28, 2016, 5:22 a.m. UTC | #2
On Mon, Jun 27, 2016 at 07:02:06PM +0100, Mark Brown wrote:
> On Mon, Jun 27, 2016 at 09:17:59AM +0530, Subhransu S. Prusty wrote:
> 
> >  int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
> >  			    const struct snd_soc_dapm_route *route, int num);
> > +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm,
> > +			    const struct snd_soc_dapm_route *route);
> 
> Just snd_soc_dapm_add_route() and rename the existing internal function.

Sure.

Thanks
Subhransu
diff mbox

Patch

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 9706946..fffd1f1 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -396,6 +396,8 @@  int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
 			    const struct snd_soc_dapm_route *route, int num);
+int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm,
+			    const struct snd_soc_dapm_route *route);
 int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
 			    const struct snd_soc_dapm_route *route, int num);
 int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c446485..ad67647 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2802,6 +2802,27 @@  int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
 EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
 
 /**
+ * snd_soc_dapm_add_route_single - Add a single route
+ * @dapm: DAPM context
+ * @route: audio route element
+ *
+ * Connects 2 dapm widgets together via a named audio path.
+ * xxx_add_route is already managed through dapm lock.
+ */
+int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm,
+			    const struct snd_soc_dapm_route *route)
+{
+	int ret;
+
+	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
+	ret = snd_soc_dapm_add_route(dapm, route);
+	mutex_unlock(&dapm->card->dapm_mutex);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_add_route_single);
+
+/**
  * snd_soc_dapm_del_routes - Remove routes between DAPM widgets
  * @dapm: DAPM context
  * @route: audio routes