From patchwork Mon Jun 19 10:00:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Dong X-Patchwork-Id: 13287226 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 90F60EB64D7 for ; Wed, 21 Jun 2023 12:17:23 +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 A46D3820; Wed, 21 Jun 2023 14:16:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A46D3820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687349840; bh=6vGsZQVexYapOD1khjQTL75EZ2hmFFpasr9OmMwapGM=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=b4r5eguL350dgW4RXzuoSHbrL0vo61fgEq1LrUqdmNf70X7ddxxntNmE8Z9eiGIAu NSHQWzzOXFPBVRefRvd4zwp9R0jNk2e9vg+KUPoNH3kFB4xAyd1RKEENc7rfcn+hqB UFIJSZW5X4Q/FuHArZXMYmHQW5LqTPn/5DQC7NtQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 79B2AF805A8; Wed, 21 Jun 2023 14:15:20 +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 21C08F80580; Wed, 21 Jun 2023 14:15:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8544EF80301; Mon, 19 Jun 2023 12:02:01 +0200 (CEST) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2071d.outbound.protection.outlook.com [IPv6:2a01:111:f403:704b::71d]) (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 13282F80132 for ; Mon, 19 Jun 2023 12:01:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 13282F80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=vivo.com header.i=@vivo.com header.a=rsa-sha256 header.s=selector2 header.b=CI57wA8M ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h3hPzWHMYBvfewHET/bp7EOSpOYa7qoe0KZfo4qRVWUlJhIKhECfq6ZaMDjlESyjJdgZCj2CpdODmf+YOLIHCHOe5kTqhM5MFXjGkSHhOIjk68zvzNa7jI9tiXptjMpf15X8wzxJlsHszOOqO7ovVkcGGv5U4s5KG38S49j2KWWdVqGXvf4CBNitoq49T/JSg95XILUA985HxyoVlvhmGhAwmOxO6bd1UfVi2U9Wx8Fccr43wNuDvIUGSoNKwhgtYe2c3Ws7VFG9DbdnYuEyE+V6A+n8hzlcG6U1cm7cvlZbmMly0VYYt7CEoZxPKdS1spXCrGo7m4WwUAnhwqAkgg== 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=cMCL/Y+aVMyP7NQp7kmNAccAfxAz5lSgYXH2cDFWspM=; b=nfKjzSMfaeeru25IdI8vXbsGHlkDe/IjPHRpSd5xosj/cEsmVc/TSHZ36y8f/kO/c0dSC9UIA3C7lRqCJyURj57O9v9iRtK8Uwb9oZ0/wIVfN8tM/PCXH9WyDN/9YDkFbE6N71QWdqX3siL+wx+oUvyvNLVASsYez2cpWS73rTf3tKrYii96EUmvOULXmOO4RI3NMQ/K0WkeoqSbz7ksrd/BEVj/nDK0AQYr85SyX6CudryVIpYQTPDokR40/lfNdshiTaARstSITQXXA1IDHQPemysiVXjjlYEAiDZlJr939xlFl9iLPqjHb2BiwG8RH0qBwQ1JXhJ7NeBCk4JqJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cMCL/Y+aVMyP7NQp7kmNAccAfxAz5lSgYXH2cDFWspM=; b=CI57wA8M6qgu/+XgdGe1d8ixUc0iHJh7gK56pTILaB/I4jWvVu19MQCSQa8Bu15nfAvNu3bwDREcZ7vKn2VyQTFIMh5i6c92NlSS0GsrqHseQarlzpVN4Y5XsB0mlh2b77GZe2gfaMlQOYvu2aaS9+O7h8bTW6cbW8jTbItfgdx5Fy0bILx6/0+8AkQQEJcvOQ5T7Sduux9xKzcqjzQtKKf9GiW8ovVR8D/XIa4iCPaITaJ+yyiIYDSM6h3VSrS+qun+idZmuq6PXNth463M/rDKopHvoPXswYJxkzYrIHy/YySu80hMrxTwugL1RY3p1Gn8YCcNB8ICJ2OepQtclw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5022.apcprd06.prod.outlook.com (2603:1096:101:48::5) by SEZPR06MB6763.apcprd06.prod.outlook.com (2603:1096:101:180::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.30; Mon, 19 Jun 2023 10:01:45 +0000 Received: from SEZPR06MB5022.apcprd06.prod.outlook.com ([fe80::37cd:b3a2:1fee:705c]) by SEZPR06MB5022.apcprd06.prod.outlook.com ([fe80::37cd:b3a2:1fee:705c%6]) with mapi id 15.20.6500.031; Mon, 19 Jun 2023 10:01:45 +0000 From: Li Dong To: Walker Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, lidong@vivo.com Subject: [PATCH] sound: Fix traditional comparison using max/min method Date: Mon, 19 Jun 2023 18:00:37 +0800 Message-Id: <20230619100055.1680-1-lidong@vivo.com> X-Mailer: git-send-email 2.31.1.windows.1 X-ClientProxiedBy: TYAPR04CA0018.apcprd04.prod.outlook.com (2603:1096:404:15::30) To SEZPR06MB5022.apcprd06.prod.outlook.com (2603:1096:101:48::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5022:EE_|SEZPR06MB6763:EE_ X-MS-Office365-Filtering-Correlation-Id: e3b7d9e8-c911-4048-725f-08db70ac3083 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PzCxEKrs7cM1btU7l1Bv6Qd+2wvvIyxX3UT5pYvPX3kgZKoe+wOh2o4CBIaEUXo/Qa2l/3QdqR44xBh1vOLebP7R4KBHQ14E6PB3GaidnLjI5rZM60a7xCQ5mHzqCBzvXvuSyoCwuVC3HNARmW9/4V4yMyX70UI8gPE+JkohPx6WT2ORPqKW16w+gvhQvfT2f5UNA8MAhkRoXkoBpcO9Z3hfpLe8PuErff/tGSu6Sfnv8eKMn00pJQ++xHdUaXiCHV4PeLeekWfYu1hDzUyd0Vc5CTK32/Hdqm+mi3HN3BzRiQusywQinrVWDn7RT7PsysthkSjdIN2zxwy/0wLBwnIM60skwT8XlNWmW8k/xWe0tBue4cfvxPerkGhIrsDExh2FlcAvJ2oMF7t/qJtrMO+B5bE+CCtxVGgp+fmVsqUKQais15KpQjj3t9xKDk9AOoCKWYv3XM/1jIaoAGh7YhBEVASRI8sktyYIWVa8IW6Vjm0VeKTW3yhGvpee7xbX86VKZ56K5evILPcHf1UvjI5elSmW4dOQi8jF6wUZJPFkgihtL9iPxAJ+qtTw4KiiDrNClbSgOgrKstLkcaVZyWtYx1t2M85cC99AvRPpJSfrJH4qZlnkSaGv+FzM+sER X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5022.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199021)(83380400001)(2906002)(4744005)(2616005)(36756003)(86362001)(38350700002)(38100700002)(8676002)(8936002)(110136005)(478600001)(66556008)(107886003)(5660300002)(66946007)(66476007)(4326008)(41300700001)(6666004)(6486002)(52116002)(316002)(6506007)(186003)(6512007)(1076003)(26005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4uVwT3Ik9ku4aiabFevSy38nM7bUg9qc5GUDb0JHDJ1XFu7ztVnflDJT9SxDfQgpX9rCfAL1iPzAZSDtrmoQm+pb2Y4RTD1EqA7ogurSGx2lobVQI3Q7SXdcF0p0+gk+vVH+VLTtBY0EuUvwVEW0Se3oN9b+lDKLXRLYcaGhCoMVMEkXGqHlAngPVgL9LNpKOmPTN5fozYBoV2NWP/PYHpYpfM3TgolwUBZd5pGGLLtHfS5ZwBNYsen2csbNIXxyW0rHtCYTTSyXVxHrIKQN+7UA3FtnSr1Q+u1TMZo6KsKThRPlnPy+Xvc29vPIE6Zdv1mWBOWxpC4gpLfDDRqzKKH0h4WrSfeP/i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H8XRoPCNFgCPx9riQCVDBJibEdRuBd/xVEj7RU1ZD/PuzH1xukMcvWc80SM+wdmf7qoOkTwHuHIKm4NYl2/DhpToJyrs7gT+JqD6U9Rqyd+EefRRgYK65LG8048QUN17UTyqDJSJcFCa2b6HHSMKh0fTl X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3b7d9e8-c911-4048-725f-08db70ac3083 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5022.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2023 10:01:45.6864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HH5Qer7rRfgxvf8WqnKS7VJR6X2wkfK9fN1ZE/jHMcK4L4f4MJw7ezo8aM58KaM5qOFUHHpw49f+6cCJhD4rQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6763 X-MailFrom: lidong@vivo.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: S55A5GTANUK6ZLLUZ7PC4ZK7V4YHA5VL X-Message-ID-Hash: S55A5GTANUK6ZLLUZ7PC4ZK7V4YHA5VL X-Mailman-Approved-At: Wed, 21 Jun 2023 12:15:08 +0000 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: It would be better to replace the traditional ternary conditional operator with max()/min() Signed-off-by: Li Dong --- sound/soc/starfive/jh7110_tdm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c index 5f5a6ca7dbda..a17437dd8c3e 100644 --- a/sound/soc/starfive/jh7110_tdm.c +++ b/sound/soc/starfive/jh7110_tdm.c @@ -187,15 +187,8 @@ static int jh7110_tdm_syncdiv(struct jh7110_tdm_dev *tdm) { u32 sl, sscale, syncdiv; - if (tdm->rx.sl >= tdm->tx.sl) - sl = tdm->rx.sl; - else - sl = tdm->tx.sl; - - if (tdm->rx.sscale >= tdm->tx.sscale) - sscale = tdm->rx.sscale; - else - sscale = tdm->tx.sscale; + sl = max(tdm->rx.sl, tdm->tx.sl); + sscale = max(tdm->rx.sscale, tdm->tx.sscale); syncdiv = tdm->pcmclk / tdm->samplerate - 1;