aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /arch/parisc/kernel
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'arch/parisc/kernel')
-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