| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ASIX AX8817X based USB 2.0 Ethernet Devices |
|---|
| 3 | 4 | * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com> |
|---|
| 4 | 5 | * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net> |
|---|
| 5 | 6 | * Copyright (C) 2006 James Painter <jamie.painter@iname.com> |
|---|
| 6 | 7 | * 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/>. |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #include "asix.h" |
|---|
| .. | .. |
|---|
| 233 | 221 | int tailroom = skb_tailroom(skb); |
|---|
| 234 | 222 | u32 packet_len; |
|---|
| 235 | 223 | u32 padbytes = 0xffff0000; |
|---|
| 224 | + void *ptr; |
|---|
| 236 | 225 | |
|---|
| 237 | 226 | padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; |
|---|
| 238 | 227 | |
|---|
| .. | .. |
|---|
| 268 | 257 | } |
|---|
| 269 | 258 | |
|---|
| 270 | 259 | 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); |
|---|
| 274 | 262 | |
|---|
| 275 | 263 | 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)); |
|---|
| 278 | 265 | skb_put(skb, sizeof(padbytes)); |
|---|
| 279 | 266 | } |
|---|
| 280 | 267 | |
|---|