hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/usb/asix_common.c
....@@ -1,22 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ASIX AX8817X based USB 2.0 Ethernet Devices
34 * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
45 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
56 * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
67 * Copyright (c) 2002-2003 TiVo Inc.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
208 */
219
2210 #include "asix.h"
....@@ -233,6 +221,7 @@
233221 int tailroom = skb_tailroom(skb);
234222 u32 packet_len;
235223 u32 padbytes = 0xffff0000;
224
+ void *ptr;
236225
237226 padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4;
238227
....@@ -268,13 +257,11 @@
268257 }
269258
270259 packet_len = ((skb->len ^ 0x0000ffff) << 16) + skb->len;
271
- skb_push(skb, 4);
272
- cpu_to_le32s(&packet_len);
273
- skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
260
+ ptr = skb_push(skb, 4);
261
+ put_unaligned_le32(packet_len, ptr);
274262
275263 if (padlen) {
276
- cpu_to_le32s(&padbytes);
277
- memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
264
+ put_unaligned_le32(padbytes, skb_tail_pointer(skb));
278265 skb_put(skb, sizeof(padbytes));
279266 }
280267