From patchwork Fri Jul 19 07:36:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 11049809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C897138D for ; Fri, 19 Jul 2019 07:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AB3A2880B for ; Fri, 19 Jul 2019 07:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F15F2888D; Fri, 19 Jul 2019 07:37:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F58F2880B for ; Fri, 19 Jul 2019 07:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbfGSHg6 (ORCPT ); Fri, 19 Jul 2019 03:36:58 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36802 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbfGSHg5 (ORCPT ); Fri, 19 Jul 2019 03:36:57 -0400 Received: by mail-pf1-f194.google.com with SMTP id r7so13798757pfl.3; Fri, 19 Jul 2019 00:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7+fNM12/nljLUHg+OWnuw+9Qm4IaKfoKesEI410bL8g=; b=HO8zPHQL1iASaJUNxgEeHKBCHWNwgbpSook1NIo35yhm5Jbyi013Exkt2AkRoq6tyr RMuDwCkMJmgamWuDVGEslmeNCzRG9mSn8vVw47pk+6mgdsor9XF7HnTs9BgQ5y5HrQRK U1s3FgEeqnOmqyT1DcFwHuGcnRKkwfCXM/1S1SnmwlebCac1O/7WumlfbBL4+Rl9nSip 74GyT/TL53a5qFwp7N4KFGEoJ+iFTfjJ06JMj86W4uDy731wtWJEfhzZwdM8gMWD0lvI uLkZ99EiDvtHrZaDeSd8S2YZb+/vfKZEJmB8lPWL2dI1oT/7vk1cvCp8VMR6Vh4Isk2o xS9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7+fNM12/nljLUHg+OWnuw+9Qm4IaKfoKesEI410bL8g=; b=hB9u4DccS8kyb7bDxp1B4P6efw20yfnpIeWW4lo7mN7TQHo++NJXHxFWmB1qmKyfCj SB+5mLv0LHqSEa3hO4sHDGPQx+CXJr/mPCvGBKwfgnByartJlOpQwlOVZSxlO8PTjQbX /IvqtdBJmgcIewTmSBK/LDRDcI+fnk39GdbgC8oTKKQMm6Wp6WnusWiJb6/JTS1n3GoU VL1gvswA3BVsFmRFY4cMuS/1vOZqL+C4x+buHeyYZ7T6XIT8Ws233D6gZLHKeL8WyDng gsHAoRHjUaNXW3S35bHjVRGrvoO0GkjxbY12QGQPWNN3H5QqT1V/KtVN0EvNZl8vurar s//A== X-Gm-Message-State: APjAAAXqPWQMU3tXPEvo4bAF0tu/iTpVgkVylj6NMd83wJUdAOF8rs9l gnnOpaGrIPlkQgohsXghsFA= X-Google-Smtp-Source: APXvYqyJP1loJXy3J8DMh9em8LSA2Gqoo6xLOWUhOPOXJp3sso3+MNFrDf2reEr93tW0jl++UOFiiQ== X-Received: by 2002:a65:6815:: with SMTP id l21mr6135736pgt.146.1563521817101; Fri, 19 Jul 2019 00:36:57 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id x9sm8929978pgp.75.2019.07.19.00.36.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 00:36:56 -0700 (PDT) From: Chuhong Yuan Cc: Woojung Huh , Microchip Linux Driver Support , "David S . Miller" , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx Date: Fri, 19 Jul 2019 15:36:15 +0800 Message-Id: <20190719073614.1850-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Merge the combo use of memcpy and lexx_to_cpus. Use get_unaligned_lexx instead. This simplifies the code. Signed-off-by: Chuhong Yuan Acked-by: Woojung Huh --- drivers/net/usb/lan78xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 3d92ea6fcc02..9c33b35bd155 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1258,8 +1258,7 @@ static void lan78xx_status(struct lan78xx_net *dev, struct urb *urb) return; } - memcpy(&intdata, urb->transfer_buffer, 4); - le32_to_cpus(&intdata); + intdata = get_unaligned_le32(urb->transfer_buffer); if (intdata & INT_ENP_PHY_INT) { netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata); @@ -3105,16 +3104,13 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb) struct sk_buff *skb2; unsigned char *packet; - memcpy(&rx_cmd_a, skb->data, sizeof(rx_cmd_a)); - le32_to_cpus(&rx_cmd_a); + rx_cmd_a = get_unaligned_le32(skb->data); skb_pull(skb, sizeof(rx_cmd_a)); - memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); - le32_to_cpus(&rx_cmd_b); + rx_cmd_b = get_unaligned_le32(skb->data); skb_pull(skb, sizeof(rx_cmd_b)); - memcpy(&rx_cmd_c, skb->data, sizeof(rx_cmd_c)); - le16_to_cpus(&rx_cmd_c); + rx_cmd_c = get_unaligned_le16(skb->data); skb_pull(skb, sizeof(rx_cmd_c)); packet = skb->data;