hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/dma-buf/sync_debug.c
....@@ -1,23 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Sync File validation framework and debug information
34 *
45 * Copyright (C) 2012 Google, Inc.
5
- *
6
- * This software is licensed under the terms of the GNU General Public
7
- * License version 2, as published by the Free Software Foundation, and
8
- * may be copied, distributed, and modified under those terms.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
156 */
167
178 #include <linux/debugfs.h>
189 #include "sync_debug.h"
1910
20
-#ifdef CONFIG_DEBUG_FS
2111 static struct dentry *dbgfs;
2212
2313 static LIST_HEAD(sync_timeline_list_head);
....@@ -148,7 +138,7 @@
148138 }
149139 }
150140
151
-static int sync_debugfs_show(struct seq_file *s, void *unused)
141
+static int sync_info_debugfs_show(struct seq_file *s, void *unused)
152142 {
153143 struct list_head *pos;
154144
....@@ -179,17 +169,7 @@
179169 return 0;
180170 }
181171
182
-static int sync_info_debugfs_open(struct inode *inode, struct file *file)
183
-{
184
- return single_open(file, sync_debugfs_show, inode->i_private);
185
-}
186
-
187
-static const struct file_operations sync_info_debugfs_fops = {
188
- .open = sync_info_debugfs_open,
189
- .read = seq_read,
190
- .llseek = seq_lseek,
191
- .release = single_release,
192
-};
172
+DEFINE_SHOW_ATTRIBUTE(sync_info_debugfs);
193173
194174 static __init int sync_debugfs_init(void)
195175 {
....@@ -208,30 +188,3 @@
208188 return 0;
209189 }
210190 late_initcall(sync_debugfs_init);
211
-
212
-#define DUMP_CHUNK 256
213
-static char sync_dump_buf[64 * 1024];
214
-void sync_dump(void)
215
-{
216
- struct seq_file s = {
217
- .buf = sync_dump_buf,
218
- .size = sizeof(sync_dump_buf) - 1,
219
- };
220
- int i;
221
-
222
- sync_debugfs_show(&s, NULL);
223
-
224
- for (i = 0; i < s.count; i += DUMP_CHUNK) {
225
- if ((s.count - i) > DUMP_CHUNK) {
226
- char c = s.buf[i + DUMP_CHUNK];
227
-
228
- s.buf[i + DUMP_CHUNK] = 0;
229
- pr_cont("%s", s.buf + i);
230
- s.buf[i + DUMP_CHUNK] = c;
231
- } else {
232
- s.buf[s.count] = 0;
233
- pr_cont("%s", s.buf + i);
234
- }
235
- }
236
-}
237
-#endif