forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/broadcom/b43/debugfs.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 Broadcom B43 wireless driver
....@@ -6,20 +7,6 @@
67
78 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
89
9
- This program is free software; you can redistribute it and/or modify
10
- it under the terms of the GNU General Public License as published by
11
- the Free Software Foundation; either version 2 of the License, or
12
- (at your option) any later version.
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; see the file COPYING. If not, write to
21
- the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
22
- Boston, MA 02110-1301, USA.
2310
2411 */
2512
....@@ -64,7 +51,7 @@
6451 #define fappend(fmt, x...) \
6552 do { \
6653 if (bufsize - count) \
67
- count += snprintf(buf + count, \
54
+ count += scnprintf(buf + count, \
6855 bufsize - count, \
6956 fmt , ##x); \
7057 else \
....@@ -506,7 +493,7 @@
506493 struct b43_wldev *dev;
507494 struct b43_debugfs_fops *dfops;
508495 struct b43_dfs_file *dfile;
509
- ssize_t uninitialized_var(ret);
496
+ ssize_t ret;
510497 char *buf;
511498 const size_t bufsize = 1024 * 16; /* 16 kiB buffer */
512499 const size_t buforder = get_order(bufsize);
....@@ -668,15 +655,13 @@
668655 static void b43_add_dynamic_debug(struct b43_wldev *dev)
669656 {
670657 struct b43_dfsentry *e = dev->dfsentry;
671
- struct dentry *d;
672658
673
-#define add_dyn_dbg(name, id, initstate) do { \
674
- e->dyn_debug[id] = (initstate); \
675
- d = debugfs_create_bool(name, 0600, e->subdir, \
676
- &(e->dyn_debug[id])); \
677
- if (!IS_ERR(d)) \
678
- e->dyn_debug_dentries[id] = d; \
679
- } while (0)
659
+#define add_dyn_dbg(name, id, initstate) do { \
660
+ e->dyn_debug[id] = (initstate); \
661
+ e->dyn_debug_dentries[id] = \
662
+ debugfs_create_bool(name, 0600, e->subdir, \
663
+ &(e->dyn_debug[id])); \
664
+ } while (0)
680665
681666 add_dyn_dbg("debug_xmitpower", B43_DBG_XMITPOWER, false);
682667 add_dyn_dbg("debug_dmaoverflow", B43_DBG_DMAOVERFLOW, false);
....@@ -718,19 +703,6 @@
718703
719704 snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy));
720705 e->subdir = debugfs_create_dir(devdir, rootdir);
721
- if (!e->subdir || IS_ERR(e->subdir)) {
722
- if (e->subdir == ERR_PTR(-ENODEV)) {
723
- b43dbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not "
724
- "enabled in kernel config\n");
725
- } else {
726
- b43err(dev->wl, "debugfs: cannot create %s directory\n",
727
- devdir);
728
- }
729
- dev->dfsentry = NULL;
730
- kfree(log->log);
731
- kfree(e);
732
- return;
733
- }
734706
735707 e->mmio16read_next = 0xFFFF; /* invalid address */
736708 e->mmio32read_next = 0xFFFF; /* invalid address */
....@@ -741,13 +713,10 @@
741713
742714 #define ADD_FILE(name, mode) \
743715 do { \
744
- struct dentry *d; \
745
- d = debugfs_create_file(__stringify(name), \
716
+ e->file_##name.dentry = \
717
+ debugfs_create_file(__stringify(name), \
746718 mode, e->subdir, dev, \
747719 &fops_##name.fops); \
748
- e->file_##name.dentry = NULL; \
749
- if (!IS_ERR(d)) \
750
- e->file_##name.dentry = d; \
751720 } while (0)
752721
753722
....@@ -818,8 +787,6 @@
818787 void b43_debugfs_init(void)
819788 {
820789 rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
821
- if (IS_ERR(rootdir))
822
- rootdir = NULL;
823790 }
824791
825792 void b43_debugfs_exit(void)