From patchwork Fri May 20 09:40:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129325 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 F044860772 for ; Fri, 20 May 2016 11:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E283C200E7 for ; Fri, 20 May 2016 11:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D74D727BF4; Fri, 20 May 2016 11:50:35 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no 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 97B77200E7 for ; Fri, 20 May 2016 11:50:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F0F86266E36; Fri, 20 May 2016 13:50:31 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 88BE0266585; Fri, 20 May 2016 11:59:42 +0200 (CEST) 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 3804C26709A; Fri, 20 May 2016 11:59:41 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 1082526657F for ; Fri, 20 May 2016 11:40:46 +0200 (CEST) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie1.idc.renesas.com with ESMTP; 20 May 2016 18:40:44 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 4511443CCE; Fri, 20 May 2016 18:40:44 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 2FA732806E; Fri, 20 May 2016 18:40:44 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 2A9A32806D; Fri, 20 May 2016 18:40:44 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id UAU16167; Fri, 20 May 2016 18:40:44 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211272256" Received: from mail-hk2apc01lp0207.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.207]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:40:43 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FSHtVpxEBgVvGKnw7wFSQ8LpDxHOF0ckrN59gKzY9/I=; b=Nr9lTHCaFyo9TltRe4LwrwDpGQK/xdIacRz4gh2XKKpcSA8ryTpcjhmL+XK3woqufBhoK3JcA63xVlWOWoVjHvNev0We8Eg6DeU1a4+W/dWhuQUEOrNuOOmB9gWGx1HH/NALzj042K60iYOLNYk2yONj437KBzhbCBc/UoGxH4I= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR06MB1700.apcprd06.prod.outlook.com (10.167.73.14) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 20 May 2016 09:40:41 +0000 Message-ID: <87futdrs2g.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: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> References: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 20 May 2016 09:40:41 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0004.apcprd06.prod.outlook.com (10.164.91.14) To HK2PR06MB1700.apcprd06.prod.outlook.com (10.167.73.14) X-MS-Office365-Filtering-Correlation-Id: b6340477-bddb-4fa9-d18d-08d38092cf75 X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1700; 2:2Woz5ApwWssWdBmoSKOxjkpGV6djg6w3RDNb0fZiAo1PqeH0lB9u6i38I8uwZiD8NY9SR/knMX58OeUHu55IpgB45FQg4+z75kce8IptEhKM7vXMySz9IOiLPngnr/c6X3AedvJCSzB8FixNzdNh/ib2xWwZEszMKK4HzxMdRuWjelhJVkUlFr/vkr0ZR+n5; 3:IOFhbR5ey9QGE8LYpB8PBA6goIE+pQWjDI6D7GoeZp39wwW2BbYqrYRLCgTsaxeixWnfzPmMnFL9BOIActqpiISPUJM76+TFrGiVYiLRY5G0dcsRqubpwL/YC6tTpktB X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB1700; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1700; 25:mS7IToos+5iZO7W43FWoIT5yZCZmYqVG1xTdRrSVKyjHNjooCAz+1sP3ZR8hbvoF9SW99l6qVc0k6Isirt1l+L4c1LO8y031pHkBXB8YZVxHipKT6aAf4SseMc8y4R1W4G+DgM+tLLD4JU6QUqaPQ67FNnhvSQLNAIU9GakrDz/wVfWINtCatlzzAYLj+RWFsUEbk4SS9bDjsqSRWZippPtDKu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Z/d4weo8xF+Eg3G78vVliEnEYWLbCjLcQ11nI98b7i/ix0IJdTFvAOaNk7gcKmJW87SV3mci50jfBqeokmRdW0teGv37Nk+aOE9ImMjUmfZwvxxhYodmfJEk35yTuaYZdi25tGENGADG5VJNKllnzZZ4hQeRih4WkpfhrVjpfDsujc2Zq0W+GxxeLpcSRPcQVvKDxwhSpPLdnLW87r9/YFdrR07fe8+ckW3jvFnZWAjS6rulWYuUFKa0xTmktEVnP2Qgglg6XkyV4ApM3qzPk005zxgP7yLXQSsdavFdYZeo2+95zk0iMgPRq/ka8wk7G/Ov8903U6szGzl8/tpG6dTTD0yxAc+I9Mnt5oj/yfWxYH382IkGDtdoA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:HK2PR06MB1700; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB1700; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(19580405001)(19580395003)(110136002)(4326007)(2906002)(83506001)(33646002)(50466002)(229853001)(81166006)(2950100001)(36756003)(46406003)(92566002)(47776003)(54356999)(66066001)(189998001)(86362001)(53416004)(77096005)(5004730100002)(8676002)(50986999)(76176999)(5008740100001)(6116002)(42186005)(23726003)(3846002)(586003)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB1700; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1700; 23:u9SiMnhMV30e9/7R+g1lEvTfiqvhhuxS7JI36dQC8N8asBhVvj+E9UX+w81ydfm5GmMROBHQrrYtZUAqBvIP6GavSxdSxR6MiZlSMl518Q5AeYhTeodxyXh9guQ7222djvHlkgPdaQswqyMVn34QAzX+bVslXXV43TOhDpetKLlngqkB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wI7lq74C1Z7B9+/ofAMTiUhO8GUFglLYmdpotc3euj2gh68/oIqk7wE1oPyJojXyNM5mGfcV6w9zcbQB/RzTFF7jHodtmfPRKDCoXF+X8ry3plRpIkjs9vuyqMAy9WP4aQ5x1IE3YDhtiA0FLpLMNT5WUIRBUs2yGoCbWrWfTMj0TkhY; 20:Bwuk7e9OgeTXdHWCB04XDB+TzjP05Sjag737ihEqt4Bdxxei76oSqde5eKD2FwBjwPewk3m/JhDzY5rz2zLAc+fxPaHQsGzw5kZ1GKMMCawCOwZ93wHO4YE/BEveqvvNkOjjm0BmYP3ECu9Rz6iqYakI57RZyPYXJRlfuObCXkI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:40:41.9182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1700 Cc: linux-renesas-soc@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 04/49] ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of() 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 In current simple-card, platform is handled as special case, but, the code is not readable. This patch makes platform to use asoc_simple_card_sub_parse_of() Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index a542b71..f9fc686 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -221,6 +221,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np, u32 val; int ret; + if (!np) + return 0; + /* * Get node via "sound-dai = <&phandle port>" * it will be used as xxx_of_node on soc_bind_dai_link() @@ -236,9 +239,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np, *args_count = args.args_count; /* Get dai->name */ - ret = snd_soc_of_get_dai_name(np, name); - if (ret < 0) - return ret; + if (name) { + ret = snd_soc_of_get_dai_name(np, name); + if (ret < 0) + return ret; + } + + if (!dai) + return 0; /* Parse TDM slot */ ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask, @@ -372,21 +380,20 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err; + ret = asoc_simple_card_sub_parse_of(plat, NULL, + &dai_link->platform_of_node, + NULL, NULL); + if (ret < 0) + goto dai_link_of_err; + if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { ret = -EINVAL; goto dai_link_of_err; } - if (plat) { - struct of_phandle_args args; - - ret = of_parse_phandle_with_args(plat, "sound-dai", - "#sound-dai-cells", 0, &args); - dai_link->platform_of_node = args.np; - } else { - /* Assumes platform == cpu */ + /* Assumes platform == cpu */ + if (!dai_link->platform_of_node) dai_link->platform_of_node = dai_link->cpu_of_node; - } /* DAI link name is created from CPU/CODEC dai name */ name = devm_kzalloc(dev,