forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/ti/wlcore/debugfs.h
....@@ -1,24 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * This file is part of wl1271
34 *
45 * Copyright (C) 2009 Nokia Corporation
56 *
67 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
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.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
21
- *
228 */
239
2410 #ifndef __DEBUGFS_H__
....@@ -53,19 +39,15 @@
5339
5440 #define DEBUGFS_ADD(name, parent) \
5541 do { \
56
- entry = debugfs_create_file(#name, 0400, parent, \
57
- wl, &name## _ops); \
58
- if (!entry || IS_ERR(entry)) \
59
- goto err; \
42
+ debugfs_create_file(#name, 0400, parent, \
43
+ wl, &name## _ops); \
6044 } while (0)
6145
6246
6347 #define DEBUGFS_ADD_PREFIX(prefix, name, parent) \
6448 do { \
65
- entry = debugfs_create_file(#name, 0400, parent, \
49
+ debugfs_create_file(#name, 0400, parent, \
6650 wl, &prefix## _## name## _ops); \
67
- if (!entry || IS_ERR(entry)) \
68
- goto err; \
6951 } while (0)
7052
7153 #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \
....@@ -96,13 +78,14 @@
9678 struct wl1271 *wl = file->private_data; \
9779 struct struct_type *stats = wl->stats.fw_stats; \
9880 char buf[DEBUGFS_FORMAT_BUFFER_SIZE] = ""; \
99
- int res, i; \
81
+ int pos = 0; \
82
+ int i; \
10083 \
10184 wl1271_debugfs_update_stats(wl); \
10285 \
103
- for (i = 0; i < len; i++) \
104
- res = snprintf(buf, sizeof(buf), "%s[%d] = %d\n", \
105
- buf, i, stats->sub.name[i]); \
86
+ for (i = 0; i < len && pos < sizeof(buf); i++) \
87
+ pos += snprintf(buf + pos, sizeof(buf) - pos, \
88
+ "[%d] = %d\n", i, stats->sub.name[i]); \
10689 \
10790 return wl1271_format_buffer(userbuf, count, ppos, "%s", buf); \
10891 } \