From patchwork Tue Jun 27 04:31:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You Kangren X-Patchwork-Id: 697925 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21972EB64DC for ; Tue, 27 Jun 2023 04:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbjF0EcJ (ORCPT ); Tue, 27 Jun 2023 00:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjF0EcI (ORCPT ); Tue, 27 Jun 2023 00:32:08 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2136.outbound.protection.outlook.com [40.107.215.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89B601722; Mon, 26 Jun 2023 21:32:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ToElSDEa79UP4dqPih7Zon4CYoJlbsuarI8e56gOihp0Gq1blApnBwFpp4pAXEotSIjwWT4Ap1AxwpUsFA+woWJ8XtEhf35EKHfVxtAZ6tdD7lV59MOoN7oaU7jzucZaKT7sdxTGO5GgEzdjDpjJevJ79Ypryb02iT5ZNwin71JdHzpTSRt5NpjfiMnd0sSjack0ll8L34vEyveMlT6ksa8ctwVrj4PoHMbjcPVt155Wdy5oI+qoMAXQ6ecDdn80S1HPOEVzIqyEfYPWUPh/c9uyyVl+Ec6Z56l48oTi02JyL95irDMeKZEomzfJBUns/w0TSVUTovYhw/sBzHVV6Q== 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=betZCjBxzsWL0zBA0FvXhU3lDxARtS9ipzzCrPZXR9k=; b=lbtJtnkox1ElgWbbxTvMmV7Wc5zjYkp/cIm81C4w01uxvs3S26O9IVZ/2mdZsXzFukxks2lDq1D2p9TufxiJqlRrBpHhhFNBl+m3C2CFCTAZJmmllumLlPGj21ZiDXAL3sfybYrBNdB5dpAUNWyy3qCV8L7ksRmrn3p0tZHsz+mGyTm17Xg78SbwLswbjjC1Frd7qnJXnemsQk4Kkr/zf3U3sCLySk5A7yKYBBTRbQvfamON7Hi7gwDzTgoG/iHUpUxRhAjxIaoHrkDgmKwSPw1Nl6Dfc6M4XQqt/jL2uB61pzhXK8GOa/PhgfKEkAs8EMkBGnkN66KI5b/X0V+Vdw== 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=betZCjBxzsWL0zBA0FvXhU3lDxARtS9ipzzCrPZXR9k=; b=Cg40035wG7FvcWkTaTRgMr9xR5QGLknK0v3nVdDynOKsEEH9Gl4c/Vz8a08Bd7FOvy8Uaq+/TI/CO2BHptgNOGZA3QtsFH7UoyVZSPEETqDUnDjdWYGRQm+9v1o4BdX6vJR8DhR+KAbSP3rDMU71++RLCP9ealGo4UdTRS6zPuimQicmAdo8/y7R3x3cEcizczz8RoJhKRDIi66DQMIeuLoke5sAl+Xte/Dg7qPln+W550FY5StfC6qRbMpKXqgpzj1KznXNFRZiViV5wreqBStXxnl3hwMlAWUuz1BPLbSrIULaSOB7gj7AGWYooMe3GvNxEZwu8QGrTvjOoTsv6g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) by SEYPR06MB6397.apcprd06.prod.outlook.com (2603:1096:101:143::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Tue, 27 Jun 2023 04:31:58 +0000 Received: from PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b]) by PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b%6]) with mapi id 15.20.6500.045; Tue, 27 Jun 2023 04:31:58 +0000 From: You Kangren To: Kalle Valo , Dongliang Mu , You Kangren , Simon Horman , Christophe JAILLET , linux-wireless@vger.kernel.org (open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com Subject: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() Date: Tue, 27 Jun 2023 12:31:48 +0800 Message-Id: <20230627043151.19576-1-youkangren@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TYAPR04CA0015.apcprd04.prod.outlook.com (2603:1096:404:15::27) To PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5936:EE_|SEYPR06MB6397:EE_ X-MS-Office365-Filtering-Correlation-Id: c570b84d-ba9c-472e-140d-08db76c7719a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QT2CCVUeHFOh8XVrS+aabQxxciC9PEZBvdTsyLe/5BGi3AU2i2NMgLaERKrhuwf4lGkFz90vpij9hVTR6mySq6SgBpM3ZZ60OkAGCSQ2yX8Cm9gwrwSkiAxrRPq5EYtPCtff7lmH+q3AnGdDdPwFyHEPYKrAnzKG05x4+PQRN0xwSTpY+TzS6j5HMAnMVBcnOhX1wnHolsFibzHypd/6g6556pgfsOAZOe6VpCh0npafzb6DEu44/PFIgyVP47kQAIwCBRILpFXoS7RGjkNUY/a/D8YU74meyfutOYVV7SdzWZVTrDyp9+Fr7zjH3Bv1rt8MHLErXSUaKW4PFlRKR0hqUyxdk5wCcXP21o5hOo+3lgYyd0b3VLptPNe+d7gjGKie87JBUjkDk3uDAVVAaeFsVfiV8+vpZv1cT5vxsYKnN66QNrm2bKkZtoGJPLNq9TcrtIVUrVafAuWnZAKBmjfbIWGuI9rIC8CAUYav6Q8REJKhFREI5dAKf4tku/oECHbgP6AH83Mf+FQ50GbvwAwu+oL2uDlfnwJDjj3zjoplWTdbMQ251+rZXqin+TMBfGTzoNv9cpp0RSasNpNAJhA6r24DcKA9b3SFhha3CLJCmVW8Y+s5BJsOlQRdviCJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PUZPR06MB5936.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(346002)(39860400002)(376002)(451199021)(26005)(36756003)(5660300002)(4326008)(66946007)(41300700001)(8936002)(66556008)(66476007)(86362001)(38350700002)(38100700002)(316002)(8676002)(107886003)(6486002)(2906002)(4744005)(6506007)(1076003)(6512007)(186003)(6666004)(52116002)(478600001)(83380400001)(2616005)(110136005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rLwZAnsI6x91lieS3exwsUFy3bfk3VBVaLGkArWnRNEEjhv1wAY1PDr2FKmBl6POkNWsdI1OM30e40GiEG/Q241MEgtD6+0NHh9na32eI2sncSVKeWxYf3sAJFvxTmTlCzlTujLpWg2xJBQ+onuACpVvRUPnKrNbIjt9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s61ZjQBG0nwaEeqBp43LxIb6Mxx03LwKCHhDO+JOlkVJ4YCs40Fx1BOSdhmL0b5YmjmfuCVheLGC7zRokOT1sDsYwhNKzxOIreTU/9Zd8FLypz20V4xLVc6ekPlqQxWE47t7AerxLD2SriZ4k38CtMHCHyBeUKqHGe4fICQ61TVaVkKTFmYh7TjAIJoJy4vFrDCGBY/US+Q8XUtZQOW0drS1hAEJyDXj8Yqvl0qSX0IX8EjadhoczdN3H77NNUhX/BDN/S1iHwc+PS+q7Di2MaLIYILnBeHqyNsK6yxQqlzNP1qbGGmap4rJcanJfrDN7w6K6DbQPllWOgF2PEA3+5D4TyacfYpnosZnXaaBB3/j9by X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c570b84d-ba9c-472e-140d-08db76c7719a X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5936.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2023 04:31:58.1950 (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: WjUSo/xjEaDBanG1h8+OdZbYaZKuosR4Cqc6atietp3Ra4YIkAAwE+PVSIud4wTPy57olzwbgEqcFuMrM7Y9fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6397 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Replace the ternary conditional operator with min_t() to simplify the code Signed-off-by: You Kangren --- drivers/net/wireless/legacy/ray_cs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c index 8ace797ce951..25edbc655738 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, rx_data(dev, prcs, pkt_addr, rx_len); copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr, - rx_len < sizeof(struct beacon_rx) ? - rx_len : sizeof(struct beacon_rx)); + min_t(size_t, rx_len, sizeof(struct beacon_rx)); local->beacon_rxed = 1; /* Get the statistics so the card counters never overflow */