hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/misc/sgi-gru/gruprocfs.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * SN Platform GRU Driver
34 *
....@@ -6,20 +7,6 @@
67 * This file supports the /proc interfaces for the GRU driver
78 *
89 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2310 */
2411
2512 #include <linux/proc_fs.h>
....@@ -132,7 +119,7 @@
132119 "cch_interrupt_sync", "cch_deallocate", "tfh_write_only",
133120 "tfh_write_restart", "tgh_invalidate"};
134121
135
- seq_printf(s, "%-20s%12s%12s%12s\n", "#id", "count", "aver-clks", "max-clks");
122
+ seq_puts(s, "#id count aver-clks max-clks\n");
136123 for (op = 0; op < mcsop_last; op++) {
137124 count = atomic_long_read(&mcs_op_statistics[op].count);
138125 total = atomic_long_read(&mcs_op_statistics[op].total);
....@@ -178,8 +165,7 @@
178165 const char *mode[] = { "??", "UPM", "INTR", "OS_POLL" };
179166
180167 if (gid == 0)
181
- seq_printf(file, "#%5s%5s%6s%7s%9s%6s%8s%8s\n", "gid", "bid",
182
- "ctx#", "asid", "pid", "cbrs", "dsbytes", "mode");
168
+ seq_puts(file, "# gid bid ctx# asid pid cbrs dsbytes mode\n");
183169 if (gru)
184170 for (i = 0; i < GRU_NUM_CCH; i++) {
185171 ts = gru->gs_gts[i];
....@@ -204,10 +190,8 @@
204190 struct gru_state *gru = GID_TO_GRU(gid);
205191
206192 if (gid == 0) {
207
- seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "gid", "nid",
208
- "ctx", "cbr", "dsr", "ctx", "cbr", "dsr");
209
- seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "", "", "busy",
210
- "busy", "busy", "free", "free", "free");
193
+ seq_puts(file, "# gid nid ctx cbr dsr ctx cbr dsr\n");
194
+ seq_puts(file, "# busy busy busy free free free\n");
211195 }
212196 if (gru) {
213197 ctxfree = GRU_NUM_CCH - gru->gs_active_contexts;
....@@ -271,28 +255,28 @@
271255 }
272256
273257 /* *INDENT-OFF* */
274
-static const struct file_operations statistics_fops = {
275
- .open = statistics_open,
276
- .read = seq_read,
277
- .write = statistics_write,
278
- .llseek = seq_lseek,
279
- .release = single_release,
258
+static const struct proc_ops statistics_proc_ops = {
259
+ .proc_open = statistics_open,
260
+ .proc_read = seq_read,
261
+ .proc_write = statistics_write,
262
+ .proc_lseek = seq_lseek,
263
+ .proc_release = single_release,
280264 };
281265
282
-static const struct file_operations mcs_statistics_fops = {
283
- .open = mcs_statistics_open,
284
- .read = seq_read,
285
- .write = mcs_statistics_write,
286
- .llseek = seq_lseek,
287
- .release = single_release,
266
+static const struct proc_ops mcs_statistics_proc_ops = {
267
+ .proc_open = mcs_statistics_open,
268
+ .proc_read = seq_read,
269
+ .proc_write = mcs_statistics_write,
270
+ .proc_lseek = seq_lseek,
271
+ .proc_release = single_release,
288272 };
289273
290
-static const struct file_operations options_fops = {
291
- .open = options_open,
292
- .read = seq_read,
293
- .write = options_write,
294
- .llseek = seq_lseek,
295
- .release = single_release,
274
+static const struct proc_ops options_proc_ops = {
275
+ .proc_open = options_open,
276
+ .proc_read = seq_read,
277
+ .proc_write = options_write,
278
+ .proc_lseek = seq_lseek,
279
+ .proc_release = single_release,
296280 };
297281
298282 static struct proc_dir_entry *proc_gru __read_mostly;
....@@ -302,11 +286,11 @@
302286 proc_gru = proc_mkdir("sgi_uv/gru", NULL);
303287 if (!proc_gru)
304288 return -1;
305
- if (!proc_create("statistics", 0644, proc_gru, &statistics_fops))
289
+ if (!proc_create("statistics", 0644, proc_gru, &statistics_proc_ops))
306290 goto err;
307
- if (!proc_create("mcs_statistics", 0644, proc_gru, &mcs_statistics_fops))
291
+ if (!proc_create("mcs_statistics", 0644, proc_gru, &mcs_statistics_proc_ops))
308292 goto err;
309
- if (!proc_create("debug_options", 0644, proc_gru, &options_fops))
293
+ if (!proc_create("debug_options", 0644, proc_gru, &options_proc_ops))
310294 goto err;
311295 if (!proc_create_seq("cch_status", 0444, proc_gru, &cch_seq_ops))
312296 goto err;