Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/fs.h>
0003 #include <linux/init.h>
0004 #include <linux/interrupt.h>
0005 #include <linux/irqnr.h>
0006 #include <linux/proc_fs.h>
0007 #include <linux/seq_file.h>
0008 
0009 /*
0010  * /proc/interrupts
0011  */
0012 static void *int_seq_start(struct seq_file *f, loff_t *pos)
0013 {
0014     return (*pos <= nr_irqs) ? pos : NULL;
0015 }
0016 
0017 static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
0018 {
0019     (*pos)++;
0020     if (*pos > nr_irqs)
0021         return NULL;
0022     return pos;
0023 }
0024 
0025 static void int_seq_stop(struct seq_file *f, void *v)
0026 {
0027     /* Nothing to do */
0028 }
0029 
0030 static const struct seq_operations int_seq_ops = {
0031     .start = int_seq_start,
0032     .next  = int_seq_next,
0033     .stop  = int_seq_stop,
0034     .show  = show_interrupts
0035 };
0036 
0037 static int __init proc_interrupts_init(void)
0038 {
0039     proc_create_seq("interrupts", 0, NULL, &int_seq_ops);
0040     return 0;
0041 }
0042 fs_initcall(proc_interrupts_init);