Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp385154lqb; Fri, 24 May 2024 00:58:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdwW2tKIODt3USCCNlwRJ8oIf0EObhQnCcehRKMD746trLZpUBu5IFhkl3lByyQUT/YjkG/1qNOlg3Bdxn0KX92ySgDqmJblLdkZpP1A== X-Google-Smtp-Source: AGHT+IF5Rqs6BkCiQbcPh6caI417tugdMttbsYFTpFRxEy/dXQXzBMXzBjRG1H02VbDJSzwE4oiD X-Received: by 2002:a81:9182:0:b0:617:cb98:f9b2 with SMTP id 00721157ae682-62a08f2cae4mr13534117b3.43.1716537529046; Fri, 24 May 2024 00:58:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716537529; cv=pass; d=google.com; s=arc-20160816; b=AoN2xWLXVufAZ9jiy0pUmVINcpVN6nILQBele7pxdPZp7TC2s4wreeWNZFYIQop/Q3 //82oFfHW3Z3njTaXoUhCavdqXL/kFJRnyvVZoYovYwmVcf9rTq1gRMOSNW2eXm3rN5V XfN7DLn8vH3NfSFCT7qm/EUnxgSGTiBvbOhvA3tPs3lPE/FL0zwcfe5c0sfGp1Am4tqL +Vx/6eiYT9UoQGuzGd+YZPO4d2wx6bz3uKa2u6sf8QSP6zD1JOtNnTFh7A8463K+Aw7Z QPr4uY5xmSSQP9N8pQ3xU+r0pP7Y5kWa2qsnDWUcssfzkEune+UyUI5iRqS5/kj94HhE +l/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=07/n6HPUGsrYONlCxyGegVdPDEuAAjDjEBGbwCI4jeE=; fh=IEMD1XZitpLV0dxSQ/N/GF2a17ETYlJI/hAO8zZhxZs=; b=t7nKF8ZcDtwyOpIEk1VXC1XttBDH1s0d87V+YGZOpHqdAwyTM07GvNqWeQ3qRWWMGW CUkCTdueQ+ueKoinD4zQm9ZMFFExoWIO9oqs9BxnQO/Fstw7mOm3B6rr1u+riMF/ONGk BW+RZHktkuabtYazkQrieH/KU85KTj9nj/a52AfdsH5itFIe5iWtGC/+qC8joPn1HG6Q QcnIZEvtGLkycK5t3pNwY0r+OmO5m2fg8aFqSDiR4vmvBepCH+Nw56yO+NX45Xog2fv9 HddGdY3U2arDk2HfSc5X5NShBHz7kkEmZyQcK9zmMGVjH11YjgPhg++5ptJ6EgtPrMJS OxuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=ZJXtNVAI; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-wireless+bounces-8040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac162b4fffsi10642966d6.481.2024.05.24.00.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 00:58:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=ZJXtNVAI; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-wireless+bounces-8040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 626E31C21612 for ; Fri, 24 May 2024 07:58:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52C1282892; Fri, 24 May 2024 07:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="ZJXtNVAI" X-Original-To: linux-wireless@vger.kernel.org Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2D5B83CAE; Fri, 24 May 2024 07:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716537525; cv=none; b=nV8NyVvJBUm7ZUHuHFvlxbnRfqN5flK1UoYvQwCLBVmG/2XXgRPRcr11jG7ZEi/KZYwx/a86nEGvhe64p6DFc1bCfrhtOIWPLescUtAXS0MQ2wCY4UAp3mzGM0000POe2qhmsxNjnzJf/IkyghcGV7DCpEUqqFcp86IObFjCXVE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716537525; c=relaxed/simple; bh=bqyPMRt9wz028/U8fejcJ/EaS7Tt7i+3cUm/fCpxTb4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rwmoR5CHGskT4/QOZTBF3ttj5cSGvGoeFkFRCu2ovBgjvIK4n7DjCQO5CDHdQ7cooB+5OTefi9wzcNeo3PZQAF0Qt3AYE/v7QXGpLRzp1W8db97134aORueUmbX+NqYZRMoin73rsWiNLva2X0Eh9zTWKvfQqb1moyuRV88VPkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=ZJXtNVAI; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716537515; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=07/n6HPUGsrYONlCxyGegVdPDEuAAjDjEBGbwCI4jeE=; b=ZJXtNVAIrEEXn4AWb8v3kCsGxVKYn1ezqcsNc5chOciWmdn1okKrDOLWYoeRFJnvCjTraShAMU31TFS/zL5Y0+pcPzukIavIj90TDxySm1fRxhAAGbNN4vR7cRna6OwNj3hijQPWRVgIgQcs8TtZVgJ7+FvlamRJ6HIGAfxYiSQ= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045046011;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0W75y.OR_1716537505; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0W75y.OR_1716537505) by smtp.aliyun-inc.com; Fri, 24 May 2024 15:58:34 +0800 From: Jiapeng Chong To: pkshih@realtek.com Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] wifi: rtw89: chan: Use swap() instead of open coding it Date: Fri, 24 May 2024 15:58:19 +0800 Message-Id: <20240524075819.2789-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Swap is a function interface that provides exchange function. To avoid code duplication, we can use swap function. ./drivers/net/wireless/realtek/rtw89/chan.c:2336:32-33: WARNING opportunity for swap(). Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9174 Signed-off-by: Jiapeng Chong --- drivers/net/wireless/realtek/rtw89/chan.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/chan.c b/drivers/net/wireless/realtek/rtw89/chan.c index 051a3cad6101..3b1997223cc5 100644 --- a/drivers/net/wireless/realtek/rtw89/chan.c +++ b/drivers/net/wireless/realtek/rtw89/chan.c @@ -2322,7 +2322,6 @@ static void rtw89_swap_sub_entity(struct rtw89_dev *rtwdev, enum rtw89_sub_entity_idx idx2) { struct rtw89_hal *hal = &rtwdev->hal; - struct rtw89_sub_entity tmp; struct rtw89_vif *rtwvif; u8 cur; @@ -2332,9 +2331,7 @@ static void rtw89_swap_sub_entity(struct rtw89_dev *rtwdev, hal->sub[idx1].cfg->idx = idx2; hal->sub[idx2].cfg->idx = idx1; - tmp = hal->sub[idx1]; - hal->sub[idx1] = hal->sub[idx2]; - hal->sub[idx2] = tmp; + swap(hal->sub[idx1], hal->sub[idx2]); rtw89_for_each_rtwvif(rtwdev, rtwvif) { if (!rtwvif->chanctx_assigned) -- 2.20.1.7.g153144c