From nobody Thu Dec 18 05:20:30 2025 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 117F0C072A2 for ; Wed, 22 Nov 2023 03:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343590AbjKVDZc (ORCPT ); Tue, 21 Nov 2023 22:25:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343543AbjKVDZa (ORCPT ); Tue, 21 Nov 2023 22:25:30 -0500 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE9590 for ; Tue, 21 Nov 2023 19:25:26 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VwuRqSm_1700623519; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VwuRqSm_1700623519) by smtp.aliyun-inc.com; Wed, 22 Nov 2023 11:25:24 +0800 From: Jiapeng Chong To: richard@nod.at Cc: anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] um: Use swap() instead of open coding it Date: Wed, 22 Nov 2023 11:25:18 +0800 Message-Id: <20231122032518.53305-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Swap is a function interface that provides exchange function. To avoid code duplication, we can use swap function. ./arch/um/os-Linux/sigio.c:81:28-29: WARNING opportunity for swap(). Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=3D7607 Signed-off-by: Jiapeng Chong --- arch/um/os-Linux/sigio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 9e71794839e8..1eb15f3cfdc8 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c @@ -50,7 +50,7 @@ static struct pollfds all_sigio_fds; =20 static int write_sigio_thread(void *unused) { - struct pollfds *fds, tmp; + struct pollfds *fds; struct pollfd *p; int i, n, respond_fd; char c; @@ -77,9 +77,7 @@ static int write_sigio_thread(void *unused) "write_sigio_thread : " "read on socket failed, " "err =3D %d\n", errno); - tmp =3D current_poll; - current_poll =3D next_poll; - next_poll =3D tmp; + swap(current_poll, next_poll); respond_fd =3D sigio_private[1]; } else { --=20 2.20.1.7.g153144c