diff options
author | Chuhong Yuan <hslester96@gmail.com> | 2019-07-22 10:41:34 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-23 06:44:14 +0300 |
commit | 7e24b4ed5ac4321e41415b0c6f0f8a8ac14852b2 (patch) | |
tree | d7766a24d4fbfbf1a00922984ad6c1f3ad4bf4cd /drivers/net/usb/lan78xx.c | |
parent | fcd4e60885af969d190999a6c42454c5578d52f1 (diff) | |
download | linux-7e24b4ed5ac4321e41415b0c6f0f8a8ac14852b2.tar.xz |
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/lan78xx.c')
-rw-r--r-- | drivers/net/usb/lan78xx.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 9c33b35bd155..769bb262fbec 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2729,6 +2729,7 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, struct sk_buff *skb, gfp_t flags) { u32 tx_cmd_a, tx_cmd_b; + void *ptr; if (skb_cow_head(skb, TX_OVERHEAD)) { dev_kfree_skb_any(skb); @@ -2757,13 +2758,9 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, tx_cmd_b |= skb_vlan_tag_get(skb) & TX_CMD_B_VTAG_MASK_; } - skb_push(skb, 4); - cpu_to_le32s(&tx_cmd_b); - memcpy(skb->data, &tx_cmd_b, 4); - - skb_push(skb, 4); - cpu_to_le32s(&tx_cmd_a); - memcpy(skb->data, &tx_cmd_a, 4); + ptr = skb_push(skb, 8); + put_unaligned_le32(tx_cmd_a, ptr); + put_unaligned_le32(tx_cmd_b, ptr + 4); return skb; } |