Message ID | 20220407100459.3605-1-guozhengkui@vivo.com |
---|---|
State | New |
Headers | show
Return-Path: <linux-usb-owner@kernel.org> 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 340C3C433F5 for <linux-usb@archiver.kernel.org>; Thu, 7 Apr 2022 10:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241628AbiDGKHY (ORCPT <rfc822;linux-usb@archiver.kernel.org>); Thu, 7 Apr 2022 06:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236536AbiDGKHV (ORCPT <rfc822;linux-usb@vger.kernel.org>); Thu, 7 Apr 2022 06:07:21 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2127.outbound.protection.outlook.com [40.107.215.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3E0A6D4E7; Thu, 7 Apr 2022 03:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNGCbNWgeIatCM6UgJGMcPxiWVnWxi8x3yCjTKJoQC/xe8OK2cdjBNe0ze98pEU6X1miADl6RMUJ57oNDBhUHww1lC3gDAzl3sMa3C8tB2NITLc7/hhY1o9ex1AAtbvHiFeVNGkA1GBdH7pzFnwuSu/EDi4OLuIreG2EC8/HujBQxutYdC9A3TzOE0KXUooFVvK6ZSz7NQTK4V6RSgnisWQTYiKml1CtnD4/ymd4qVkadOcQytZM6PNHT+VV87qxqd2Uwo+37oUFYP31xHuHOWivO1oItyRHLN2JE74TxZEbsKdDulGyZXKrAZIvIKnh1ycJ+SFMSf0AwT/MPkd7UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kZeszF2QANFCSqCoPN3KfdHFDuGAAVgUHz06A/VxFGY=; b=oJtG9le9ZLNI1CxRXdjDL+mKhJVjvg182zit+w9J2SB9eomB62lPhIRm1Vgt2lqII+CCV+MzfHH4UAAL+Y5NuP2hEUrRWO5QcOQup9MUYuMymx9f0zRkapNxXNiWnWKGDtkr7Tt8zeH176DPsKXmG0rZldSCoyn4cHRwfsGiabaBtjZj7Ttkxpt/P8R472aG//MEg7vqrbqGRM4+mRnWBG/GZp+gYQBfdyv84kLde8bmYxGw6ZVbGPJCzKdBVWYAsHf0v4xKEVF/3LPtm3aeKORY1Iog+4OlGyybDqWl7xDS9J40xXqPlf0U+3O4UXHH2OMAGHIeNtW2rTLbqLncHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kZeszF2QANFCSqCoPN3KfdHFDuGAAVgUHz06A/VxFGY=; b=dmLs/BOG5dR50Yc88eaMfcsoU8xYPiIP9HKXGvTBYov8OXDPWW039SRKT9y3jP2ksI1u53z9Q9fSCgKa5PHrK7nIWAxuKtBd29VcgkHzlB48Otj7ox/9Ewovmpcl55j5uc1kJYq9pynE6r1nr6yFj+hm9dx8OP58AKioojspD9Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PS2PR06MB3493.apcprd06.prod.outlook.com (2603:1096:300:63::20) by TYAPR06MB2400.apcprd06.prod.outlook.com (2603:1096:404:17::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Thu, 7 Apr 2022 10:05:14 +0000 Received: from PS2PR06MB3493.apcprd06.prod.outlook.com ([fe80::98bc:c4d6:61e2:f84]) by PS2PR06MB3493.apcprd06.prod.outlook.com ([fe80::98bc:c4d6:61e2:f84%5]) with mapi id 15.20.5144.022; Thu, 7 Apr 2022 10:05:14 +0000 From: Guo Zhengkui <guozhengkui@vivo.com> To: Felipe Balbi <balbi@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jakob Koschel <jakobkoschel@gmail.com>, Guo Zhengkui <guozhengkui@vivo.com>, Alan Stern <stern@rowland.harvard.edu>, Colin Ian King <colin.king@intel.com>, linux-usb@vger.kernel.org (open list:USB GADGET/PERIPHERAL SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: zhengkui_guo@outlook.com Subject: [PATCH] usb: gadget: net2280: use swap() instead of open coding it Date: Thu, 7 Apr 2022 18:04:52 +0800 Message-Id: <20220407100459.3605-1-guozhengkui@vivo.com> X-Mailer: git-send-email 2.20.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: HK2PR04CA0065.apcprd04.prod.outlook.com (2603:1096:202:14::33) To PS2PR06MB3493.apcprd06.prod.outlook.com (2603:1096:300:63::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 479d4c59-ec20-4cdd-f311-08da187e1be0 X-MS-TrafficTypeDiagnostic: TYAPR06MB2400:EE_ X-Microsoft-Antispam-PRVS: <TYAPR06MB24004863375C2C986B160C94C7E69@TYAPR06MB2400.apcprd06.prod.outlook.com> X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 30fjpkUbGI7N/ZEk69OzPyBNEvbt58vaM8z47B6speaSGMSWCUFfW/u3fTR4TU7xnTdFwsUpU1I+r0L/hLvX4YbiHSAWTtJtJSN2idXO7U2n9WdwkxtjQZcDgIdCu6ZTM1/wPx6CmnEnqt1fRQremoctKi43ftKaje6y8SGvdaoyLm24BwmiMWGSTnZoVhN3bHIvW1SK0dRH9hl5oiLRXjvKvw6xV70XtYVWz48io4bPL42cByGNuxCErwa+kk2rdaiY5GnmvS8R2gxv6llwQzkv+uogmKfRK6sDwz6noqOfVLHez0SORtDQ/uK+ghuRdVlx4xBgMAA+z5MM8mc7MJDOhm5E9t7uLGPEFqDQzU+XRUsV1Z4EgzgUx1h2hcu5u8U9Tp7v5FN6Lsh9g9dyILz48YwmZ2S82/WURPZvaHbKipJOn1dWCrgd8DZwFHfuPdXkO9Jh3N8+w/OOkLKin0am0r2T8gtJvRVWtjfdmDnwD+52/raBLbw3kpkEV3MpR05qutmlzg2e6S8ZGbYy+VcYHU5HU/Sgljcqi87eLnx3VMn8dKOniFanCShmNpUsQbaFeFlwXqtoIifyzPk+JWGdQJyaSl4iYveluzHNOb4H+Vmg36idEBTrchPw4srRc4Blf7lLnAM1cxpQg4y0WAP68k1Qc4uNkSS+eNiv03IO+HQoFZFOnbAsuNtDGcKKjgFz4yKBijtDziBmLoJS+g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PS2PR06MB3493.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(4326008)(8676002)(38350700002)(38100700002)(316002)(66476007)(66556008)(52116002)(66946007)(6512007)(6666004)(8936002)(6506007)(2906002)(86362001)(6486002)(5660300002)(508600001)(36756003)(26005)(186003)(1076003)(2616005)(83380400001)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8yIE3QWByCnB4xOztJXwTQ0BTRdurVQ2Rk78ujR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2IzUjedhmaEFdHG/LfjYxfPNlhIi5tY+1D1/afKgms6sqjgjf9cKsPivGj7AHTHidB7Dzyy79nct1koWauzjm6dMA7HFpvfXPfo85X/QbGrAvD7iodB/y8kCFmLkHkUQQ3gn+9s/vLdJvh+fAB300zHNZWi6SWJ/Ur5l097Fl7EYsTT7E9uWzgJSiyBWuKbbO+9VdIO/RW6bamePRAGfi5zSFoaq24fd5sIA4tthUA01Nz+bI+Y+Bp/AeH71CQgKrgKzQpiFrMhYdDU1yYWKX9MMp2+FIzlWfTNCuwx7l9djoSG3FJzC5/XZPADVixZFme7fsx2ub0z1f9ZHD18h+Vy1+HQI4ry9QkOkCzYLiEO5d9MJt8QY1yecAn2tUoRDZvqUvowIie2582l5jscOD5vBNa11iDs9qajytXbrK6tjmMqeZwdKZs7oFv+jqbX4t4TS9K+HKPmi5/fuE3q4oKHevX5U+XXuHEaednknww5rdXDuCVWKWDuP1yGkGXcSl16RUTOGSpC1Sq4wpp7LmrL2ZghqyLczdKSEQuvtcINFdBnyG1b/e39qkOlIcCYLEoZ9+OfzWkoAs0NUXMm1iA/w112Rcpnr3T2wxWkJ2WXOPLNrM2KyzXPw== X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 479d4c59-ec20-4cdd-f311-08da187e1be0 X-MS-Exchange-CrossTenant-AuthSource: PS2PR06MB3493.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2022 10:05:14.0894 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IO6UdP0QHLDlz8Xv7a4q5hVFtc3UBAdmPuTaTzyLBgPOiuuhCMdxVICl5H/HH75wsl+k32m+4RnsPDOsPGbtoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR06MB2400 Precedence: bulk List-ID: <linux-usb.vger.kernel.org> X-Mailing-List: linux-usb@vger.kernel.org |
Series |
usb: gadget: net2280: use swap() instead of open coding it
|
expand
|
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 051d024b369e..d6a68631354a 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -932,19 +932,11 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req) static inline void queue_dma(struct net2280_ep *ep, struct net2280_request *req, int valid) { - struct net2280_dma *end; - dma_addr_t tmp; - /* swap new dummy for old, link; fill and maybe activate */ - end = ep->dummy; - ep->dummy = req->td; - req->td = end; - - tmp = ep->td_dma; - ep->td_dma = req->td_dma; - req->td_dma = tmp; + swap(ep->dummy, req->td); + swap(ep->td_dma, req->td_dma); - end->dmadesc = cpu_to_le32 (ep->td_dma); + req->td->dmadesc = cpu_to_le32 (ep->td_dma); fill_dma_desc(ep, req, valid); }
Address the following coccicheck warning: drivers/usb/gadget/udc/net2280.c:940:20-21: WARNING opportunity for swap(). drivers/usb/gadget/udc/net2280.c:944:25-26: WARNING opportunity for swap(). by using swap() for the swapping of variable values and drop the tmp variables (`tmp` and `end`) that are not needed any more. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> --- drivers/usb/gadget/udc/net2280.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)