From patchwork Thu May 25 01:18:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 685678 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 595C1C77B7E for ; Thu, 25 May 2023 04:55:54 +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 6607E820; Thu, 25 May 2023 06:54:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6607E820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684990549; bh=gcIKwYrRMQ4qMItEAdRF4hYLNz1wlUbuVlb1E5AjHr8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hrJjxTnW43mp8uPM4mdWNI+RFHkdQstzEUVH9OSJLK+yqy51yrJ1eHLFvlhMKcnIQ 5gZOQK56BmROsiHaBP3ghs7A+4iM9F65hLOYVHNQM+YH2/I1SDx/GJxb0M1xtUQejf jM+5i/h9QmfMev1eBDRwwnZXmiLVsmgRCtCc7A9E= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 85E7EF80612; Thu, 25 May 2023 03:18:45 +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 09501F80609; Thu, 25 May 2023 03:18:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3528F805FE; Thu, 25 May 2023 03:18:39 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20716.outbound.protection.outlook.com [IPv6:2a01:111:f403:7010::716]) (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 D393BF805FB for ; Thu, 25 May 2023 03:18:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D393BF805FB 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=mdERlwcy ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qttrwvj13rPJZ0B8Gtj/EavxvLlAgRKgu7HTg1YOpuSh8UKZRWRPmkRhURPB+zZTt/hY1c5hW/zu+MzKgt+hJTcd14fmvlD/F0NMWZ/JGKR9k+kRJ6KkXjg1slahLjH9a3SXLbRuBD0Vnw013Z+/vrVvYZP4UflnUdqHHPzDoKyeVleRjaAYm2osPLQJTTx8XEIAR+ceAgCsRRE9DlSCKKkft63ahvISkcyb1V2GoJ1gEdbTlvZKue6K0UE/djE+EY/7XPQZJphqBA33JuLFYV/MT9ywdHNR2ibwOiqgJCjpatZqCUZBgJS34eKP0yGPHFUlBdBFoC5Lnz/llwEVGw== 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=2/UiBlKAyMuxYlsSkDYoNqnpynO7dVwmkDwhqHKiuu4=; b=cYToP0g+6Y+Ufrb3FAJRN21CxMQTejknyVRtbxZ2jgDgcc+SYdNcqvO2K2khskMWOCTRw4lSZgOUmX1PqD+wADIflBzrDqrXgt47tTY/cYVGW+/TtFVFoikEZVcMG0AzJN5YTEbOpoBVImjxe8xbkA7+VXNzKNcXv3bZp57wGkMhWN9UpvpxxC1Vqpv2ZMn0v7iUKzcwo9fFXi0eRYo1l5A9behB3T5o7mTUCwHjBEd2S7lveLO9FR+4jWjzg87NDJCHiry8IQXSr2ozHnQ8h/KW/iVrNgOvDEuoOIV70k444fhXa+XcwX9LnuWxiHf9lOkQVShJSNJBuXhJkV+BoA== 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=2/UiBlKAyMuxYlsSkDYoNqnpynO7dVwmkDwhqHKiuu4=; b=mdERlwcydsJrx1uw5MECU+0pHivnqDKlzWz+iEvNXGtGYXY5u8iEU9pLWzg5VY3XlaTAm6gFXU/BWxq9FZhkF/pDK+xEQP72CSR7qzsGR0AWxUmjbiV5aTWX7Mzbonuto6LBhQambVQKTJUAjbbex/WflqbxrWQHK08DA+SCbug= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB8440.jpnprd01.prod.outlook.com (2603:1096:400:15d::5) by TYCPR01MB8485.jpnprd01.prod.outlook.com (2603:1096:400:156::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 01:18:36 +0000 Received: from TYCPR01MB8440.jpnprd01.prod.outlook.com ([fe80::6c36:5ff9:24c9:e4f7]) by TYCPR01MB8440.jpnprd01.prod.outlook.com ([fe80::6c36:5ff9:24c9:e4f7%6]) with mapi id 15.20.6433.016; Thu, 25 May 2023 01:18:36 +0000 Message-ID: <87jzwxgqdw.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai Cc: alsa-devel@alsa-project.org Subject: [PATCH v2 07/21] ASoC: soc-pcm.c: cleanup normal connection loop at soc_get_playback_capture() part2 User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 In-Reply-To: <87ttw1gqgn.wl-kuninori.morimoto.gx@renesas.com> References: <87ttw1gqgn.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 25 May 2023 01:18:36 +0000 X-ClientProxiedBy: TYCP286CA0344.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38e::16) To TYCPR01MB8440.jpnprd01.prod.outlook.com (2603:1096:400:15d::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB8440:EE_|TYCPR01MB8485:EE_ X-MS-Office365-Filtering-Correlation-Id: 56794a33-2a14-4f0f-5086-08db5cbdf6e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3pKUxICSIwee2BgMLvVsf0Ya7vqeq4zJNd1HDPgWJrBcEFHE4l9Q92rVvhRs9sQr/0qnG1+HzunzrispHAL9i/Kw2AYYLACReTveUmABJByMGwLzu7N4MygaA4hi2dhmqWSbpL3/AONdHjwmIbwIwGcInUtOwsxY4NrLpiTI5QkiwTiX0VdLjxVfYG++C7Ym+Uzp9E/4OZLNKHeBn/hWg9tZFcLAdRWVvydDFuKvot5e0rKjmckI1msPhmpsL8xbibkS38/f86PmUhu8TMXoC8MFXCizC9kxQtadnKBPeCpqgMW2yperef0ItmYnt/cIN+1QZqS/rXQZw+5RBx/R3K2yQxuMbrrulVt0i8+f+kKcLKqrBHpObYlsDvUIZN0nG4sq3C6fBwRiHKrYQRvA2nx2zf5YlVlyLqSrRFQmtSXbkKY0i2kMsX8QFLsk8vcMlPpfQtALgQauP5fApEC23R85cjcoLdz4HFZr/LwA1LKq2Z9YwCNsvJn8Pu0UijpmM0GhTZH+/rIUXfk66XN2Po6gTZgyAWMKqx7tLKIEsmgDmzprVSLcN1r8Y3LmmAiFP3zLzZ0ZcsbHAWdVZC5x65MMFGnKFSwmGsR+XOmJOnBeZxrA/oA5H5V9JnLRizt3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB8440.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(376002)(39860400002)(366004)(346002)(451199021)(4326008)(83380400001)(66556008)(52116002)(66476007)(66946007)(6486002)(110136005)(2616005)(6512007)(26005)(6506007)(186003)(86362001)(2906002)(478600001)(8676002)(8936002)(5660300002)(36756003)(38350700002)(41300700001)(38100700002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-2?q?+fwOsGFDCeHqo4/5zUQaU7n?= =?iso-8859-2?q?ZV0q+mdXprMuMwOt47hZ6L49Nkv6oCfatw6F0+tcCrfmbhA0+sG+uYTkz+Pk?= =?iso-8859-2?q?aPKHSTB7RpO3WPaqiYbdaIFcECx8zAuSf2EayFxTk1kLU/4BxTzTTE8YSZmH?= =?iso-8859-2?q?xUUgXKWQgHC5IY4YZTKA3qD8qPdSTQLxNCdQNMUxuApazs8B0BUbHsffvR96?= =?iso-8859-2?q?ON6uDVRiCzjrByyfhRmtx/mFSOHZUaUMI2SidgTHcRcAr5kAPORlMZZf01Wo?= =?iso-8859-2?q?9Oj6JR2Y3ZHIjMR6NSaLwL/mi94FxdpeUl7MqF140b+ZtMz2wtpcvimBJDpt?= =?iso-8859-2?q?hAZHnvDhv7wNmqWzW7Yky9eEaH7GDBvVlFz0imjLotHTvTwbKZTO6yXZbX6L?= =?iso-8859-2?q?e4T6KfueUQ4eNpsjQT260//WvjY6yAF2eO2f6uZmN0Vhd/XY5Bq9FE57qopa?= =?iso-8859-2?q?h3HI9znjvUL/PyPhzIMwtWS+ehkNQgwHBgxiyRXOThqhNS3NobFewdWsSZRP?= =?iso-8859-2?q?U0cl9s/PkJUbbjjUil8qTF+xJzNy4ktY1kiWIepORvNQMw96HRDGeXeli+CH?= =?iso-8859-2?q?fBFLX3YWD4tAR28/SNLDO98dLp5g9yNqGnG3XSlEYV6IznJvrMZ9iueSzNAX?= =?iso-8859-2?q?shYvQItPj6daVsuAotkF0hywS9LayDRkrp0L/LDH4QHsojfw29by/3YRVgrq?= =?iso-8859-2?q?a9SRLoJKLLkAMW0m0PNZ5/hDFBufrb6rSt10l8e9syquXopMTWeCIzTarzqH?= =?iso-8859-2?q?USChC1CtjUEY8cXlWRxEPj9Z2s9ExINaolqxOXDAhhNMraKPncnJIUrYC7n8?= =?iso-8859-2?q?LgMAQrQgijTgQtS2q1eS0hBLbElKY2xD8EsCPyD5I8Cp1PiKakCfSMsoyL7N?= =?iso-8859-2?q?YKSJJZ/QV8I2KmAvdVQEYYavx6bpp7YS9AzJnGT+3gj3cEDihFNcvndgX+sv?= =?iso-8859-2?q?BEhQByC8gKdw8ayRFpw/cI9fduBxr0I0pk2N7lw4uiQgSvlea86EtDfXiiVs?= =?iso-8859-2?q?ZDwNmOy1V7CHa6ZwJ6OjYvMMZfVCVvZz+xuUqEXqQKKlhDldCUcX2TJxlSee?= =?iso-8859-2?q?mYsPxfBYl4WD8gFwWdodfYQVG8ggtKSbcM9thyTHtXdlb7fTK+RvKwQM9v4x?= =?iso-8859-2?q?EhOAjA3omg6lbDhZbFghLqOeR+OxzmRsCAyThvkrBCM6BcQp4cAPW9q6HukC?= =?iso-8859-2?q?jwxLpzuZaapdpMhy6JomQZ1SEobj2/8JTLvM7KLentS8HCekVkburU6EBhhG?= =?iso-8859-2?q?ha13smqIitVi7tW8VK9peF5TPwaOSMyk4ck/c4Hyj35Y1fTn7tLHDlJISbIB?= =?iso-8859-2?q?BjS0Uwn7KcKmIMRf8qDq9vnIqwem5cWIzKd+dtpAlRu/D7XxIssRravxaeCb?= =?iso-8859-2?q?LPqtA13KT0mMIbXPT9ZwIWMUgrMVCywM9gEVjmJwGGmg9uZknpFHq0XZI24f?= =?iso-8859-2?q?b8oKkoQ6QHja/Bpmy4yBWLkloIDwk+adag+B18LdRWrIwlV9TU1A+Rya0s8x?= =?iso-8859-2?q?ObbZdKnxa3wqXaLwdDUZXNVlB00y/Etx1SuG6PI6ojpHVJp6v/X5eYiPm5kU?= =?iso-8859-2?q?EmsAqH7N9HtXeixKRw2jns9pUL680cCH6H0CGfGNSvnhDtEvXY9WxnzOs9ho?= =?iso-8859-2?q?9EiKO2BV2L6v/pBI9G8emQn+Kusl+gHJmVvIXaT5I/tmvqdKR9LvOaI6c3KM?= =?iso-8859-2?q?=3D?= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56794a33-2a14-4f0f-5086-08db5cbdf6e1 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB8440.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 01:18:36.4828 (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: WuXAI4EFZQsexvZqBPvma7iH/WAEFKLn4CglcbwyIEZhUPO2+qDtLS5yAyyFkRNcKH81dsnYe1TFLJW9wOkTdG1uGFfR3SXG+txKYzk1ssnkt/ZDbX6cwybXzwNz8Qo8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB8485 Message-ID-Hash: 2NWRYLZRLYLS4QTP3RZMMEMCWZHSDXFA X-Message-ID-Hash: 2NWRYLZRLYLS4QTP3RZMMEMCWZHSDXFA 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 handling both DPCM (X) / Normal (Y) connection. (A) static int soc_get_playback_capture(...) { ... ^ if (dai_link->dynamic || dai_link->no_pcm) { (X) ... v ^ } else { | ... | for_each_rtd_codec_dais(rtd, i, codec_dai) { | if (dai_link->num_cpus == 1) { |(a) cpu_dai = ... (Y) } else if (dai_link->num_cpus == dai_link->num_codecs) { |(b) cpu_dai = ... | } | ... | } | ... v } ... } In Normal connection case (Y), it is checking number of CPU / Codec. (a) is for Single CPU case (b) is for Multi CPU case We can simply merge (a) and (b). Because it is doing same judgement, same operation. Signed-off-by: Kuninori Morimoto Reviewed-by: Amadeusz Sławiński --- sound/soc/soc-pcm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c95adf59cfe8..77552543dcb1 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2794,11 +2794,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; for_each_rtd_codec_dais(rtd, i, codec_dai) { - if (dai_link->num_cpus == 1) { - cpu_dai = asoc_rtd_to_cpu(rtd, 0); - } else if (dai_link->num_cpus == dai_link->num_codecs) { - cpu_dai = asoc_rtd_to_cpu(rtd, i); - } + cpu_dai = asoc_rtd_to_cpu(rtd, i); if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && snd_soc_dai_stream_valid(cpu_dai, cpu_playback))