linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx
@ 2019-07-19  7:36 Chuhong Yuan
  2019-07-19 16:30 ` Woojung.Huh
  2019-07-22 19:13 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Chuhong Yuan @ 2019-07-19  7:36 UTC (permalink / raw)
  Cc: Woojung Huh, Microchip Linux Driver Support, David S . Miller,
	netdev, linux-usb, linux-kernel, Chuhong Yuan

Merge the combo use of memcpy and lexx_to_cpus.
Use get_unaligned_lexx instead.
This simplifies the code.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx
  2019-07-19  7:36 [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx Chuhong Yuan
@ 2019-07-19 16:30 ` Woojung.Huh
  2019-07-22 19:13 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Woojung.Huh @ 2019-07-19 16:30 UTC (permalink / raw)
  To: hslester96; +Cc: UNGLinuxDriver, davem, netdev, linux-usb, linux-kernel

> From: Chuhong Yuan <hslester96@gmail.com>
> Sent: Friday, July 19, 2019 3:36 AM
> Cc: Woojung Huh - C21699 <Woojung.Huh@microchip.com>; UNGLinuxDriver
> <UNGLinuxDriver@microchip.com>; David S . Miller <davem@davemloft.net>;
> netdev@vger.kernel.org; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Chuhong Yuan
> <hslester96@gmail.com>
> Subject: [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx
> 
> External E-Mail
> 
> 
> Merge the combo use of memcpy and lexx_to_cpus.
> Use get_unaligned_lexx instead.
> This simplifies the code.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Acked-by: Woojung Huh <woojung.huh@microchip.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx
  2019-07-19  7:36 [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx Chuhong Yuan
  2019-07-19 16:30 ` Woojung.Huh
@ 2019-07-22 19:13 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-07-22 19:13 UTC (permalink / raw)
  To: hslester96; +Cc: woojung.huh, UNGLinuxDriver, netdev, linux-usb, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com>
Date: Fri, 19 Jul 2019 15:36:15 +0800

> Merge the combo use of memcpy and lexx_to_cpus.
> Use get_unaligned_lexx instead.
> This simplifies the code.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-22 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19  7:36 [PATCH] net: lan78xx: Merge memcpy + lexx_to_cpus to get_unaligned_lexx Chuhong Yuan
2019-07-19 16:30 ` Woojung.Huh
2019-07-22 19:13 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).