From patchwork Fri Mar 13 01:22:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6000861 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 325919F318 for ; Fri, 13 Mar 2015 01:24:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CE7D2034A for ; Fri, 13 Mar 2015 01:24:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3A60620373 for ; Fri, 13 Mar 2015 01:24:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5DFE02604A1; Fri, 13 Mar 2015 02:24:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A75EF260425; Fri, 13 Mar 2015 02:23:10 +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 E553C260425; Fri, 13 Mar 2015 02:23:08 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id B01D6260429 for ; Fri, 13 Mar 2015 02:22:16 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 13 Mar 2015 10:22:14 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id B039A42F87; Fri, 13 Mar 2015 10:22:14 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id A79251806F; Fri, 13 Mar 2015 10:22:14 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 9F7AB1800A; Fri, 13 Mar 2015 10:22:14 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id LAA30176; Fri, 13 Mar 2015 10:22:14 +0900 X-IronPort-AV: E=Sophos;i="5.11,391,1422889200"; d="scan'208";a="182974739" Received: from mail-sg1lp0090.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.90]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 13 Mar 2015 10:22:13 +0900 Received: from morimoto-PC.renesas.com (211.11.155.132) by HKXPR06MB312.apcprd06.prod.outlook.com (10.141.135.155) with Microsoft SMTP Server (TLS) id 15.1.106.15; Fri, 13 Mar 2015 01:22:11 +0000 Message-ID: <87y4n1r8sx.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <874mppsngc.wl%kuninori.morimoto.gx@renesas.com> References: <874mppsngc.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 13 Mar 2015 01:22:11 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: TY1PR0201CA0035.apcprd02.prod.outlook.com (25.164.90.173) To HKXPR06MB312.apcprd06.prod.outlook.com (10.141.135.155) Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB312; X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(33646002)(36756003)(2950100001)(110136001)(77096005)(50466002)(92566002)(53416004)(122386002)(47776003)(54356999)(66066001)(19580395003)(83506001)(23726002)(42186005)(40100003)(76176999)(50986999)(87976001)(19580405001)(46102003)(46406003)(77156002)(86362001)(229853001)(62966003); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB312; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002009)(5005006); SRVR:HKXPR06MB312; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB312; X-Forefront-PRVS: 05143A8241 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2015 01:22:11.8416 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB312 Cc: Linux-ALSA , Simon , shiiba , Liam Girdwood , Das Biju Subject: [alsa-devel] [PATCH 03/13] ASoC: dapm: add snd_soc_dapm_route_scan macro for DAPM route 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto snd_soc_dapm_add_route() searches DAPM sink/source path for DAPM, but it is using unreadable raw code for complex path searching. This patch adds new snd_soc_dapm_route_scan() macro for it. Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b6f8820..d4b331d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2403,6 +2403,15 @@ err: return ret; } +#define snd_soc_dapm_route_scan(w, dapm, name, wnode, wtnode, node) \ +if (name && (!*wnode && !(strcmp(name, node)))) { \ + *wtnode = w; \ + if (w->dapm == dapm) \ + *wnode = w; \ + continue; \ +} + + static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route) { @@ -2433,17 +2442,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, * current DAPM context */ list_for_each_entry(w, &dapm->card->widgets, list) { - if (!wsink && !(strcmp(w->name, sink))) { - wtsink = w; - if (w->dapm == dapm) - wsink = w; - continue; - } - if (!wsource && !(strcmp(w->name, source))) { - wtsource = w; - if (w->dapm == dapm) - wsource = w; - } + snd_soc_dapm_route_scan(w, dapm, w->name, &wsource, &wtsource, source); + snd_soc_dapm_route_scan(w, dapm, w->name, &wsink, &wtsink, sink); } /* use widget from another DAPM context if not found from this */ if (!wsink)