f9b7c3baddcdf3a02613ca65eb8dfd45dad4c0fc
[openwrt/staging/xback.git] /
1 From a283da4533745e3552b889dce7e31ada9d99c5d2 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Fri, 1 Jun 2018 13:10:00 +0200
4 Subject: [PATCH 382/454] staging: vc04_services: remove odd
5 vchiq_debugfs_top() wrapper
6
7 commit 2739deaece4bc25fba5df0566423f4a11c3f4e84 upstream
8
9 vchiq_debugfs_top() is only a wrapper around a pointer to a dentry, so
10 just use the dentry directly instead, making it a static variable
11 instead of part of a static structure.
12
13 This also removes the pointless BUG_ON() when checking that dentry as no
14 one should ever care if debugfs is working or not, and the kernel should
15 really not panic over something as trivial as that.
16
17 Suggested-by: Eric Anholt <eric@anholt.net>
18 Cc: Stefan Wahren <stefan.wahren@i2se.com>
19 Cc: Kees Cook <keescook@chromium.org>
20 Cc: Dan Carpenter <dan.carpenter@oracle.com>
21 Cc: Arnd Bergmann <arnd@arndb.de>
22 Cc: Keerthi Reddy <keerthigd4990@gmail.com>
23 Cc: linux-rpi-kernel@lists.infradead.org
24 Cc: linux-arm-kernel@lists.infradead.org
25 Reviewed-by: Eric Anholt <eric@anholt.net>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 ---
28 .../interface/vchiq_arm/vchiq_debugfs.c | 24 +++++++------------
29 1 file changed, 8 insertions(+), 16 deletions(-)
30
31 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
32 +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
33 @@ -55,9 +55,6 @@
34
35 /* Top-level debug info */
36 struct vchiq_debugfs_info {
37 - /* Global 'vchiq' debugfs entry used by all instances */
38 - struct dentry *vchiq_cfg_dir;
39 -
40 /* one entry per client process */
41 struct dentry *clients;
42
43 @@ -67,6 +64,9 @@ struct vchiq_debugfs_info {
44
45 static struct vchiq_debugfs_info debugfs_info;
46
47 +/* Global 'vchiq' debugfs entry used by all instances */
48 +struct dentry *vchiq_dbg_dir;
49 +
50 /* Log category debugfs entries */
51 struct vchiq_debugfs_log_entry {
52 const char *name;
53 @@ -84,7 +84,6 @@ static struct vchiq_debugfs_log_entry vc
54 static int n_log_entries = ARRAY_SIZE(vchiq_debugfs_log_entries);
55
56 static struct dentry *vchiq_clients_top(void);
57 -static struct dentry *vchiq_debugfs_top(void);
58
59 static int debugfs_log_show(struct seq_file *f, void *offset)
60 {
61 @@ -165,7 +164,7 @@ static void vchiq_debugfs_create_log_ent
62 struct dentry *dir;
63 size_t i;
64
65 - dir = debugfs_create_dir("log", vchiq_debugfs_top());
66 + dir = debugfs_create_dir("log", vchiq_dbg_dir);
67 debugfs_info.log_categories = dir;
68
69 for (i = 0; i < n_log_entries; i++) {
70 @@ -288,17 +287,16 @@ void vchiq_debugfs_remove_instance(VCHIQ
71
72 void vchiq_debugfs_init(void)
73 {
74 - debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL);
75 - debugfs_info.clients = debugfs_create_dir("clients",
76 - vchiq_debugfs_top());
77 + vchiq_dbg_dir = debugfs_create_dir("vchiq", NULL);
78 + debugfs_info.clients = debugfs_create_dir("clients", vchiq_dbg_dir);
79
80 - vchiq_debugfs_create_log_entries(vchiq_debugfs_top());
81 + vchiq_debugfs_create_log_entries(vchiq_dbg_dir);
82 }
83
84 /* remove all the debugfs entries */
85 void vchiq_debugfs_deinit(void)
86 {
87 - debugfs_remove_recursive(vchiq_debugfs_top());
88 + debugfs_remove_recursive(vchiq_dbg_dir);
89 }
90
91 static struct dentry *vchiq_clients_top(void)
92 @@ -306,12 +304,6 @@ static struct dentry *vchiq_clients_top(
93 return debugfs_info.clients;
94 }
95
96 -static struct dentry *vchiq_debugfs_top(void)
97 -{
98 - BUG_ON(debugfs_info.vchiq_cfg_dir == NULL);
99 - return debugfs_info.vchiq_cfg_dir;
100 -}
101 -
102 #else /* CONFIG_DEBUG_FS */
103
104 void vchiq_debugfs_init(void)