Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3286855ybi; Fri, 19 Jul 2019 00:37:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqylgwbR+y/dZ6Iswbp+GzYCk4ShcGep+Cu4prSsdEh4Xj4/HWlNtivpP7Bn62hSW9g8gvTm X-Received: by 2002:a63:7b18:: with SMTP id w24mr52221139pgc.328.1563521853858; Fri, 19 Jul 2019 00:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563521853; cv=none; d=google.com; s=arc-20160816; b=JTdABc5RGAV8vVIIMj+9VOy2GsdfKVQIngwv/0g38xwrT9UoHY7zSx81jdk2pVkug2 mBP7TD9gtTRNqXQeyS6wy9JzHRnNwH1J5Y3UVLVYLGf8DY6PqxAGRPvFWEhn9wZLfO2i AHmMrBWjJRdSRn0Z54+4axqnkNYiayJ58LXU7IJ8UFzPtm3yYRrl3atmtdmbP1QqobRD dQokWgQRE8T85TGwSZm0VJJQCHRTTFv07addfFYpvYRNWG5ytUa0eV20j2buUlZN4Qa1 EcOrM7k2jDCdpo/HccVhTQbuONUvOXzGhQmiHfWV8QEz1Lzs5dJr1p2C55g53SbYGMgI wkPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=7+fNM12/nljLUHg+OWnuw+9Qm4IaKfoKesEI410bL8g=; b=PsyAgPgAC53VFa19vjA01s3bCuCr2O6J5LlOm/L9vW9+CyrHufUlViIHmf3ofaoIZt S+JC6EAY4/nXEdsJmHym+br698ZKUN87UyCweq9+ZoPu7zSQ4yB2/JAkA+ISOdvzJkWg cTEblWjipX3diy+KJaNi1q1/5PnA4NV1/n4KB3CjoezpMaKig5qJJ2tObUbNWvZxQ9Sf 85092Zw7+gQ1ecW2TB2NvtERnM2S0tu9/Un+837dilS8+TBybLx+dL2lSbIzJAfA0vKt Onljm3Zc6ssEt1lIlj17inrst8dtUUqmY4I5RaucQR9ahNJTgmX4Cjl3E+ETBCmKST46 zwaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HO8zPHQL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g31si1357818pld.8.2019.07.19.00.37.18; Fri, 19 Jul 2019 00:37:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HO8zPHQL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726984AbfGSHg6 (ORCPT + 99 others); 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-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 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Merge the combo use of memcpy and lexx_to_cpus. Use get_unaligned_lexx instead. This simplifies the code. Signed-off-by: Chuhong Yuan --- 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; -- 2.20.1