All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>
Subject: [alsa-devel] Applied "ASoC: soc-pcm: add for_each_dapm_widgets() macro" to the asoc tree
Date: Tue, 11 Feb 2020 15:48:26 +0000	[thread overview]
Message-ID: <applied-878slbceyg.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <878slbceyg.wl-kuninori.morimoto.gx@renesas.com>

The patch

   ASoC: soc-pcm: add for_each_dapm_widgets() macro

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 09e88f8a5c56ac5258935a5a543868c20a55d4dd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 10 Feb 2020 12:14:22 +0900
Subject: [PATCH] ASoC: soc-pcm: add for_each_dapm_widgets() macro

This patch adds new for_each_dapm_widgets() macro and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/878slbceyg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/soc-dapm.h |  5 +++++
 sound/soc/soc-dapm.c     |  8 ++------
 sound/soc/soc-pcm.c      | 17 +++++++++--------
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 2a306c6f3fbc..9439e75945f6 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -693,6 +693,11 @@ struct snd_soc_dapm_widget_list {
 	struct snd_soc_dapm_widget *widgets[0];
 };
 
+#define for_each_dapm_widgets(list, i, widget)				\
+	for ((i) = 0;							\
+	     (i) < list->num_widgets && (widget = list->widgets[i]);	\
+	     (i)++)
+
 struct snd_soc_dapm_stats {
 	int power_checks;
 	int path_checks;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bc20ad9abf8b..cc17a3730d3d 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1724,9 +1724,7 @@ static void dapm_widget_update(struct snd_soc_card *card)
 
 	wlist = dapm_kcontrol_get_wlist(update->kcontrol);
 
-	for (wi = 0; wi < wlist->num_widgets; wi++) {
-		w = wlist->widgets[wi];
-
+	for_each_dapm_widgets(wlist, wi, w) {
 		if (w->event && (w->event_flags & SND_SOC_DAPM_PRE_REG)) {
 			ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG);
 			if (ret != 0)
@@ -1753,9 +1751,7 @@ static void dapm_widget_update(struct snd_soc_card *card)
 				w->name, ret);
 	}
 
-	for (wi = 0; wi < wlist->num_widgets; wi++) {
-		w = wlist->widgets[wi];
-
+	for_each_dapm_widgets(wlist, wi, w) {
 		if (w->event && (w->event_flags & SND_SOC_DAPM_POST_REG)) {
 			ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG);
 			if (ret != 0)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 2a4f7ac5f563..7a490c05d4e9 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1306,12 +1306,12 @@ static inline struct snd_soc_dapm_widget *
 static int widget_in_list(struct snd_soc_dapm_widget_list *list,
 		struct snd_soc_dapm_widget *widget)
 {
+	struct snd_soc_dapm_widget *w;
 	int i;
 
-	for (i = 0; i < list->num_widgets; i++) {
-		if (widget == list->widgets[i])
+	for_each_dapm_widgets(list, i, w)
+		if (widget == w)
 			return 1;
-	}
 
 	return 0;
 }
@@ -1422,12 +1422,13 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 	struct snd_soc_card *card = fe->card;
 	struct snd_soc_dapm_widget_list *list = *list_;
 	struct snd_soc_pcm_runtime *be;
+	struct snd_soc_dapm_widget *widget;
 	int i, new = 0, err;
 
 	/* Create any new FE <--> BE connections */
-	for (i = 0; i < list->num_widgets; i++) {
+	for_each_dapm_widgets(list, i, widget) {
 
-		switch (list->widgets[i]->id) {
+		switch (widget->id) {
 		case snd_soc_dapm_dai_in:
 			if (stream != SNDRV_PCM_STREAM_PLAYBACK)
 				continue;
@@ -1441,10 +1442,10 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 		}
 
 		/* is there a valid BE rtd for this widget */
-		be = dpcm_get_be(card, list->widgets[i], stream);
+		be = dpcm_get_be(card, widget, stream);
 		if (!be) {
 			dev_err(fe->dev, "ASoC: no BE found for %s\n",
-					list->widgets[i]->name);
+					widget->name);
 			continue;
 		}
 
@@ -1460,7 +1461,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 		err = dpcm_be_connect(fe, be, stream);
 		if (err < 0) {
 			dev_err(fe->dev, "ASoC: can't connect %s\n",
-				list->widgets[i]->name);
+				widget->name);
 			break;
 		} else if (err == 0) /* already connected */
 			continue;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2020-02-11 15:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  3:13 [alsa-devel] [PATCH v3 0/7] ASoC: soc-pcm cleanup step2 Kuninori Morimoto
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 1/8] ASoC: soc-pcm: add snd_soc_runtime_action() Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: add snd_soc_runtime_action()" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 2/8] ASoC: soc-pcm: adjustment for DAI member 0 reset Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: adjustment for DAI member 0 reset" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 3/8] ASoC: soc-pcm: add for_each_dapm_widgets() macro Kuninori Morimoto
2020-02-11 15:48   ` Mark Brown [this message]
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 4/8] ASoC: soc-pcm: don't use bit-OR'ed error Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: don't use bit-OR'ed error" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 5/8] ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once Kuninori Morimoto
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once" to the asoc tree Mark Brown
2020-03-27 18:16   ` [alsa-devel] [PATCH v3 5/8] ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once Amadeusz Sławiński
2020-03-27 18:38     ` Pierre-Louis Bossart
2020-03-30  1:10       ` Kuninori Morimoto
2020-03-30  7:25         ` Amadeusz Sławiński
2020-03-30 11:08           ` Mark Brown
2020-03-30 23:28             ` Kuninori Morimoto
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 6/8] ASoC: soc-pcm: call snd_soc_component_open/close() once Kuninori Morimoto
2020-02-10 14:41   ` Pierre-Louis Bossart
2020-02-11 12:16     ` Mark Brown
2020-02-12  0:32       ` Kuninori Morimoto
2020-02-12  1:16         ` Kuninori Morimoto
2020-02-12 15:26           ` Pierre-Louis Bossart
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: call snd_soc_component_open/close() once" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 7/8] ASoC: soc-pcm: move soc_pcm_close() next to soc_pcm_open() Kuninori Morimoto
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: move soc_pcm_close() next to soc_pcm_open()" to the asoc tree Mark Brown
2020-02-10  3:14 ` [alsa-devel] [PATCH v3 8/8] ASoC: soc-pcm: tidyup soc_pcm_open() order Kuninori Morimoto
2020-02-12 23:57   ` [alsa-devel] Applied "ASoC: soc-pcm: tidyup soc_pcm_open() order" to the asoc tree Mark Brown
     [not found] ` <87d0anceze.wl-kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2020-02-18 19:14   ` [alsa-devel] [PATCH v3 0/7] ASoC: soc-pcm cleanup step2 Dmitry Osipenko
2020-02-18 19:14     ` Dmitry Osipenko
     [not found]     ` <5d19876d-86a4-a461-f47a-68c7ba1f46ac-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-02-19  1:30       ` Kuninori Morimoto
2020-02-19  1:30         ` Kuninori Morimoto
2020-02-19 16:09       ` Pierre-Louis Bossart
2020-02-19 16:09         ` Pierre-Louis Bossart
     [not found]         ` <d60ccad5-9c52-551b-ae22-2815ab768a59-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2020-02-19 17:01           ` Kai Vehmanen
2020-02-19 17:01             ` Kai Vehmanen
     [not found]             ` <alpine.DEB.2.21.2002191900170.2957-cz35TXaqH4VICrp9aNEsHNh3ngVCH38I@public.gmane.org>
2020-02-19 17:03               ` Mark Brown
2020-02-19 17:03                 ` 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=applied-878slbceyg.wl-kuninori.morimoto.gx@renesas.com \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    /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.