forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/powerpc/platforms/pseries/hvCall_inst.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2006 Mike Kravetz IBM Corporation
34 *
45 * Hypervisor Call Instrumentation
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,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
196 */
207
218 #include <linux/kernel.h>
....@@ -83,31 +70,14 @@
8370 return 0;
8471 }
8572
86
-static const struct seq_operations hcall_inst_seq_ops = {
73
+static const struct seq_operations hcall_inst_sops = {
8774 .start = hc_start,
8875 .next = hc_next,
8976 .stop = hc_stop,
9077 .show = hc_show
9178 };
9279
93
-static int hcall_inst_seq_open(struct inode *inode, struct file *file)
94
-{
95
- int rc;
96
- struct seq_file *seq;
97
-
98
- rc = seq_open(file, &hcall_inst_seq_ops);
99
- seq = file->private_data;
100
- seq->private = file_inode(file)->i_private;
101
-
102
- return rc;
103
-}
104
-
105
-static const struct file_operations hcall_inst_seq_fops = {
106
- .open = hcall_inst_seq_open,
107
- .read = seq_read,
108
- .llseek = seq_lseek,
109
- .release = seq_release,
110
-};
80
+DEFINE_SEQ_ATTRIBUTE(hcall_inst);
11181
11282 #define HCALL_ROOT_DIR "hcall_inst"
11383 #define CPU_NAME_BUF_SIZE 32
....@@ -142,7 +112,6 @@
142112 static int __init hcall_inst_init(void)
143113 {
144114 struct dentry *hcall_root;
145
- struct dentry *hcall_file;
146115 char cpu_name_buf[CPU_NAME_BUF_SIZE];
147116 int cpu;
148117
....@@ -158,17 +127,12 @@
158127 }
159128
160129 hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL);
161
- if (!hcall_root)
162
- return -ENOMEM;
163130
164131 for_each_possible_cpu(cpu) {
165132 snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu);
166
- hcall_file = debugfs_create_file(cpu_name_buf, 0444,
167
- hcall_root,
168
- per_cpu(hcall_stats, cpu),
169
- &hcall_inst_seq_fops);
170
- if (!hcall_file)
171
- return -ENOMEM;
133
+ debugfs_create_file(cpu_name_buf, 0444, hcall_root,
134
+ per_cpu(hcall_stats, cpu),
135
+ &hcall_inst_fops);
172136 }
173137
174138 return 0;