aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-10 19:11:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:41:57 -0400
commit28ff11882a2ec50916b2b52016d80ec52461e5f9 (patch)
tree3e7db03f0bb939ed22fb7c9be4f529091a5d3020 /arch/parisc
parent64f0962c33d52524deb32d7c34ab8b2c271ee1a3 (diff)
parisc: 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: "James E.J. Bottomley" <jejb@parisc-linux.org> cc: Helge Deller <deller@gmx.de> cc: linux-parisc@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/pdc_chassis.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index d47ba1aa8253..8fa314fbfb18 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -30,11 +30,13 @@
30#endif 30#endif
31 31
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/module.h>
33#include <linux/kernel.h> 34#include <linux/kernel.h>
34#include <linux/reboot.h> 35#include <linux/reboot.h>
35#include <linux/notifier.h> 36#include <linux/notifier.h>
36#include <linux/cache.h> 37#include <linux/cache.h>
37#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/seq_file.h>
38 40
39#include <asm/pdc_chassis.h> 41#include <asm/pdc_chassis.h>
40#include <asm/processor.h> 42#include <asm/processor.h>
@@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message)
244 246
245#ifdef CONFIG_PDC_CHASSIS_WARN 247#ifdef CONFIG_PDC_CHASSIS_WARN
246#ifdef CONFIG_PROC_FS 248#ifdef CONFIG_PROC_FS
247static int pdc_chassis_warn_pread(char *page, char **start, off_t off, 249static int pdc_chassis_warn_show(struct seq_file *m, void *v)
248 int count, int *eof, void *data)
249{ 250{
250 char *out = page;
251 int len, ret;
252 unsigned long warn; 251 unsigned long warn;
253 u32 warnreg; 252 u32 warnreg;
254 253
255 ret = pdc_chassis_warn(&warn); 254 if (pdc_chassis_warn(&warn) != PDC_OK)
256 if (ret != PDC_OK)
257 return -EIO; 255 return -EIO;
258 256
259 warnreg = (warn & 0xFFFFFFFF); 257 warnreg = (warn & 0xFFFFFFFF);
260 258
261 if ((warnreg >> 24) & 0xFF) 259 if ((warnreg >> 24) & 0xFF)
262 out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF)); 260 seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n",
263 261 (warnreg >> 24) & 0xFF);
264 out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK"); 262
265 out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK"); 263 seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
266 out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK"); 264 seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
267 265 seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
268 len = out - page - off; 266 return 0;
269 if (len < count) { 267}
270 *eof = 1; 268
271 if (len <= 0) return 0; 269static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
272 } else { 270{
273 len = count; 271 return single_open(file, pdc_chassis_warn_show, NULL);
274 }
275 *start = page + off;
276 return len;
277} 272}
278 273
274static const struct file_operations pdc_chassis_warn_fops = {
275 .open = pdc_chassis_warn_open,
276 .read = seq_read,
277 .llseek = seq_lseek,
278 .release = seq_release,
279};
280
279static int __init pdc_chassis_create_procfs(void) 281static int __init pdc_chassis_create_procfs(void)
280{ 282{
281 unsigned long test; 283 unsigned long test;
@@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void)
290 292
291 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", 293 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
292 PDC_CHASSIS_VER); 294 PDC_CHASSIS_VER);
293 create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread, 295 proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops);
294 NULL);
295 return 0; 296 return 0;
296} 297}
297 298