| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * SN Platform GRU Driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * This file supports the /proc interfaces for the GRU driver |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * 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 |
|---|
| 23 | 10 | */ |
|---|
| 24 | 11 | |
|---|
| 25 | 12 | #include <linux/proc_fs.h> |
|---|
| .. | .. |
|---|
| 132 | 119 | "cch_interrupt_sync", "cch_deallocate", "tfh_write_only", |
|---|
| 133 | 120 | "tfh_write_restart", "tgh_invalidate"}; |
|---|
| 134 | 121 | |
|---|
| 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"); |
|---|
| 136 | 123 | for (op = 0; op < mcsop_last; op++) { |
|---|
| 137 | 124 | count = atomic_long_read(&mcs_op_statistics[op].count); |
|---|
| 138 | 125 | total = atomic_long_read(&mcs_op_statistics[op].total); |
|---|
| .. | .. |
|---|
| 178 | 165 | const char *mode[] = { "??", "UPM", "INTR", "OS_POLL" }; |
|---|
| 179 | 166 | |
|---|
| 180 | 167 | 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"); |
|---|
| 183 | 169 | if (gru) |
|---|
| 184 | 170 | for (i = 0; i < GRU_NUM_CCH; i++) { |
|---|
| 185 | 171 | ts = gru->gs_gts[i]; |
|---|
| .. | .. |
|---|
| 204 | 190 | struct gru_state *gru = GID_TO_GRU(gid); |
|---|
| 205 | 191 | |
|---|
| 206 | 192 | 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"); |
|---|
| 211 | 195 | } |
|---|
| 212 | 196 | if (gru) { |
|---|
| 213 | 197 | ctxfree = GRU_NUM_CCH - gru->gs_active_contexts; |
|---|
| .. | .. |
|---|
| 271 | 255 | } |
|---|
| 272 | 256 | |
|---|
| 273 | 257 | /* *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, |
|---|
| 280 | 264 | }; |
|---|
| 281 | 265 | |
|---|
| 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, |
|---|
| 288 | 272 | }; |
|---|
| 289 | 273 | |
|---|
| 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, |
|---|
| 296 | 280 | }; |
|---|
| 297 | 281 | |
|---|
| 298 | 282 | static struct proc_dir_entry *proc_gru __read_mostly; |
|---|
| .. | .. |
|---|
| 302 | 286 | proc_gru = proc_mkdir("sgi_uv/gru", NULL); |
|---|
| 303 | 287 | if (!proc_gru) |
|---|
| 304 | 288 | return -1; |
|---|
| 305 | | - if (!proc_create("statistics", 0644, proc_gru, &statistics_fops)) |
|---|
| 289 | + if (!proc_create("statistics", 0644, proc_gru, &statistics_proc_ops)) |
|---|
| 306 | 290 | 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)) |
|---|
| 308 | 292 | 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)) |
|---|
| 310 | 294 | goto err; |
|---|
| 311 | 295 | if (!proc_create_seq("cch_status", 0444, proc_gru, &cch_seq_ops)) |
|---|
| 312 | 296 | goto err; |
|---|