Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp832164rdf; Tue, 21 Nov 2023 19:25:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEC0mClEISdLnoSoUwBX3RsMg7iZbY6mTcILfzbo0f0R6xKopktPKLK9v5ibKw1ncyDmswZ X-Received: by 2002:a05:6358:998d:b0:16d:e922:f859 with SMTP id j13-20020a056358998d00b0016de922f859mr1135782rwb.30.1700623540974; Tue, 21 Nov 2023 19:25:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700623540; cv=none; d=google.com; s=arc-20160816; b=Z6yeJjAj2i8MUdt/8eveQGhaXTDscMRhhWCI9jJYTMYrVg/qX3bFqst4RhPAX/7T3e nKkY7xfulZoIW/H51pbntacOR0hiokcDWmFFaKa/mOsGl81jdGuGF4IFD7dv46l2g7P2 4NNHQmN2Yrx0GJZ25tmaobGukfCgtQu02JE4TbcKVamhUsPYFcbJP6zxWHQXLcKcpqAA vd+meXHNnoI+MsLXV4n3STwi+oqghEPcqllUcOGc70xc8S08eNnSh4G6N7A+T4MD5ZAE 7YMbc/graqiGkdZWZME/WQS2a6q/KtTkVK7dgM427Nrwdq1FKHErPHuHx1hO2ofy5e6K NfVQ== 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:cc:to:from; bh=l+3TINVQZnBCy9NnOcEPayN62Lly57GvewPPxRJOTAk=; fh=gq86n0zt2vdfX3gQf7Oq24vOFRNof8sZ6S2UjtxrLMc=; b=U+8MtV5Y5z/cqXR573Amj/t6hU8aWVIg4qMM38bDEJbjiEV1ZSvYMDrcxw2hPLFUwq BJcWb3bUStvO0Jt2nmDSQaXGL4KDOwWp5ktTyq4LOGC0CPA1y6+eupFITPA4zL2xFvh0 1ABJEcX3fzEzfJ+cqiBqdexlw0TT3HXflCDfTB4xpNZtgJGpGNXqTsoq0OkxCazXVrvr pEjUxdFIAgSjTeJsjlU8VCEjKt/PB5X125LKbg0IaceugZ23p6MfnbAbj/C94P/hP+CD nNL0uT3YUUGg2iB/AzbMDIiQSByLw3DmDTo2+RWNzAFBvroZwDFlY82icza/b+nTPCOf kvRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id by8-20020a056a02058800b005bd0f2c2671si13432884pgb.626.2023.11.21.19.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 19:25:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 642BF802662F; Tue, 21 Nov 2023 19:25:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343588AbjKVDZc (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 19:25:38 -0800 (PST) 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=7607 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; 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 = %d\n", errno); - tmp = current_poll; - current_poll = next_poll; - next_poll = tmp; + swap(current_poll, next_poll); respond_fd = sigio_private[1]; } else { -- 2.20.1.7.g153144c