forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/net/wimax/i2400m/usb.c
....@@ -1,26 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel Wireless WiMAX Connection 2400m
34 * Linux driver model glue for USB device, reset & fw upload
45 *
5
- *
66 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
77 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
88 * Yanir Lubetkin <yanirx.lubetkin@intel.com>
9
- *
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public License version
12
- * 2 as published by the Free Software Foundation.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
- * 02110-1301, USA.
23
- *
249 *
2510 * See i2400m-usb.h for a general description of this driver.
2611 *
....@@ -210,6 +195,7 @@
210195 msleep(10); /* give the device some time */
211196 goto retry;
212197 }
198
+ fallthrough;
213199 case -EINVAL: /* while removing driver */
214200 case -ENODEV: /* dev disconnect ... */
215201 case -ENOENT: /* just ignore it */
....@@ -380,61 +366,25 @@
380366 };
381367 size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
382368
383
-
384
-#define __debugfs_register(prefix, name, parent) \
385
-do { \
386
- result = d_level_register_debugfs(prefix, name, parent); \
387
- if (result < 0) \
388
- goto error; \
389
-} while (0)
390
-
391
-
392369 static
393
-int i2400mu_debugfs_add(struct i2400mu *i2400mu)
370
+void i2400mu_debugfs_add(struct i2400mu *i2400mu)
394371 {
395
- int result;
396
- struct device *dev = &i2400mu->usb_iface->dev;
397372 struct dentry *dentry = i2400mu->i2400m.wimax_dev.debugfs_dentry;
398
- struct dentry *fd;
399373
400374 dentry = debugfs_create_dir("i2400m-usb", dentry);
401
- result = PTR_ERR(dentry);
402
- if (IS_ERR(dentry)) {
403
- if (result == -ENODEV)
404
- result = 0; /* No debugfs support */
405
- goto error;
406
- }
407375 i2400mu->debugfs_dentry = dentry;
408
- __debugfs_register("dl_", usb, dentry);
409
- __debugfs_register("dl_", fw, dentry);
410
- __debugfs_register("dl_", notif, dentry);
411
- __debugfs_register("dl_", rx, dentry);
412
- __debugfs_register("dl_", tx, dentry);
376
+
377
+ d_level_register_debugfs("dl_", usb, dentry);
378
+ d_level_register_debugfs("dl_", fw, dentry);
379
+ d_level_register_debugfs("dl_", notif, dentry);
380
+ d_level_register_debugfs("dl_", rx, dentry);
381
+ d_level_register_debugfs("dl_", tx, dentry);
413382
414383 /* Don't touch these if you don't know what you are doing */
415
- fd = debugfs_create_u8("rx_size_auto_shrink", 0600, dentry,
416
- &i2400mu->rx_size_auto_shrink);
417
- result = PTR_ERR(fd);
418
- if (IS_ERR(fd) && result != -ENODEV) {
419
- dev_err(dev, "Can't create debugfs entry "
420
- "rx_size_auto_shrink: %d\n", result);
421
- goto error;
422
- }
384
+ debugfs_create_u8("rx_size_auto_shrink", 0600, dentry,
385
+ &i2400mu->rx_size_auto_shrink);
423386
424
- fd = debugfs_create_size_t("rx_size", 0600, dentry,
425
- &i2400mu->rx_size);
426
- result = PTR_ERR(fd);
427
- if (IS_ERR(fd) && result != -ENODEV) {
428
- dev_err(dev, "Can't create debugfs entry "
429
- "rx_size: %d\n", result);
430
- goto error;
431
- }
432
-
433
- return 0;
434
-
435
-error:
436
- debugfs_remove_recursive(i2400mu->debugfs_dentry);
437
- return result;
387
+ debugfs_create_size_t("rx_size", 0600, dentry, &i2400mu->rx_size);
438388 }
439389
440390
....@@ -548,15 +498,9 @@
548498 dev_err(dev, "cannot setup device: %d\n", result);
549499 goto error_setup;
550500 }
551
- result = i2400mu_debugfs_add(i2400mu);
552
- if (result < 0) {
553
- dev_err(dev, "Can't register i2400mu's debugfs: %d\n", result);
554
- goto error_debugfs_add;
555
- }
501
+ i2400mu_debugfs_add(i2400mu);
556502 return 0;
557503
558
-error_debugfs_add:
559
- i2400m_release(i2400m);
560504 error_setup:
561505 usb_set_intfdata(iface, NULL);
562506 usb_put_dev(i2400mu->usb_dev);
....@@ -567,7 +511,7 @@
567511
568512
569513 /*
570
- * Disconect a i2400m from the system.
514
+ * Disconnect a i2400m from the system.
571515 *
572516 * i2400m_stop() has been called before, so al the rx and tx contexts
573517 * have been taken down already. Make sure the queue is stopped,