forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * CAN driver for PEAK System PCAN-USB Pro adapter
34 * Derived from the PCAN project file driver/src/pcan_usbpro.c
45 *
56 * Copyright (C) 2003-2011 PEAK System-Technik GmbH
67 * Copyright (C) 2011-2012 Stephane Grosjean <s.grosjean@peak-system.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published
10
- * by the Free Software Foundation; version 2 of the License.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
168 */
179 #include <linux/netdevice.h>
1810 #include <linux/usb.h>
....@@ -127,7 +119,7 @@
127119 /*
128120 * add one record to a message being built
129121 */
130
-static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, u8 id, ...)
122
+static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
131123 {
132124 int len, i;
133125 u8 *pc;
....@@ -141,10 +133,10 @@
141133 switch (id) {
142134 case PCAN_USBPRO_TXMSG8:
143135 i += 4;
144
- /* fall through */
136
+ fallthrough;
145137 case PCAN_USBPRO_TXMSG4:
146138 i += 4;
147
- /* fall through */
139
+ fallthrough;
148140 case PCAN_USBPRO_TXMSG0:
149141 *pc++ = va_arg(ap, int);
150142 *pc++ = va_arg(ap, int);
....@@ -194,7 +186,7 @@
194186
195187 len = pc - pm->rec_ptr;
196188 if (len > 0) {
197
- *pm->u.rec_cnt = cpu_to_le32(le32_to_cpu(*pm->u.rec_cnt) + 1);
189
+ le32_add_cpu(pm->u.rec_cnt, 1);
198190 *pm->rec_ptr = id;
199191
200192 pm->rec_ptr = pc;
....@@ -981,7 +973,7 @@
981973 struct usb_endpoint_descriptor *ep = &if_desc->endpoint[i].desc;
982974
983975 /*
984
- * below is the list of valid ep addreses. Any other ep address
976
+ * below is the list of valid ep addresses. Any other ep address
985977 * is considered as not-CAN interface address => no dev created
986978 */
987979 switch (ep->bEndpointAddress) {