From patchwork Wed Oct 2 10:56:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 11170761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D94916B1 for ; Wed, 2 Oct 2019 10:57:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B51721929 for ; Wed, 2 Oct 2019 10:57:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r2/ZnrDy"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="pH/hcB1e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B51721929 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:List-Owner; bh=FshCTDj/GI2oI1ooBQj360y1OnZsJuicbmaapGPo8Jw=; b=r2 /ZnrDyYuwZLDaUtbXrD6DOdUyxVRinXVajaAomUQi0M4CWldZwgckKRVXagFZLamUGfXng3VoSjrW uRPSBQH7oX0WrL/5dhiemTAbefMP9+99abt2B2bYwJRaE5O+Isv6HOGZG0KRWVFM7XN/eXTPpsRKz 7oC3dSZnXA9mhMxpeOBTdjRTcNGBMdfj4kKntXiznXQjD8tOzXb7XdYwFljWYpDMQJRV9l0wNI0E3 jBi2VjA2e9re3FAp3B3JTTvaVgsSBlnKhJkZ5o1xFAxlo4evyRnCRzJRnOC4Ff17fIFp3i//fajVE twfeNJEg1TdNCqLQuroxy2Q0QVsqc54Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFcJo-00020r-Cb; Wed, 02 Oct 2019 10:57:16 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFcJk-000205-S6 for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2019 10:57:14 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191002105705euoutp02169ef5d7fbf5abab7822fb1b9b6bf685~Jz0GdJ7JX2178521785euoutp02B for ; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191002105705euoutp02169ef5d7fbf5abab7822fb1b9b6bf685~Jz0GdJ7JX2178521785euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570013825; bh=TFmVNOfrv+yK5zpukqFg/VF/zWtyEJHig9qIFw+ejZU=; h=From:To:Cc:Subject:Date:References:From; b=pH/hcB1e4qA2LLqasiLhqGnj6pwvJZetAcDj9PXPC5TXagklUF7LJHroGSryDoe6c 4U9XsRHhsGchAp3zDPLwjTqFL7csSunJJlQNiLrsjOsHQUjYV/WNiT4L6VelFrBvfa NtpQoZbCkbrFi01dfKl5HdRHwh7+s/DFNqP+6Ems= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191002105705eucas1p1cc956a6b544e69b912bdd4913150bd64~Jz0GRd0OA1562815628eucas1p1R; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 86.86.04309.182849D5; Wed, 2 Oct 2019 11:57:05 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8~Jz0F6Fq1G1561615616eucas1p1J; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191002105705eusmtrp1ad55a810643357f673f36ea8cd3f8e49~Jz0F5PqA10038800388eusmtrp1W; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) X-AuditID: cbfec7f4-ae1ff700000010d5-ba-5d9482815aa9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4B.15.04117.182849D5; Wed, 2 Oct 2019 11:57:05 +0100 (BST) Received: from AMDC3061.DIGITAL.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191002105704eusmtip2b813a5bb473d4ee57442ca68cef4d2ad~Jz0FT-Nxg0110001100eusmtip2B; Wed, 2 Oct 2019 10:57:04 +0000 (GMT) From: Sylwester Nawrocki To: broonie@kernel.org Subject: [PATCH v4 1/3] ASoC: samsung: arndale: Simplify DAI link initialization Date: Wed, 2 Oct 2019 12:56:50 +0200 Message-Id: <20191002105652.24821-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-T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PWs FlMfPmGzuNK6idHi/PkN7BbfrnQwWWx6fI3VYsb5fUwWa4/cZbf4/H4/q8XhN+2sFhdXfGFy 4PHY8LmJzWPnrLvsHptWdbJ5bF5S7zF9zn9Gj74tqxg9Pm+SC2CP0rMpyi8tSVXIyC8usVWK NrQw0jO0tNAzMrHUMzQ2j7UyMlXSt7NJSc3JLEst0rdL0Mt49OMJa8Ff0YoX/5awNTDuF+pi 5OSQEDCR2LJjAxuILSSwlFHi5GvNLkYOoLiUxPwWJYgSYYk/17qASriASj4xSnz4+YMdJMEm YCjRe7SPEcQWERCTuD2nkxmkiFngGpPEplmPWUASwgIBEi1PlrCC2CwCqhJta9+CxXkFrCVu 9pxihNggL7F6wwHmCYw8CxgZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgSG8bZjP7fsYOx6 F3yIUYCDUYmHtyFocqwQa2JZcWXuIUYJDmYlEV6bP5NihXhTEiurUovy44tKc1KLDzGaAi2f yCwlmpwPjLG8knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6YklqdmpqQWpRTB9TBycUg2MUW/4 NxR4z3F/f9orQ4HLVr+AQ92uLn/+xidWz4S4K/2kBX6qbQrYEq/Gayy0xPWRog+HsPt5UTbN WpF8jbXvUiw67ue9/bfwstuvma4Lsy+15x5cqv9tW2bfxWWMs/Ved9ipCBu8tnG7ov45KJPn 2KomD5Og7+8FHt9ZI526uqZGs9Xi9zslluKMREMt5qLiRACtDIJreQIAAA== X-CMS-MailID: 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8 X-Msg-Generator: CA X-RootMTR: 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191002_035713_042371_36185777 X-CRM114-Status: GOOD ( 14.60 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, ckeepax@opensource.cirrus.com, b.zolnierkie@samsung.com, sbkim73@samsung.com, patches@opensource.cirrus.com, lgirdwood@gmail.com, krzk@kernel.org, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There is only one DAI link so we can drop an unnecessary loop statement. Use card->dai_link in place of direct static arndale_rt5631_dai[] array dereference as a prerequisite for adding support for other CODECs. Unnecessary assignment of dai_link->codecs->name to NULL is removed. Reviewed-by: Charles Keepax Acked-by: Krzysztof Kozlowski Signed-off-by: Sylwester Nawrocki --- Based on for-next branch from git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound Changes since v2: - none. Changes since v1: - rebased due to reordering patches in the series --- sound/soc/samsung/arndale_rt5631.c | 42 +++++++++++++----------------- 1 file changed, 18 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c index fd8c6642fb0d..004c84fafad9 100644 --- a/sound/soc/samsung/arndale_rt5631.c +++ b/sound/soc/samsung/arndale_rt5631.c @@ -88,36 +88,30 @@ static void arndale_put_of_nodes(struct snd_soc_card *card) static int arndale_audio_probe(struct platform_device *pdev) { - int n, ret; struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &arndale_rt5631; + struct snd_soc_dai_link *dai_link; + int ret; card->dev = &pdev->dev; + dai_link = card->dai_link; + + dai_link->cpus->of_node = of_parse_phandle(np, "samsung,audio-cpu", 0); + if (!dai_link->cpus->of_node) { + dev_err(&pdev->dev, + "Property 'samsung,audio-cpu' missing or invalid\n"); + return -EINVAL; + } - for (n = 0; np && n < ARRAY_SIZE(arndale_rt5631_dai); n++) { - if (!arndale_rt5631_dai[n].cpus->dai_name) { - arndale_rt5631_dai[n].cpus->of_node = of_parse_phandle(np, - "samsung,audio-cpu", n); - - if (!arndale_rt5631_dai[n].cpus->of_node) { - dev_err(&pdev->dev, - "Property 'samsung,audio-cpu' missing or invalid\n"); - return -EINVAL; - } - } - if (!arndale_rt5631_dai[n].platforms->name) - arndale_rt5631_dai[n].platforms->of_node = - arndale_rt5631_dai[n].cpus->of_node; - - arndale_rt5631_dai[n].codecs->name = NULL; - arndale_rt5631_dai[n].codecs->of_node = of_parse_phandle(np, - "samsung,audio-codec", n); - if (!arndale_rt5631_dai[0].codecs->of_node) { - dev_err(&pdev->dev, + if (!dai_link->platforms->name) + dai_link->platforms->of_node = dai_link->cpus->of_node; + + dai_link->codecs->of_node = of_parse_phandle(np, "samsung,audio-codec", 0); + if (!dai_link->codecs->of_node) { + dev_err(&pdev->dev, "Property 'samsung,audio-codec' missing or invalid\n"); - ret = -EINVAL; - goto err_put_of_nodes; - } + ret = -EINVAL; + goto err_put_of_nodes; } ret = devm_snd_soc_register_card(card->dev, card);