Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1310079iof; Tue, 7 Jun 2022 03:04:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGStnRpbGNyJqf1q75z4Tm0mX3CShsO8v6RMXwVHVsVw370jeWVCgH0645QeKWA9AdTkJn X-Received: by 2002:a17:906:2c4d:b0:70f:ede5:d456 with SMTP id f13-20020a1709062c4d00b0070fede5d456mr17768776ejh.366.1654596262051; Tue, 07 Jun 2022 03:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654596261; cv=none; d=google.com; s=arc-20160816; b=0mZuMV9IMGY/jxnmlfyQll8APHr4uqHaA2OfR0Qphaqg4PFAyyMm9x1ycqxTQjNKLY YkthWx8h+Zd/uDP1TKKDtPU1a71UFCR5XzowNt3kHv2GDo0qBJMvL6du0iTpJqWzgzoB B7T87QhMfq3w0or7AGNYrJumg+RIVorb8JMXlmktJTKZQnpCt5u+qYDn2ME4YEPppaBe oN+LqfaD2CfaQegJ2W7m+tUDrxgZhj1a72jURLwQKZUImj/f5Qze+jowgtNBE5lsecR2 QTqABwfaq4C5bFGYxsB2S6KdJLdX/t0MWXfzwwWPTuJN5T3r0ItmggcTYa0j+OBc9AKe Si+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=wFhtVsGN1HTJ1mZICxKpHbze0AVrNeVWBgWZV3btKa4=; b=bM4S27B+6ShELl5ufNDNl230jsMloDcWRu7Ux5Q40Yz00gpq3fFoDJpkGC+P72SM5f Kt8N3FKKR9pSE19J/NrxgmhVS/hmnnHm8Stl6N2ktuESLK4RV8VFwPdMI2ox7ThoUyAL p3ShbcQdXGA8SsnIvA2wK+BWj4JBp7sSt1BYWl0MvfpK1Ke+jkMMZIpeG0st7Nb74Eq1 ha4dx88u41JGreLXUVPwFn2g9ia9MWXViisQ0zloxD6P0J72Mf4Q/IfpxNckmh0fEVnN MHE4iFjsKO/8b1Pz7FdJge7qDCTqArSA1vIimXclFUj3F8j/nfeeL07ILZoN0/dffWdI myXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be19-20020a0564021a3300b0042aa0dfeccasi15336873edb.354.2022.06.07.03.03.50; Tue, 07 Jun 2022 03:04:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbiFGHOj (ORCPT + 99 others); Tue, 7 Jun 2022 03:14:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbiFGHOi (ORCPT ); Tue, 7 Jun 2022 03:14:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21EBBB495; Tue, 7 Jun 2022 00:14:37 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LHM4t755QzbdCH; Tue, 7 Jun 2022 15:12:46 +0800 (CST) Received: from container.huawei.com (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 7 Jun 2022 15:14:34 +0800 From: Ziyang Xuan To: , , , , , , , , Subject: [PATCH net-next] SUNRPC: use max_t() to simplify open code Date: Tue, 7 Jun 2022 15:32:01 +0800 Message-ID: <20220607073201.237236-1-william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Use max_t() to simplify open code which uses "if...else" to get maximum of two values. Generated by coccinelle script: scripts/coccinelle/misc/minmax.cocci Signed-off-by: Ziyang Xuan --- net/sunrpc/xprt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 86d62cffba0d..756440abef94 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1811,10 +1811,7 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size, goto out_free; list_add(&req->rq_list, &xprt->free); } - if (max_alloc > num_prealloc) - xprt->max_reqs = max_alloc; - else - xprt->max_reqs = num_prealloc; + xprt->max_reqs = max_t(unsigned int, max_alloc, num_prealloc); xprt->min_reqs = num_prealloc; xprt->num_reqs = num_prealloc; -- 2.25.1