hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/kernel/time/timekeeping_debug.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * debugfs file to track time spent in suspend
34 *
45 * Copyright (c) 2011, Google, Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful, but WITHOUT
12
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
- * more details.
156 */
167
178 #include <linux/debugfs.h>
....@@ -28,7 +19,7 @@
2819
2920 static unsigned int sleep_time_bin[NUM_BINS] = {0};
3021
31
-static int tk_debug_show_sleep_time(struct seq_file *s, void *data)
22
+static int tk_debug_sleep_time_show(struct seq_file *s, void *data)
3223 {
3324 unsigned int bin;
3425 seq_puts(s, " time (secs) count\n");
....@@ -42,30 +33,12 @@
4233 }
4334 return 0;
4435 }
45
-
46
-static int tk_debug_sleep_time_open(struct inode *inode, struct file *file)
47
-{
48
- return single_open(file, tk_debug_show_sleep_time, NULL);
49
-}
50
-
51
-static const struct file_operations tk_debug_sleep_time_fops = {
52
- .open = tk_debug_sleep_time_open,
53
- .read = seq_read,
54
- .llseek = seq_lseek,
55
- .release = single_release,
56
-};
36
+DEFINE_SHOW_ATTRIBUTE(tk_debug_sleep_time);
5737
5838 static int __init tk_debug_sleep_time_init(void)
5939 {
60
- struct dentry *d;
61
-
62
- d = debugfs_create_file("sleep_time", 0444, NULL, NULL,
63
- &tk_debug_sleep_time_fops);
64
- if (!d) {
65
- pr_err("Failed to create sleep_time debug file\n");
66
- return -ENOMEM;
67
- }
68
-
40
+ debugfs_create_file("sleep_time", 0444, NULL, NULL,
41
+ &tk_debug_sleep_time_fops);
6942 return 0;
7043 }
7144 late_initcall(tk_debug_sleep_time_init);