Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370102
b: refs/heads/master
c: 28ff118
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Al Viro committed Apr 29, 2013
1 parent 0661be4 commit 6fd7e37
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64f0962c33d52524deb32d7c34ab8b2c271ee1a3
refs/heads/master: 28ff11882a2ec50916b2b52016d80ec52461e5f9
47 changes: 24 additions & 23 deletions trunk/arch/parisc/kernel/pdc_chassis.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
#endif

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/cache.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

#include <asm/pdc_chassis.h>
#include <asm/processor.h>
Expand Down Expand Up @@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message)

#ifdef CONFIG_PDC_CHASSIS_WARN
#ifdef CONFIG_PROC_FS
static int pdc_chassis_warn_pread(char *page, char **start, off_t off,
int count, int *eof, void *data)
static int pdc_chassis_warn_show(struct seq_file *m, void *v)
{
char *out = page;
int len, ret;
unsigned long warn;
u32 warnreg;

ret = pdc_chassis_warn(&warn);
if (ret != PDC_OK)
if (pdc_chassis_warn(&warn) != PDC_OK)
return -EIO;

warnreg = (warn & 0xFFFFFFFF);

if ((warnreg >> 24) & 0xFF)
out += sprintf(out, "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");
out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");

len = out - page - off;
if (len < count) {
*eof = 1;
if (len <= 0) return 0;
} else {
len = count;
}
*start = page + off;
return len;
seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n",
(warnreg >> 24) & 0xFF);

seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
return 0;
}

static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
{
return single_open(file, pdc_chassis_warn_show, NULL);
}

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)
{
unsigned long test;
Expand All @@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void)

printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
PDC_CHASSIS_VER);
create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread,
NULL);
proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops);
return 0;
}

Expand Down

0 comments on commit 6fd7e37

Please sign in to comment.