aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-10 19:21:15 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:41:58 -0400
commit24270156ac94a54cfaa7326375ed44d0902f58c5 (patch)
tree00478acb62b8a7bfb04d4212e499fe16c6ecf429 /arch/mips
parent28ff11882a2ec50916b2b52016d80ec52461e5f9 (diff)
mips: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use proc_create_data() and seq_file instead. Signed-off-by: David Howells <dhowells@redhat.com> cc: Ralf Baechle <ralf@linux-mips.org> cc: linux-mips@linux-mips.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/smtc-proc.c64
-rw-r--r--arch/mips/pci/ops-pmcmsp.c95
-rw-r--r--arch/mips/sibyte/sb1250/bus_watcher.c81
3 files changed, 104 insertions, 136 deletions
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
index aee7c8177b5d..9fb714450e95 100644
--- a/arch/mips/kernel/smtc-proc.c
+++ b/arch/mips/kernel/smtc-proc.c
@@ -16,6 +16,7 @@
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/seq_file.h>
19 20
20#include <asm/smtc_proc.h> 21#include <asm/smtc_proc.h>
21 22
@@ -30,51 +31,39 @@ unsigned long selfipis[NR_CPUS];
30 31
31struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; 32struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
32 33
33static struct proc_dir_entry *smtc_stats;
34
35atomic_t smtc_fpu_recoveries; 34atomic_t smtc_fpu_recoveries;
36 35
37static int proc_read_smtc(char *page, char **start, off_t off, 36static int smtc_proc_show(struct seq_file *m, void *v)
38 int count, int *eof, void *data)
39{ 37{
40 int totalen = 0;
41 int len;
42 int i; 38 int i;
43 extern unsigned long ebase; 39 extern unsigned long ebase;
44 40
45 len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); 41 seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status);
46 totalen += len; 42 seq_printf(m, "Config7: 0x%08x\n", read_c0_config7());
47 page += len; 43 seq_printf(m, "EBASE: 0x%08lx\n", ebase);
48 len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); 44 seq_printf(m, "Counter Interrupts taken per CPU (TC)\n");
49 totalen += len; 45 for (i=0; i < NR_CPUS; i++)
50 page += len; 46 seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
51 len = sprintf(page, "EBASE: 0x%08lx\n", ebase); 47 seq_printf(m, "Self-IPIs by CPU:\n");
52 totalen += len; 48 for(i = 0; i < NR_CPUS; i++)
53 page += len; 49 seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
54 len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); 50 seq_printf(m, "%d Recoveries of \"stolen\" FPU\n",
55 totalen += len; 51 atomic_read(&smtc_fpu_recoveries));
56 page += len; 52 return 0;
57 for (i=0; i < NR_CPUS; i++) { 53}
58 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
59 totalen += len;
60 page += len;
61 }
62 len = sprintf(page, "Self-IPIs by CPU:\n");
63 totalen += len;
64 page += len;
65 for(i = 0; i < NR_CPUS; i++) {
66 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
67 totalen += len;
68 page += len;
69 }
70 len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n",
71 atomic_read(&smtc_fpu_recoveries));
72 totalen += len;
73 page += len;
74 54
75 return totalen; 55static int smtc_proc_open(struct inode *inode, struct file *file)
56{
57 return single_open(file, smtc_proc_show, NULL);
76} 58}
77 59
60static const struct file_operations smtc_proc_fops = {
61 .open = smtc_proc_open,
62 .read = seq_read,
63 .llseek = seq_lseek,
64 .release = seq_release,
65};
66
78void init_smtc_stats(void) 67void init_smtc_stats(void)
79{ 68{
80 int i; 69 int i;
@@ -86,6 +75,5 @@ void init_smtc_stats(void)
86 75
87 atomic_set(&smtc_fpu_recoveries, 0); 76 atomic_set(&smtc_fpu_recoveries, 0);
88 77
89 smtc_stats = create_proc_read_entry("smtc", 0444, NULL, 78 proc_create("smtc", 0444, NULL, &smtc_proc_fops);
90 proc_read_smtc, NULL);
91} 79}
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index d0b6f8399b07..4eaab6327369 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -53,56 +53,51 @@ static void pci_proc_init(void);
53 53
54/***************************************************************************** 54/*****************************************************************************
55 * 55 *
56 * FUNCTION: read_msp_pci_counts 56 * FUNCTION: show_msp_pci_counts
57 * _________________________________________________________________________ 57 * _________________________________________________________________________
58 * 58 *
59 * DESCRIPTION: Prints the count of how many times each PCI 59 * DESCRIPTION: Prints the count of how many times each PCI
60 * interrupt has asserted. Can be invoked by the 60 * interrupt has asserted. Can be invoked by the
61 * /proc filesystem. 61 * /proc filesystem.
62 * 62 *
63 * INPUTS: page - part of STDOUT calculation 63 * INPUTS: m - synthetic file construction data
64 * off - part of STDOUT calculation 64 * v - iterator
65 * count - part of STDOUT calculation
66 * data - unused
67 * 65 *
68 * OUTPUTS: start - new start location 66 * RETURNS: 0 or error
69 * eof - end of file pointer
70 *
71 * RETURNS: len - STDOUT length
72 * 67 *
73 ****************************************************************************/ 68 ****************************************************************************/
74static int read_msp_pci_counts(char *page, char **start, off_t off, 69static int show_msp_pci_counts(struct seq_file *m, void *v)
75 int count, int *eof, void *data)
76{ 70{
77 int i; 71 int i;
78 int len = 0;
79 unsigned int intcount, total = 0; 72 unsigned int intcount, total = 0;
80 73
81 for (i = 0; i < 32; ++i) { 74 for (i = 0; i < 32; ++i) {
82 intcount = pci_int_count[i]; 75 intcount = pci_int_count[i];
83 if (intcount != 0) { 76 if (intcount != 0) {
84 len += sprintf(page + len, "[%d] = %u\n", i, intcount); 77 seq_printf(m, "[%d] = %u\n", i, intcount);
85 total += intcount; 78 total += intcount;
86 } 79 }
87 } 80 }
88 81
89 len += sprintf(page + len, "total = %u\n", total); 82 seq_printf(m, "total = %u\n", total);
90 if (len <= off+count) 83 return 0;
91 *eof = 1; 84}
92
93 *start = page + off;
94 len -= off;
95 if (len > count)
96 len = count;
97 if (len < 0)
98 len = 0;
99 85
100 return len; 86static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file)
87{
88 return single_open(file, show_msp_pci_counts, NULL);
101} 89}
102 90
91static const struct file_operations msp_pci_rd_cnt_fops = {
92 .open = msp_pci_rd_cnt_open,
93 .read = seq_read,
94 .llseek = seq_lseek,
95 .release = seq_release,
96};
97
103/***************************************************************************** 98/*****************************************************************************
104 * 99 *
105 * FUNCTION: gen_pci_cfg_wr 100 * FUNCTION: gen_pci_cfg_wr_show
106 * _________________________________________________________________________ 101 * _________________________________________________________________________
107 * 102 *
108 * DESCRIPTION: Generates a configuration write cycle for debug purposes. 103 * DESCRIPTION: Generates a configuration write cycle for debug purposes.
@@ -112,37 +107,30 @@ static int read_msp_pci_counts(char *page, char **start, off_t off,
112 * PCI bus. Intent is that this function by invocable from 107 * PCI bus. Intent is that this function by invocable from
113 * the /proc filesystem. 108 * the /proc filesystem.
114 * 109 *
115 * INPUTS: page - part of STDOUT calculation 110 * INPUTS: m - synthetic file construction data
116 * off - part of STDOUT calculation 111 * v - iterator
117 * count - part of STDOUT calculation
118 * data - unused
119 * 112 *
120 * OUTPUTS: start - new start location 113 * RETURNS: 0 or error
121 * eof - end of file pointer
122 *
123 * RETURNS: len - STDOUT length
124 * 114 *
125 ****************************************************************************/ 115 ****************************************************************************/
126static int gen_pci_cfg_wr(char *page, char **start, off_t off, 116static int gen_pci_cfg_wr_show(struct seq_file *m, void *v)
127 int count, int *eof, void *data)
128{ 117{
129 unsigned char where = 0; /* Write to static Device/Vendor ID */ 118 unsigned char where = 0; /* Write to static Device/Vendor ID */
130 unsigned char bus_num = 0; /* Bus 0 */ 119 unsigned char bus_num = 0; /* Bus 0 */
131 unsigned char dev_fn = 0xF; /* Arbitrary device number */ 120 unsigned char dev_fn = 0xF; /* Arbitrary device number */
132 u32 wr_data = 0xFF00AA00; /* Arbitrary data */ 121 u32 wr_data = 0xFF00AA00; /* Arbitrary data */
133 struct msp_pci_regs *preg = (void *)PCI_BASE_REG; 122 struct msp_pci_regs *preg = (void *)PCI_BASE_REG;
134 int len = 0;
135 unsigned long value; 123 unsigned long value;
136 int intr; 124 int intr;
137 125
138 len += sprintf(page + len, "PMC MSP PCI: Beginning\n"); 126 seq_puts(m, "PMC MSP PCI: Beginning\n");
139 127
140 if (proc_init == 0) { 128 if (proc_init == 0) {
141 pci_proc_init(); 129 pci_proc_init();
142 proc_init = ~0; 130 proc_init = ~0;
143 } 131 }
144 132
145 len += sprintf(page + len, "PMC MSP PCI: Before Cfg Wr\n"); 133 seq_puts(m, "PMC MSP PCI: Before Cfg Wr\n");
146 134
147 /* 135 /*
148 * Generate PCI Configuration Write Cycle 136 * Generate PCI Configuration Write Cycle
@@ -168,21 +156,22 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
168 */ 156 */
169 intr = preg->if_status; 157 intr = preg->if_status;
170 158
171 len += sprintf(page + len, "PMC MSP PCI: After Cfg Wr\n"); 159 seq_puts(m, "PMC MSP PCI: After Cfg Wr\n");
172 160 return 0;
173 /* Handle STDOUT calculations */ 161}
174 if (len <= off+count)
175 *eof = 1;
176 *start = page + off;
177 len -= off;
178 if (len > count)
179 len = count;
180 if (len < 0)
181 len = 0;
182 162
183 return len; 163static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file)
164{
165 return single_open(file, gen_pci_cfg_wr_show, NULL);
184} 166}
185 167
168static const struct file_operations gen_pci_cfg_wr_fops = {
169 .open = gen_pci_cfg_wr_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = seq_release,
173};
174
186/***************************************************************************** 175/*****************************************************************************
187 * 176 *
188 * FUNCTION: pci_proc_init 177 * FUNCTION: pci_proc_init
@@ -199,10 +188,8 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
199 ****************************************************************************/ 188 ****************************************************************************/
200static void pci_proc_init(void) 189static void pci_proc_init(void)
201{ 190{
202 create_proc_read_entry("pmc_msp_pci_rd_cnt", 0, NULL, 191 proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops);
203 read_msp_pci_counts, NULL); 192 proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops);
204 create_proc_read_entry("pmc_msp_pci_cfg_wr", 0, NULL,
205 gen_pci_cfg_wr, NULL);
206} 193}
207#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 194#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
208 195
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c
index e651105b3f0b..cb1e3cb37d70 100644
--- a/arch/mips/sibyte/sb1250/bus_watcher.c
+++ b/arch/mips/sibyte/sb1250/bus_watcher.c
@@ -30,6 +30,7 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h>
33#include <asm/io.h> 34#include <asm/io.h>
34 35
35#include <asm/sibyte/sb1250.h> 36#include <asm/sibyte/sb1250.h>
@@ -99,63 +100,60 @@ void check_bus_watcher(void)
99 printk("Bus watcher indicates no error\n"); 100 printk("Bus watcher indicates no error\n");
100} 101}
101 102
102static int bw_print_buffer(char *page, struct bw_stats_struct *stats) 103#ifdef CONFIG_PROC_FS
104
105/* For simplicity, I want to assume a single read is required each
106 time */
107static int bw_proc_show(struct seq_file *m, void *v)
103{ 108{
104 int len; 109 struct bw_stats_struct *stats = m->private;
105 110
106 len = sprintf(page, "SiByte Bus Watcher statistics\n"); 111 seq_puts(m, "SiByte Bus Watcher statistics\n");
107 len += sprintf(page+len, "-----------------------------\n"); 112 seq_puts(m, "-----------------------------\n");
108 len += sprintf(page+len, "L2-d-cor %8ld\nL2-d-bad %8ld\n", 113 seq_printf(m, "L2-d-cor %8ld\nL2-d-bad %8ld\n",
109 stats->l2_cor_d, stats->l2_bad_d); 114 stats->l2_cor_d, stats->l2_bad_d);
110 len += sprintf(page+len, "L2-t-cor %8ld\nL2-t-bad %8ld\n", 115 seq_printf(m, "L2-t-cor %8ld\nL2-t-bad %8ld\n",
111 stats->l2_cor_t, stats->l2_bad_t); 116 stats->l2_cor_t, stats->l2_bad_t);
112 len += sprintf(page+len, "MC-d-cor %8ld\nMC-d-bad %8ld\n", 117 seq_printf(m, "MC-d-cor %8ld\nMC-d-bad %8ld\n",
113 stats->mem_cor_d, stats->mem_bad_d); 118 stats->mem_cor_d, stats->mem_bad_d);
114 len += sprintf(page+len, "IO-err %8ld\n", stats->bus_error); 119 seq_printf(m, "IO-err %8ld\n", stats->bus_error);
115 len += sprintf(page+len, "\nLast recorded signature:\n"); 120 seq_puts(m, "\nLast recorded signature:\n");
116 len += sprintf(page+len, "Request %02x from %d, answered by %d with Dcode %d\n", 121 seq_printf(m, "Request %02x from %d, answered by %d with Dcode %d\n",
117 (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f), 122 (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f),
118 (int)(G_SCD_BERR_TID(stats->status) >> 6), 123 (int)(G_SCD_BERR_TID(stats->status) >> 6),
119 (int)G_SCD_BERR_RID(stats->status), 124 (int)G_SCD_BERR_RID(stats->status),
120 (int)G_SCD_BERR_DCODE(stats->status)); 125 (int)G_SCD_BERR_DCODE(stats->status));
121 /* XXXKW indicate multiple errors between printings, or stats 126 /* XXXKW indicate multiple errors between printings, or stats
122 collection (or both)? */ 127 collection (or both)? */
123 if (stats->status & M_SCD_BERR_MULTERRS) 128 if (stats->status & M_SCD_BERR_MULTERRS)
124 len += sprintf(page+len, "Multiple errors observed since last check.\n"); 129 seq_puts(m, "Multiple errors observed since last check.\n");
125 if (stats->status_printed) { 130 if (stats->status_printed) {
126 len += sprintf(page+len, "(no change since last printing)\n"); 131 seq_puts(m, "(no change since last printing)\n");
127 } else { 132 } else {
128 stats->status_printed = 1; 133 stats->status_printed = 1;
129 } 134 }
130 135
131 return len; 136 return 0;
132} 137}
133 138
134#ifdef CONFIG_PROC_FS 139static int bw_proc_open(struct inode *inode, struct file *file)
135
136/* For simplicity, I want to assume a single read is required each
137 time */
138static int bw_read_proc(char *page, char **start, off_t off,
139 int count, int *eof, void *data)
140{ 140{
141 int len; 141 return single_open(file, bw_proc_show, PDE_DATA(inode));
142
143 if (off == 0) {
144 len = bw_print_buffer(page, data);
145 *start = page;
146 } else {
147 len = 0;
148 *eof = 1;
149 }
150 return len;
151} 142}
152 143
144static const struct file_operations bw_proc_fops = {
145 .open = bw_proc_open,
146 .read = seq_read,
147 .llseek = seq_lseek,
148 .release = seq_release,
149};
150
153static void create_proc_decoder(struct bw_stats_struct *stats) 151static void create_proc_decoder(struct bw_stats_struct *stats)
154{ 152{
155 struct proc_dir_entry *ent; 153 struct proc_dir_entry *ent;
156 154
157 ent = create_proc_read_entry("bus_watcher", S_IWUSR | S_IRUGO, NULL, 155 ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL,
158 bw_read_proc, stats); 156 &bw_proc_fops, stats);
159 if (!ent) { 157 if (!ent) {
160 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); 158 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
161 return; 159 return;
@@ -210,11 +208,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
210 stats->bus_error += G_SCD_MEM_BUSERR(cntr); 208 stats->bus_error += G_SCD_MEM_BUSERR(cntr);
211 csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS)); 209 csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS));
212 210
213#ifndef CONFIG_PROC_FS
214 bw_print_buffer(bw_buf, stats);
215 printk(bw_buf);
216#endif
217
218 return IRQ_HANDLED; 211 return IRQ_HANDLED;
219} 212}
220 213