diff options
author | Chuhong Yuan <hslester96@gmail.com> | 2019-07-22 09:41:34 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-23 05:44:14 +0200 |
commit | 7e24b4ed5ac4321e41415b0c6f0f8a8ac14852b2 (patch) | |
tree | d7766a24d4fbfbf1a00922984ad6c1f3ad4bf4cd /drivers/net/usb/sr9800.c | |
parent | r8169: improve rtl_rx (diff) | |
download | linux-7e24b4ed5ac4321e41415b0c6f0f8a8ac14852b2.tar.xz linux-7e24b4ed5ac4321e41415b0c6f0f8a8ac14852b2.zip |
net: usb: Merge cpu_to_le32s + memcpy to put_unaligned_le32
Merge the combo uses of cpu_to_le32s and memcpy.
Use put_unaligned_le32 instead.
This simplifies the code.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/sr9800.c')
-rw-r--r-- | drivers/net/usb/sr9800.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c index 35f39f23d881..c5d4a0060124 100644 --- a/drivers/net/usb/sr9800.c +++ b/drivers/net/usb/sr9800.c @@ -115,6 +115,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, struct sk_buff *skb, u32 padbytes = 0xffff0000; u32 packet_len; int padlen; + void *ptr; padlen = ((skb->len + 4) % (dev->maxpacket - 1)) ? 0 : 4; @@ -133,14 +134,12 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, struct sk_buff *skb, return NULL; } - skb_push(skb, 4); + ptr = skb_push(skb, 4); packet_len = (((skb->len - 4) ^ 0x0000ffff) << 16) + (skb->len - 4); - cpu_to_le32s(&packet_len); - skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); + put_unaligned_le32(packet_len, ptr); if (padlen) { - cpu_to_le32s(&padbytes); - memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); + put_unaligned_le32(padbytes, skb_tail_pointer(skb)); skb_put(skb, sizeof(padbytes)); } |