Commit 28ff1188 authored by David Howells's avatar David Howells Committed by Al Viro

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: default avatarDavid 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 64f0962c
...@@ -30,11 +30,13 @@ ...@@ -30,11 +30,13 @@
#endif #endif
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/pdc_chassis.h> #include <asm/pdc_chassis.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message) ...@@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message)
#ifdef CONFIG_PDC_CHASSIS_WARN #ifdef CONFIG_PDC_CHASSIS_WARN
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int pdc_chassis_warn_pread(char *page, char **start, off_t off, static int pdc_chassis_warn_show(struct seq_file *m, void *v)
int count, int *eof, void *data)
{ {
char *out = page;
int len, ret;
unsigned long warn; unsigned long warn;
u32 warnreg; u32 warnreg;
ret = pdc_chassis_warn(&warn); if (pdc_chassis_warn(&warn) != PDC_OK)
if (ret != PDC_OK)
return -EIO; return -EIO;
warnreg = (warn & 0xFFFFFFFF); warnreg = (warn & 0xFFFFFFFF);
if ((warnreg >> 24) & 0xFF) if ((warnreg >> 24) & 0xFF)
out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF)); seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n",
(warnreg >> 24) & 0xFF);
out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK"); seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK"); seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
len = out - page - off; return 0;
if (len < count) { }
*eof = 1;
if (len <= 0) return 0; static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
} else { {
len = count; return single_open(file, pdc_chassis_warn_show, NULL);
}
*start = page + off;
return len;
} }
static const struct file_operations pdc_chassis_warn_fops = {
.open = pdc_chassis_warn_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init pdc_chassis_create_procfs(void) static int __init pdc_chassis_create_procfs(void)
{ {
unsigned long test; unsigned long test;
...@@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void) ...@@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void)
printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
PDC_CHASSIS_VER); PDC_CHASSIS_VER);
create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread, proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops);
NULL);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment