hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/wireless/realtek/rtlwifi/debug.c
....@@ -1,26 +1,5 @@
1
-/******************************************************************************
2
- *
3
- * Copyright(c) 2009-2012 Realtek Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of version 2 of the GNU General Public License as
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * The full GNU General Public License is included in this distribution in the
15
- * file called LICENSE.
16
- *
17
- * Contact Information:
18
- * wlanfae <wlanfae@realtek.com>
19
- * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20
- * Hsinchu 300, Taiwan.
21
- *
22
- * Larry Finger <Larry.Finger@lwfinger.net>
23
- *****************************************************************************/
1
+// SPDX-License-Identifier: GPL-2.0
2
+/* Copyright(c) 2009-2012 Realtek Corporation.*/
243
254 #include "wifi.h"
265 #include "cam.h"
....@@ -29,26 +8,6 @@
298 #include <linux/vmalloc.h>
309
3110 #ifdef CONFIG_RTLWIFI_DEBUG
32
-void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
33
- const char *fmt, ...)
34
-{
35
- if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
36
- level <= rtlpriv->cfg->mod_params->debug_level)) {
37
- struct va_format vaf;
38
- va_list args;
39
-
40
- va_start(args, fmt);
41
-
42
- vaf.fmt = fmt;
43
- vaf.va = &args;
44
-
45
- pr_info(":<%lx> %pV", in_interrupt(), &vaf);
46
-
47
- va_end(args);
48
- }
49
-}
50
-EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
51
-
5211 void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
5312 const char *fmt, ...)
5413 {
....@@ -370,8 +329,8 @@
370329
371330 tmp_len = (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count);
372331
373
- if (!buffer || copy_from_user(tmp, buffer, tmp_len))
374
- return count;
332
+ if (copy_from_user(tmp, buffer, tmp_len))
333
+ return -EFAULT;
375334
376335 tmp[tmp_len] = '\0';
377336
....@@ -381,8 +340,8 @@
381340 &h2c_data[4], &h2c_data[5],
382341 &h2c_data[6], &h2c_data[7]);
383342
384
- if (h2c_len <= 0)
385
- return count;
343
+ if (h2c_len == 0)
344
+ return -EINVAL;
386345
387346 for (i = 0; i < h2c_len; i++)
388347 h2c_data_packed[i] = (u8)h2c_data[i];
....@@ -425,8 +384,8 @@
425384 &path, &addr, &bitmask, &data);
426385
427386 if (num != 4) {
428
- RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
429
- "Format is <path> <addr> <mask> <data>\n");
387
+ rtl_dbg(rtlpriv, COMP_ERR, DBG_DMESG,
388
+ "Format is <path> <addr> <mask> <data>\n");
430389 return count;
431390 }
432391
....@@ -463,12 +422,9 @@
463422 #define RTL_DEBUGFS_ADD_CORE(name, mode, fopname) \
464423 do { \
465424 rtl_debug_priv_ ##name.rtlpriv = rtlpriv; \
466
- if (!debugfs_create_file(#name, mode, \
467
- parent, &rtl_debug_priv_ ##name, \
468
- &file_ops_ ##fopname)) \
469
- pr_err("Unable to initialize debugfs:%s/%s\n", \
470
- rtlpriv->dbg.debugfs_name, \
471
- #name); \
425
+ debugfs_create_file(#name, mode, parent, \
426
+ &rtl_debug_priv_ ##name, \
427
+ &file_ops_ ##fopname); \
472428 } while (0)
473429
474430 #define RTL_DEBUGFS_ADD(name) \
....@@ -486,11 +442,6 @@
486442
487443 rtlpriv->dbg.debugfs_dir =
488444 debugfs_create_dir(rtlpriv->dbg.debugfs_name, debugfs_topdir);
489
- if (!rtlpriv->dbg.debugfs_dir) {
490
- pr_err("Unable to init debugfs:/%s/%s\n", rtlpriv->cfg->name,
491
- rtlpriv->dbg.debugfs_name);
492
- return;
493
- }
494445
495446 parent = rtlpriv->dbg.debugfs_dir;
496447