aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-10 20:28:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:41:58 -0400
commite781c3d794282d9fa3ba377fdef221fc948974ec (patch)
tree360dce408ba52deaebb85318422a0c756a97442d /arch/ia64/sn
parent24270156ac94a54cfaa7326375ed44d0902f58c5 (diff)
ia64: 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: Tony Luck <tony.luck@intel.com> cc: Fenghua Yu <fenghua.yu@intel.com> cc: linux-ia64@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/ia64/sn')
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c108
1 files changed, 42 insertions, 66 deletions
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index 90298bda936a..daa8d6badb16 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
14#include <linux/nodemask.h> 15#include <linux/nodemask.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/sn/sn_sal.h> 17#include <asm/sn/sn_sal.h>
@@ -101,18 +102,18 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry,
101/* 102/*
102 * These two routines display the FIT table for each node. 103 * These two routines display the FIT table for each node.
103 */ 104 */
104static int dump_fit_entry(char *page, unsigned long *fentry) 105static void dump_fit_entry(struct seq_file *m, unsigned long *fentry)
105{ 106{
106 unsigned type; 107 unsigned type;
107 108
108 type = FIT_TYPE(fentry[1]); 109 type = FIT_TYPE(fentry[1]);
109 return sprintf(page, "%02x %-25s %x.%02x %016lx %u\n", 110 seq_printf(m, "%02x %-25s %x.%02x %016lx %u\n",
110 type, 111 type,
111 fit_type_name(type), 112 fit_type_name(type),
112 FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]), 113 FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]),
113 fentry[0], 114 fentry[0],
114 /* mult by sixteen to get size in bytes */ 115 /* mult by sixteen to get size in bytes */
115 (unsigned)(fentry[1] & 0xffffff) * 16); 116 (unsigned)(fentry[1] & 0xffffff) * 16);
116} 117}
117 118
118 119
@@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry)
124 * OK except for 4kB pages (and no one is going to do that on SN 125 * OK except for 4kB pages (and no one is going to do that on SN
125 * anyway). 126 * anyway).
126 */ 127 */
127static int 128static int proc_fit_show(struct seq_file *m, void *v)
128dump_fit(char *page, unsigned long nasid)
129{ 129{
130 unsigned long nasid = (unsigned long)m->private;
130 unsigned long fentry[2]; 131 unsigned long fentry[2];
131 int index; 132 int index;
132 char *p;
133 133
134 p = page;
135 for (index=0;;index++) { 134 for (index=0;;index++) {
136 BUG_ON(index * 60 > PAGE_SIZE); 135 BUG_ON(index * 60 > PAGE_SIZE);
137 if (get_fit_entry(nasid, index, fentry, NULL, 0)) 136 if (get_fit_entry(nasid, index, fentry, NULL, 0))
138 break; 137 break;
139 p += dump_fit_entry(p, fentry); 138 dump_fit_entry(m, fentry);
140 } 139 }
140 return 0;
141}
141 142
142 return p - page; 143static int proc_fit_open(struct inode *inode, struct file *file)
144{
145 return single_open(file, proc_fit_show, PDE_DATA(inode));
143} 146}
144 147
145static int 148static const struct file_operations proc_fit_fops = {
146dump_version(char *page, unsigned long nasid) 149 .open = proc_fit_open,
150 .read = seq_read,
151 .llseek = seq_lseek,
152 .release = seq_release,
153};
154
155static int proc_version_show(struct seq_file *m, void *v)
147{ 156{
157 unsigned long nasid = (unsigned long)m->private;
148 unsigned long fentry[2]; 158 unsigned long fentry[2];
149 char banner[128]; 159 char banner[128];
150 int index; 160 int index;
151 int len;
152 161
153 for (index = 0; ; index++) { 162 for (index = 0; ; index++) {
154 if (get_fit_entry(nasid, index, fentry, banner, 163 if (get_fit_entry(nasid, index, fentry, banner,
@@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid)
158 break; 167 break;
159 } 168 }
160 169
161 len = sprintf(page, "%x.%02x\n", FIT_MAJOR(fentry[1]), 170 seq_printf(m, "%x.%02x\n", FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]));
162 FIT_MINOR(fentry[1]));
163 page += len;
164 171
165 if (banner[0]) 172 if (banner[0])
166 len += snprintf(page, PAGE_SIZE-len, "%s\n", banner); 173 seq_printf(m, "%s\n", banner);
167 174 return 0;
168 return len;
169}
170
171/* same as in proc_misc.c */
172static int
173proc_calc_metrics(char *page, char **start, off_t off, int count, int *eof,
174 int len)
175{
176 if (len <= off + count)
177 *eof = 1;
178 *start = page + off;
179 len -= off;
180 if (len > count)
181 len = count;
182 if (len < 0)
183 len = 0;
184 return len;
185} 175}
186 176
187static int 177static int proc_version_open(struct inode *inode, struct file *file)
188read_version_entry(char *page, char **start, off_t off, int count, int *eof,
189 void *data)
190{ 178{
191 int len; 179 return single_open(file, proc_version_show, PDE_DATA(inode));
192
193 /* data holds the NASID of the node */
194 len = dump_version(page, (unsigned long)data);
195 len = proc_calc_metrics(page, start, off, count, eof, len);
196 return len;
197} 180}
198 181
199static int 182static const struct file_operations proc_version_fops = {
200read_fit_entry(char *page, char **start, off_t off, int count, int *eof, 183 .open = proc_version_open,
201 void *data) 184 .read = seq_read,
202{ 185 .llseek = seq_lseek,
203 int len; 186 .release = seq_release,
204 187};
205 /* data holds the NASID of the node */
206 len = dump_fit(page, (unsigned long)data);
207 len = proc_calc_metrics(page, start, off, count, eof, len);
208
209 return len;
210}
211 188
212/* module entry points */ 189/* module entry points */
213int __init prominfo_init(void); 190int __init prominfo_init(void);
@@ -216,12 +193,11 @@ void __exit prominfo_exit(void);
216module_init(prominfo_init); 193module_init(prominfo_init);
217module_exit(prominfo_exit); 194module_exit(prominfo_exit);
218 195
219static struct proc_dir_entry *sgi_prominfo_entry;
220
221#define NODE_NAME_LEN 11 196#define NODE_NAME_LEN 11
222 197
223int __init prominfo_init(void) 198int __init prominfo_init(void)
224{ 199{
200 struct proc_dir_entry *sgi_prominfo_entry;
225 cnodeid_t cnodeid; 201 cnodeid_t cnodeid;
226 202
227 if (!ia64_platform_is("sn2")) 203 if (!ia64_platform_is("sn2"))
@@ -241,10 +217,10 @@ int __init prominfo_init(void)
241 if (!dir) 217 if (!dir)
242 continue; 218 continue;
243 nasid = cnodeid_to_nasid(cnodeid); 219 nasid = cnodeid_to_nasid(cnodeid);
244 create_proc_read_entry("fit", 0, dir, read_fit_entry, 220 proc_create_data("fit", 0, dir,
245 (void *)nasid); 221 &proc_fit_fops, (void *)nasid);
246 create_proc_read_entry("version", 0, dir, 222 proc_create_data("version", 0, dir,
247 read_version_entry, (void *)nasid); 223 &proc_version_fops, (void *)nasid);
248 } 224 }
249 return 0; 225 return 0;
250} 226}