From patchwork Mon Jan 9 20:01:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9505881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10609606E1 for ; Mon, 9 Jan 2017 20:20:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F36EA2847F for ; Mon, 9 Jan 2017 20:20:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E85E52851F; Mon, 9 Jan 2017 20:20:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1507F2852D for ; Mon, 9 Jan 2017 20:20:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C84D9266F2E; Mon, 9 Jan 2017 21:20:54 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E8E2D266EE9; Mon, 9 Jan 2017 21:18:34 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 94712266F15; Mon, 9 Jan 2017 21:01:35 +0100 (CET) Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 662F9266EE9 for ; Mon, 9 Jan 2017 21:01:33 +0100 (CET) Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cQg8F-0007s7-Hv; Mon, 09 Jan 2017 20:01:29 +0000 Received: from broonie by debutante with local (Exim 4.88) (envelope-from ) id 1cQg8C-0006rd-Rw; Mon, 09 Jan 2017 20:01:24 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <874m2074ls.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 09 Jan 2017 20:01:24 +0000 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: Linux-ALSA , Mark Brown , Lars-Peter , Simon Subject: [alsa-devel] Applied "ASoC: add for_each_component{_safe}" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: add for_each_component{_safe} has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 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 d75e460ad330518b56635cfccfba78c90ff0c9df Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 19 Dec 2016 07:37:57 +0000 Subject: [PATCH] ASoC: add for_each_component{_safe} To be more readable code, this patch adds new for_each_component macro. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/soc.h | 5 +++++ sound/soc/soc-core.c | 10 ++++------ sound/soc/soc-pcm.c | 5 ++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 1a4311da6126..b37b21a3471f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1193,6 +1193,11 @@ struct snd_soc_card { void *drvdata; }; +#define for_each_component(component, card) \ + list_for_each_entry(component, &(card)->component_dev_list, card_list) +#define for_each_component_safe(component, _component, card) \ + list_for_each_entry_safe(component, _component, \ + &(card)->component_dev_list, card_list) /* SoC machine DAI configuration, glues a codec and cpu DAI together */ struct snd_soc_pcm_runtime { diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 981443e444d1..9f2b9e1a1cee 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -703,7 +703,7 @@ int snd_soc_suspend(struct device *dev) snd_soc_dapm_sync(&card->dapm); /* suspend all COMPONENTs */ - list_for_each_entry(component, &card->component_dev_list, card_list) { + for_each_component(component, card) { struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); /* If there are paths active then the COMPONENT will be held with @@ -794,7 +794,7 @@ static void soc_resume_deferred(struct work_struct *work) cpu_dai->driver->resume(cpu_dai); } - list_for_each_entry(component, &card->component_dev_list, card_list) { + for_each_component(component, card) { if (component->suspended) { if (component->resume) component->resume(component); @@ -1764,7 +1764,7 @@ static int soc_probe_aux_devices(struct snd_soc_card *card) for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) { - list_for_each_entry(comp, &card->component_dev_list, card_list) { + for_each_component(comp, card) { if (!comp->auxiliary) continue; @@ -1790,9 +1790,7 @@ static void soc_remove_aux_devices(struct snd_soc_card *card) for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) { - list_for_each_entry_safe(comp, _comp, - &card->component_dev_list, card_list) { - + for_each_component_safe(comp, _comp, card) { if (!comp->auxiliary) continue; diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 1739573dcd6a..51927dc93c41 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2631,8 +2631,7 @@ static void soc_pcm_free(struct snd_pcm *pcm) struct snd_soc_pcm_runtime *rtd = pcm->private_data; struct snd_soc_component *component; - list_for_each_entry(component, &rtd->card->component_dev_list, - card_list) { + for_each_component(component, rtd->card) { if (component->pcm_free) component->pcm_free(pcm); } @@ -2753,7 +2752,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) if (capture) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); - list_for_each_entry(component, &rtd->card->component_dev_list, card_list) { + for_each_component(component, rtd->card) { if (component->pcm_new) { ret = component->pcm_new(rtd); if (ret < 0) {