From patchwork Sat Aug 24 07:40:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976382 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wrbs157qQz1yg8 for ; Sat, 24 Aug 2024 22:31:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B42FC60680; Sat, 24 Aug 2024 12:31:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vP5bHaTfbOgl; Sat, 24 Aug 2024 12:31:11 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 67A9C60602 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 67A9C60602; Sat, 24 Aug 2024 12:31:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0FF17C07E8; Sat, 24 Aug 2024 12:31:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 551AAC07E6 for ; Sat, 24 Aug 2024 07:50:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 37C426062D for ; Sat, 24 Aug 2024 07:50:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JrMFYDF9spi7 for ; Sat, 24 Aug 2024 07:50:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.35; helo=szxga07-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 8F92E605C7 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8F92E605C7 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8F92E605C7 for ; Sat, 24 Aug 2024 07:50:12 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WrTDz2mT4z1S8mL; Sat, 24 Aug 2024 15:33:07 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id EFF2D1402D0; Sat, 24 Aug 2024 15:33:13 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:13 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:26 +0800 Message-ID: <20240824074033.2134514-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 1/8] net/mac80211: use max to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The following Coccinelle/coccicheck warning reported by minmax.cocci: WARNING opportunity for max() Let's use max() to simplify the code and fix the warning. Signed-off-by: Hongbo Li --- net/mac80211/driver-ops.h | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/scan.c | 6 ++---- net/mac80211/tdls.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index d382d9729e85..6b75c7eeff25 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -971,7 +971,7 @@ drv_mgd_protect_tdls_discover(struct ieee80211_local *local, return; WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); - link_id = link_id > 0 ? link_id : 0; + link_id = max(link_id, 0); trace_drv_mgd_protect_tdls_discover(local, sdata); if (local->ops->mgd_protect_tdls_discover) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 4779a18ab75d..60a7631f0457 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5375,7 +5375,7 @@ ieee80211_determine_our_sta_mode_auth(struct ieee80211_sub_if_data *sdata, struct ieee80211_conn_settings *conn) { ieee80211_determine_our_sta_mode(sdata, sband, NULL, wmm_used, - req->link_id > 0 ? req->link_id : 0, + max(req->link_id, 0), conn); } diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index b5f2df61c7f6..e77c9f07b046 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -1013,10 +1013,8 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, */ if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)) || !scan_req->n_ssids) { - *next_delay = msecs_to_jiffies(scan_req->duration) > - IEEE80211_PASSIVE_CHANNEL_TIME ? - msecs_to_jiffies(scan_req->duration) : - IEEE80211_PASSIVE_CHANNEL_TIME; + *next_delay = max(msecs_to_jiffies(scan_req->duration), + IEEE80211_PASSIVE_CHANNEL_TIME); local->next_scan_state = SCAN_DECISION; if (scan_req->n_ssids) set_bit(SCAN_BEACON_WAIT, &local->scanning); diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index f07b40916485..719739def96c 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -919,7 +919,7 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, int ret; struct ieee80211_link_data *link; - link_id = link_id >= 0 ? link_id : 0; + link_id = max(link_id, 0); rcu_read_lock(); link = rcu_dereference(sdata->link[link_id]); if (WARN_ON(!link)) From patchwork Sat Aug 24 07:40:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976384 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wrbs45J8dz1yg8 for ; Sat, 24 Aug 2024 22:31:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 402626066A; Sat, 24 Aug 2024 12:31:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 49gv57e-GDmb; Sat, 24 Aug 2024 12:31:13 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 365106067D Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 365106067D; Sat, 24 Aug 2024 12:31:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 97A1DC07E9; Sat, 24 Aug 2024 12:31:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 35967C07E6 for ; Sat, 24 Aug 2024 07:50:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 254A1605C7 for ; Sat, 24 Aug 2024 07:50:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TSDTw8V2M2Qz for ; Sat, 24 Aug 2024 07:50:42 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.187; helo=szxga01-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 38D10605BA Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 38D10605BA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by smtp3.osuosl.org (Postfix) with ESMTPS id 38D10605BA for ; Sat, 24 Aug 2024 07:50:41 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WrTDc2YLszyR2M; Sat, 24 Aug 2024 15:32:48 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 25D0B1800A5; Sat, 24 Aug 2024 15:33:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:13 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:27 +0800 Message-ID: <20240824074033.2134514-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 2/8] net/rds: Use max() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The target if-else can be replaced with max(). Signed-off-by: Hongbo Li Reviewed-by: Allison Henderson --- net/rds/info.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/rds/info.c b/net/rds/info.c index b6b46a8214a0..8558b0a466b4 100644 --- a/net/rds/info.c +++ b/net/rds/info.c @@ -194,10 +194,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, } ret = pin_user_pages_fast(start, nr_pages, FOLL_WRITE, pages); if (ret != nr_pages) { - if (ret > 0) - nr_pages = ret; - else - nr_pages = 0; + nr_pages = max(ret, 0); ret = -EAGAIN; /* XXX ? */ goto out; } From patchwork Sat Aug 24 07:40:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wrbs44DCHz1yfF for ; Sat, 24 Aug 2024 22:31:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AEE5C40498; Sat, 24 Aug 2024 12:31:18 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9dbP62a8S6lH; Sat, 24 Aug 2024 12:31:17 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org F196D40482 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id F196D40482; Sat, 24 Aug 2024 12:31:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F338BC07E9; Sat, 24 Aug 2024 12:31:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 255D4C07E6 for ; Sat, 24 Aug 2024 07:52:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 13D9D81EC4 for ; Sat, 24 Aug 2024 07:52:06 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yZL1WFCLPn6h for ; Sat, 24 Aug 2024 07:52:05 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.191; helo=szxga05-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 2719781EC3 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2719781EC3 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2719781EC3 for ; Sat, 24 Aug 2024 07:52:04 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WrT9M0qtHz1HGkR; Sat, 24 Aug 2024 15:29:59 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 540731A016C; Sat, 24 Aug 2024 15:33:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:28 +0800 Message-ID: <20240824074033.2134514-4-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 3/8] net/ipv4: Use min() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The following Coccinelle/coccicheck warning reported by minmax.cocci: WARNING opportunity for min() Let's use min() to simplify the code and fix the warning. Signed-off-by: Hongbo Li --- net/ipv4/ip_sockglue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index cf377377b52d..f35aba4c3b0e 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -282,7 +282,7 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc, /* Our caller is responsible for freeing ipc->opt */ err = ip_options_get(net, &ipc->opt, KERNEL_SOCKPTR(CMSG_DATA(cmsg)), - err < 40 ? err : 40); + min(40, err)); if (err) return err; break; From patchwork Sat Aug 24 07:40:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WrbsB4JtQz1yfF for ; Sat, 24 Aug 2024 22:31:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C2C7F4064C; Sat, 24 Aug 2024 12:31:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id rpqE49M6rXBd; Sat, 24 Aug 2024 12:31:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EB1AD403C9 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id EB1AD403C9; Sat, 24 Aug 2024 12:31:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A500FC07E9; Sat, 24 Aug 2024 12:31:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D6D05C07E6 for ; Sat, 24 Aug 2024 07:53:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1BBD040213 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qfhpkSU3vSUq for ; Sat, 24 Aug 2024 07:53:10 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.188; helo=szxga02-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org E788640214 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E788640214 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by smtp4.osuosl.org (Postfix) with ESMTPS id E788640214 for ; Sat, 24 Aug 2024 07:53:09 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WrTCG5W2QzpStD; Sat, 24 Aug 2024 15:31:38 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 8024414035E; Sat, 24 Aug 2024 15:33:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:29 +0800 Message-ID: <20240824074033.2134514-5-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 4/8] net/core: Use min()/max() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Let's use min()/max() to simplify the code and fix the Coccinelle/coccicheck warning. Signed-off-by: Hongbo Li --- net/core/pktgen.c | 6 ++---- net/core/sock.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index ea55a758a475..5d4d5ec4a126 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2793,8 +2793,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, } i = 0; - frag_len = (datalen/frags) < PAGE_SIZE ? - (datalen/frags) : PAGE_SIZE; + frag_len = min(datalen/frags, PAGE_SIZE); while (datalen > 0) { if (unlikely(!pkt_dev->page)) { int node = numa_node_id(); @@ -2811,8 +2810,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, if (i == (frags - 1)) skb_frag_fill_page_desc(&skb_shinfo(skb)->frags[i], pkt_dev->page, 0, - (datalen < PAGE_SIZE ? - datalen : PAGE_SIZE)); + min(datalen, PAGE_SIZE)); else skb_frag_fill_page_desc(&skb_shinfo(skb)->frags[i], pkt_dev->page, 0, frag_len); diff --git a/net/core/sock.c b/net/core/sock.c index bbe4c58470c3..c9910f48903f 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3800,7 +3800,7 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot) for_each_possible_cpu(cpu) res += per_cpu_ptr(net->core.prot_inuse, cpu)->val[idx]; - return res >= 0 ? res : 0; + return max(res, 0); } EXPORT_SYMBOL_GPL(sock_prot_inuse_get); From patchwork Sat Aug 24 07:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wrbs1520Yz1yfF for ; Sat, 24 Aug 2024 22:31:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9A775402A8; Sat, 24 Aug 2024 12:31:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id O02HGhBu64yY; Sat, 24 Aug 2024 12:31:10 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 233E64016D Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 233E64016D; Sat, 24 Aug 2024 12:31:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B6264C07E7; Sat, 24 Aug 2024 12:31:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA2C8C07E6 for ; Sat, 24 Aug 2024 07:50:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CFF35402ED for ; Sat, 24 Aug 2024 07:50:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id jV__ES3T6DqO for ; Sat, 24 Aug 2024 07:50:12 +0000 (UTC) X-Greylist: delayed 1013 seconds by postgrey-1.37 at util1.osuosl.org; Sat, 24 Aug 2024 07:50:11 UTC DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4F277402EC Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4F277402EC Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.190; helo=szxga04-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4F277402EC for ; Sat, 24 Aug 2024 07:50:11 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WrTF04xnwz2CnRb; Sat, 24 Aug 2024 15:33:08 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id AB74B14013B; Sat, 24 Aug 2024 15:33:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:30 +0800 Message-ID: <20240824074033.2134514-6-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 5/8] net/dccp: Use min()/max() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Let's use min()/max() to simplify the code and fix the Coccinelle/coccicheck warning reported by minmax.cocci. Signed-off-by: Hongbo Li --- net/dccp/ackvec.c | 2 +- net/dccp/dccp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 1cba001bb4c8..faadd0190107 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c @@ -305,7 +305,7 @@ void dccp_ackvec_clear_state(struct dccp_ackvec *av, const u64 ackno) * Deal with overlapping Ack Vectors: don't subtract more than the * number of packets between tail_ackno and ack_ackno. */ - eff_runlen = delta < avr->avr_ack_runlen ? delta : avr->avr_ack_runlen; + eff_runlen = min(delta, avr->avr_ack_runlen); runlen_now = dccp_ackvec_runlen(av->av_buf + avr->avr_ack_ptr); /* diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 1f748ed1279d..872d17fb85b5 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -149,7 +149,7 @@ static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp) WARN_ON(delta < 0); delta -= ndp + 1; - return delta > 0 ? delta : 0; + return max(delta, 0); } /** From patchwork Sat Aug 24 07:40:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wrbs94GHbz1yfF for ; Sat, 24 Aug 2024 22:31:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DF2D760715; Sat, 24 Aug 2024 12:31:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KTc-XCDXrgsM; Sat, 24 Aug 2024 12:31:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 66D4E606CA Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 66D4E606CA; Sat, 24 Aug 2024 12:31:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 125E0C07EB; Sat, 24 Aug 2024 12:31:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 268BCC07E6 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0766640251 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HMBagl18f4EH for ; Sat, 24 Aug 2024 07:53:10 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.188; helo=szxga02-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org E782740213 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E782740213 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by smtp4.osuosl.org (Postfix) with ESMTPS id E782740213 for ; Sat, 24 Aug 2024 07:53:09 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WrTCH0nRhzpSw1; Sat, 24 Aug 2024 15:31:39 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id D2A86140202; Sat, 24 Aug 2024 15:33:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:31 +0800 Message-ID: <20240824074033.2134514-7-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 6/8] net/openvswitch: Use max() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Let's use max() to simplify the code and fix the Coccinelle/coccicheck warning reported by minmax.cocci. Signed-off-by: Hongbo Li Acked-by: Eelco Chaudron Reviewed-by: Aaron Conole --- net/openvswitch/vport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 8732f6e51ae5..859208df65ea 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -534,7 +534,7 @@ static int packet_length(const struct sk_buff *skb, * account for 802.1ad. e.g. is_skb_forwardable(). */ - return length > 0 ? length : 0; + return max(length, 0); } void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto) From patchwork Sat Aug 24 07:40:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WrbsC3vYLz1yfF for ; Sat, 24 Aug 2024 22:31:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 35382606D9; Sat, 24 Aug 2024 12:31:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id cossU0YHrlPN; Sat, 24 Aug 2024 12:31:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5F698606F1 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5F698606F1; Sat, 24 Aug 2024 12:31:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 09015C07EB; Sat, 24 Aug 2024 12:31:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 42780C07E7 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2FB7C400F3 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xELsPI0evb_A for ; Sat, 24 Aug 2024 07:53:10 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.188; helo=szxga02-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 13ACF40042 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 13ACF40042 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by smtp2.osuosl.org (Postfix) with ESMTPS id 13ACF40042 for ; Sat, 24 Aug 2024 07:53:09 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WrTBn0ntCzhXgK; Sat, 24 Aug 2024 15:31:13 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 0CEFD140137; Sat, 24 Aug 2024 15:33:15 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:32 +0800 Message-ID: <20240824074033.2134514-8-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 7/8] net/rxrpc: Use min() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Let's use min() to simplify the code and fix the Coccinelle/coccicheck warning reported by minmax.cocci. Signed-off-by: Hongbo Li --- net/rxrpc/input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 16d49a861dbb..455aa0189b28 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -868,8 +868,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) prev_pkt = sp->ack.prev_ack; nr_acks = sp->ack.nr_acks; hard_ack = first_soft_ack - 1; - summary.ack_reason = (sp->ack.reason < RXRPC_ACK__INVALID ? - sp->ack.reason : RXRPC_ACK__INVALID); + summary.ack_reason = min(sp->ack.reason, RXRPC_ACK__INVALID); trace_rxrpc_rx_ack(call, ack_serial, acked_serial, first_soft_ack, prev_pkt, From patchwork Sat Aug 24 07:40:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 1976389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WrbsD3dDZz1yfF for ; Sat, 24 Aug 2024 22:31:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 69604403E2; Sat, 24 Aug 2024 12:31:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id mq2x1Xa74Xkb; Sat, 24 Aug 2024 12:31:24 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EFAE4404F4 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id EFAE4404F4; Sat, 24 Aug 2024 12:31:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 18141C07EE; Sat, 24 Aug 2024 12:31:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C0773C07E7 for ; Sat, 24 Aug 2024 07:53:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B451640214 for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id N_9S2RmSGbgI for ; Sat, 24 Aug 2024 07:53:11 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.188; helo=szxga02-in.huawei.com; envelope-from=lihongbo22@huawei.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org BDB3440219 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BDB3440219 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by smtp4.osuosl.org (Postfix) with ESMTPS id BDB3440219 for ; Sat, 24 Aug 2024 07:53:10 +0000 (UTC) Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WrTBn20vCzhY5w; Sat, 24 Aug 2024 15:31:13 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 37F141800A5; Sat, 24 Aug 2024 15:33:15 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Sat, 24 Aug 2024 15:33:14 +0800 To: , , , , , , , CC: , , , , , , Date: Sat, 24 Aug 2024 15:40:33 +0800 Message-ID: <20240824074033.2134514-9-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824074033.2134514-1-lihongbo22@huawei.com> References: <20240824074033.2134514-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Mailman-Approved-At: Sat, 24 Aug 2024 12:31:08 +0000 Subject: [ovs-dev] [PATCH net-next 8/8] net/ceph: Use min() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hongbo Li via dev From: Hongbo Li Reply-To: Hongbo Li Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Let's use min() to simplify the code and fix the Coccinelle/coccicheck warning reported by minmax.cocci. Signed-off-by: Hongbo Li --- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 9d078b37fe0b..450eb3be48b0 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -3058,7 +3058,7 @@ static void linger_reg_commit_complete(struct ceph_osd_linger_request *lreq, int result) { if (!completion_done(&lreq->reg_commit_wait)) { - lreq->reg_commit_error = (result <= 0 ? result : 0); + lreq->reg_commit_error = min(result, 0); complete_all(&lreq->reg_commit_wait); } }