OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / fs / proc / interrupts.c
blob05029c0e2f2479d072cb3402ea965d361b1dbb35
1 #include <linux/fs.h>
2 #include <linux/init.h>
3 #include <linux/interrupt.h>
4 #include <linux/irqnr.h>
5 #include <linux/proc_fs.h>
6 #include <linux/seq_file.h>
8 /*
9 * /proc/interrupts
11 static void *int_seq_start(struct seq_file *f, loff_t *pos)
13 return (*pos <= nr_irqs) ? pos : NULL;
16 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
18 (*pos)++;
19 if (*pos > nr_irqs)
20 return NULL;
21 return pos;
24 static void int_seq_stop(struct seq_file *f, void *v)
26 /* Nothing to do */
29 static const struct seq_operations int_seq_ops = {
30 .start = int_seq_start,
31 .next = int_seq_next,
32 .stop = int_seq_stop,
33 .show = show_interrupts
36 static int interrupts_open(struct inode *inode, struct file *filp)
38 return seq_open(filp, &int_seq_ops);
41 static const struct file_operations proc_interrupts_operations = {
42 .open = interrupts_open,
43 .read = seq_read,
44 .llseek = seq_lseek,
45 .release = seq_release,
48 static int __init proc_interrupts_init(void)
50 proc_create("interrupts", 0, NULL, &proc_interrupts_operations);
51 return 0;
53 module_init(proc_interrupts_init);