From patchwork Tue May 30 00:49:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 686953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80763C7EE23 for ; Tue, 30 May 2023 00:51:36 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2B8BC3E8; Tue, 30 May 2023 02:50:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2B8BC3E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685407894; bh=TvTYotcr4ZOu144Ecmw/NtiyUw1IkWxrJ0GVFOaUoro=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=TSAMjarMPitOLiuWcJNHzyYeoSDHg0qAA+U5/PMOPs5t3dmDnY1KOcV4Lxt8TfuTS DX86JOX6nfaagLL+Ow3FZwfHNVPKE5ebQcOSQzR58BV5bAwKTsgKHDBeGF7MW4NAlQ efkEqtTN5dHCQo575/DM806F8d/1UEpWar8jkfxY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 412BDF8056F; Tue, 30 May 2023 02:50:18 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E47E7F8055C; Tue, 30 May 2023 02:50:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C25CF80567; Tue, 30 May 2023 02:50:02 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on20703.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::703]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BABD0F80563 for ; Tue, 30 May 2023 02:49:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BABD0F80563 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=renesas.com header.i=@renesas.com header.a=rsa-sha256 header.s=selector1 header.b=QC6rQII/ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=obA35xwTAaQ18WDVVKSmF+wCoGpOUaUMHqg+IDunUhGGxh96DrltYM++FUu06ozLCxd+6HrZYDSSR1F2j+a31EEyKy9XpwoknVSIX7qF8w7bDmwfyx13J3+Pi3woTiffc++5R+4JlmA3sG5c3V2H0WGP5O3wDgC+Nh4LtXlBvkBIqZ5w9DxAr2stPulH+kUAYuAV7ta5+lcpeDNZ5ThJHjHrUKT0NLFH2eubo7UR2oT1FdyfFbflFLE45SLiMDN5WEJyl664PHdQ6870yFOUpMFR/+OQH128b5OoDj2a66XdNWgrvwYqGRzDyljzumpqHyQ16juK2LqQ9XZuWNqprg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tbeDTQB35tZm8Y9PzzEs450v5znSklXmzYkAjOadlco=; b=UDZsMw2D2yzBBWkmm9vsB5fuG7FHBc6oCcEHVqAlojDWv//W8cHZkfic5yPn3fMuHP6WOgO5rf6MO0tFkhGCXbhnvaDgedjGc0XXCbs1dIvN6kvdvjNU7bLgZg3qM6I+Op5EDb65Qq3Vt+u6MDGqrGn40Hafen2WvoENJVFqF0gJPzgkt35TNvfgPmrTIg1x/+Im95LembCriBwVyTVymcJHo2rzQ5/GLxW9Z9avDQw38lwG5W1gFLUfYhqZ55Rbvs02Hib3QCh2PjveOWs9WgGgund77lwj5CpaZO0dsU4YukeE9MHYBq5+AaWxYI0StSDPP4i6QyAlBtrfxNr41A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tbeDTQB35tZm8Y9PzzEs450v5znSklXmzYkAjOadlco=; b=QC6rQII/cLfTtLVAcOFBHi0JLTMUYSjXwrGDcTXmrrBtWmRzNhiUhHnY9te/JZjAXXnpFdbRbRrFinCYLvRyUcjpp20dppO1N2jMEKKtS8WZcUNGTXAURFQgBQHjTWBm5h1TwcMgylcqo+8GUiwzxnareGTe1Dqq8t9MKYJKHoU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by OS7PR01MB11502.jpnprd01.prod.outlook.com (2603:1096:604:243::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Tue, 30 May 2023 00:49:51 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840%7]) with mapi id 15.20.6433.022; Tue, 30 May 2023 00:49:51 +0000 Message-ID: <87wn0qzlqp.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/5] ASoC: soc-pcm.c: use dai_link on soc_get_playback_capture() User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Mark Brown Cc: Linux-ALSA In-Reply-To: <87zg5mzlrc.wl-kuninori.morimoto.gx@renesas.com> References: <87zg5mzlrc.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 30 May 2023 00:49:50 +0000 X-ClientProxiedBy: TYXPR01CA0049.jpnprd01.prod.outlook.com (2603:1096:403:a::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS7PR01MB11502:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ba9e0d5-447f-451d-93fd-08db60a7c691 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5caEhtt7g57n/wnv03s8GbHgYsPJ5ogiWv6O4HgYkq6xUq3/7vB5HhEVTUEwc2CjLa7He/UhP/PxsCCa7hOXytTxO74akPQHZWI7N6OCdTQXX6deBq3n+XZE26IV1G0q2xT+GfqgqkI60OrHJ6oZA8B9FEILxnrHxLteHb/e0eNbo6kCcY5IhzauRZxeuo/hl0ejoSB0vNHSoG2lRR0vJxgqE/4lUIvtD668Jg5+14KjrwpZnip18X1YR1ucN/rqmxuuqZXXB4sxW1Jpt+Z1m8FOGlyn9Uy/v71JOO1Yh4Xge4H1kGlzQnaW6cgbDiERlK/9+K9jFL3UXDXRWWO5vuKDCYl3bsB6oQ0G82yVODjW9GIhrtwUQTFZbSSLoGox4dbX4Bba5nzKQzmWuRbPhTHaJMfWMYF72pytYazZG1pRFqczBT1dlg6QGIwaOv1M/7gATYOu/tpgUjsM0Gzuus2yb/mI8l4QUgtJk/Am6LhlvNFZB7g2G3OE6ZJc/vAu9+38Bv7Y1YgrRnRVU9ypEI6njM4AwmHd9XFC76Zr3ciZ7TRwvDv9k2sLkypTt6ySmkldVKxNbXmXkyTwO8qCOmEb2PTLt/MPBWS7x1GVVkKoQrbDV/7bN47infIP6JZHm8xD1ULD0XcjuPrsZH5ZlA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(366004)(346002)(39860400002)(396003)(136003)(451199021)(186003)(2616005)(38350700002)(38100700002)(41300700001)(83380400001)(6506007)(26005)(6512007)(6486002)(52116002)(478600001)(6916009)(4326008)(66476007)(66946007)(66556008)(316002)(5660300002)(8676002)(8936002)(2906002)(86362001)(36756003)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-2?q?ZFXi80dXdPXawq+Vj6XxbAe?= =?iso-8859-2?q?lBYfLQxyZH6bPb9V872AlJ2X3jnLRAtRdD5MyVqJf5goJTE2sCcD7WQKf3od?= =?iso-8859-2?q?C0R1VtXKUKl74D0IUyxP6voji5ZUI31Gqadl6CKwOoUMQCavk4XN2IVhYtW5?= =?iso-8859-2?q?ExOSJbQr5dJcmBIvzzAoQw8HPDZHoAy5kVgPkIirnVFl+et5H0JqMgT/uATR?= =?iso-8859-2?q?uLyyZJQb9PK5Nq//OP1xLUDB1ItmHCDT8IJ1Atd/ovICi2rXED3rzjf6D60Q?= =?iso-8859-2?q?fiQFzOhGw7g/DtFW52UxlJ58wLnwaqEI6ZEf6mKnzVAekbV6PoRr4gGskoYf?= =?iso-8859-2?q?cg83VBgmUHv19mag6ot1ggD8VAIpEfUoEP2HT9IAVwzfVRBSoA0yq9Pgc2w7?= =?iso-8859-2?q?apVK1+BcMGs7IYEr1uB09ldr3D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ZHH?= =?iso-8859-2?q?6xyyTyOv6/ateit27uactPfmZK6cosSItf0uY6laLblqh4QR82FfXT0PSQnR?= =?iso-8859-2?q?llWXKoG3TkuuESHNuInyTfbEVASYnerKPX5cZLT4bDBtCwdJLz7cLFp2ucl6?= =?iso-8859-2?q?6rudcZ/nNxX5JWu/IjaYK4WCKNxVYICzOz9drxWqwfWXkQWitM9SVcKS+iI0?= =?iso-8859-2?q?xBuc1Z8G1/2X1utJMBRqdT4bnTRdgX2Hk/v2uHoO6Rq1cb8T/ws7ftdndhvA?= =?iso-8859-2?q?85RRUipenAEIgmKkJ3jfsV3G6DsFmaLZVaKZWXULVyLUwM/bRfWNO/y6iHEF?= =?iso-8859-2?q?uHnAKnkjmT1YE6TlCC0jDXTnQncDW40lfbLVOD7eBt64FrokzSVi2YBbWaLE?= =?iso-8859-2?q?=3D?= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ba9e0d5-447f-451d-93fd-08db60a7c691 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2023 00:49:51.1382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SkTTyCXv6dSkT//4PizG8vk53tutJA65lGTI0aBax/gqARh/iWRu3tEP8dSquvunpN5pc9VHfpSyK2UA9Vq13CKBMDL/GJW+dPVRsWIAJweneM5rTZBvEk2/rR1SiRmy X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB11502 Message-ID-Hash: ZOUVEADF47ZLYKF3KST4U525DT26SB6I X-Message-ID-Hash: ZOUVEADF47ZLYKF3KST4U525DT26SB6I X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: soc_get_playback_capture() (A) is using rtd->dai_link->xxx everywhere. Because of that, 1 line is unnecessarily long and not readable. (A) static int soc_get_playback_capture(...) { if (rtd->dai_link->dynamic ...) { ^^^^^^^^^^^^^ ... } else { int cpu_capture = rtd->dai_link->c2c_params ? ^^^^^^^^^^^^^ ... } if (rtd->dai_link->playback_only) { ^^^^^^^^^^^^^ ... } ... } This patch uses variable "dai_link" to be clear code. Nothing changes the meanings. Signed-off-by: Kuninori Morimoto Reviewed-by: Amadeusz Sławiński --- sound/soc/soc-pcm.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index fe65994485f8..db3fbe1af2ce 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2731,19 +2731,20 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, int *playback, int *capture) { + struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai; int i; - if (rtd->dai_link->dynamic && rtd->dai_link->num_cpus > 1) { + if (dai_link->dynamic && dai_link->num_cpus > 1) { dev_err(rtd->dev, "DPCM doesn't support Multi CPU for Front-Ends yet\n"); return -EINVAL; } - if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { + if (dai_link->dynamic || dai_link->no_pcm) { int stream; - if (rtd->dai_link->dpcm_playback) { + if (dai_link->dpcm_playback) { stream = SNDRV_PCM_STREAM_PLAYBACK; for_each_rtd_cpu_dais(rtd, i, cpu_dai) { @@ -2755,11 +2756,11 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, if (!*playback) { dev_err(rtd->card->dev, "No CPU DAIs support playback for stream %s\n", - rtd->dai_link->stream_name); + dai_link->stream_name); return -EINVAL; } } - if (rtd->dai_link->dpcm_capture) { + if (dai_link->dpcm_capture) { stream = SNDRV_PCM_STREAM_CAPTURE; for_each_rtd_cpu_dais(rtd, i, cpu_dai) { @@ -2772,7 +2773,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, if (!*capture) { dev_err(rtd->card->dev, "No CPU DAIs support capture for stream %s\n", - rtd->dai_link->stream_name); + dai_link->stream_name); return -EINVAL; } } @@ -2780,15 +2781,15 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *codec_dai; /* Adapt stream for codec2codec links */ - int cpu_capture = rtd->dai_link->c2c_params ? + int cpu_capture = dai_link->c2c_params ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; - int cpu_playback = rtd->dai_link->c2c_params ? + int cpu_playback = dai_link->c2c_params ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; for_each_rtd_codec_dais(rtd, i, codec_dai) { - if (rtd->dai_link->num_cpus == 1) { + if (dai_link->num_cpus == 1) { cpu_dai = asoc_rtd_to_cpu(rtd, 0); - } else if (rtd->dai_link->num_cpus == rtd->dai_link->num_codecs) { + } else if (dai_link->num_cpus == dai_link->num_codecs) { cpu_dai = asoc_rtd_to_cpu(rtd, i); } else { dev_err(rtd->card->dev, @@ -2805,19 +2806,19 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, } } - if (rtd->dai_link->playback_only) { + if (dai_link->playback_only) { *playback = 1; *capture = 0; } - if (rtd->dai_link->capture_only) { + if (dai_link->capture_only) { *playback = 0; *capture = 1; } if (!*playback && !*capture) { dev_err(rtd->dev, "substream %s has no playback, no capture\n", - rtd->dai_link->stream_name); + dai_link->stream_name); return -EINVAL; }