.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
1 | 2 | /* |
---|
2 | 3 | * debugfs file to track time spent in suspend |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
15 | 6 | */ |
---|
16 | 7 | |
---|
17 | 8 | #include <linux/debugfs.h> |
---|
.. | .. |
---|
28 | 19 | |
---|
29 | 20 | static unsigned int sleep_time_bin[NUM_BINS] = {0}; |
---|
30 | 21 | |
---|
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) |
---|
32 | 23 | { |
---|
33 | 24 | unsigned int bin; |
---|
34 | 25 | seq_puts(s, " time (secs) count\n"); |
---|
.. | .. |
---|
42 | 33 | } |
---|
43 | 34 | return 0; |
---|
44 | 35 | } |
---|
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); |
---|
57 | 37 | |
---|
58 | 38 | static int __init tk_debug_sleep_time_init(void) |
---|
59 | 39 | { |
---|
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); |
---|
69 | 42 | return 0; |
---|
70 | 43 | } |
---|
71 | 44 | late_initcall(tk_debug_sleep_time_init); |
---|