]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/blobdiff - kernel/irq/proc.c
genirq: switch /proc/irq/*/spurious to seq_file
[lisovros/linux_canprio.git] / kernel / irq / proc.c
index 692363dd591f0c447d26b36318889f43bbe20ac3..4e47f11da6a7a09618919f592f93606d9e95746f 100644 (file)
@@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
 };
 #endif
 
-static int irq_spurious_read(char *page, char **start, off_t off,
-                                 int count, int *eof, void *data)
+static int irq_spurious_proc_show(struct seq_file *m, void *v)
 {
-       struct irq_desc *desc = irq_to_desc((long) data);
-       return sprintf(page, "count %u\n"
-                            "unhandled %u\n"
-                            "last_unhandled %u ms\n",
-                       desc->irq_count,
-                       desc->irqs_unhandled,
-                       jiffies_to_msecs(desc->last_unhandled));
+       struct irq_desc *desc = irq_to_desc((long) m->private);
+
+       seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
+                  desc->irq_count, desc->irqs_unhandled,
+                  jiffies_to_msecs(desc->last_unhandled));
+       return 0;
+}
+
+static int irq_spurious_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, irq_spurious_proc_show, NULL);
 }
 
+static const struct file_operations irq_spurious_proc_fops = {
+       .open           = irq_spurious_proc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
 #define MAX_NAMELEN 128
 
 static int name_unique(unsigned int irq, struct irqaction *new_action)
@@ -204,7 +214,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 {
        char name [MAX_NAMELEN];
-       struct proc_dir_entry *entry;
 
        if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir)
                return;
@@ -214,6 +223,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 
        /* create /proc/irq/1234 */
        desc->dir = proc_mkdir(name, root_irq_dir);
+       if (!desc->dir)
+               return;
 
 #ifdef CONFIG_SMP
        /* create /proc/irq/<irq>/smp_affinity */
@@ -221,11 +232,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
                         &irq_affinity_proc_fops, (void *)(long)irq);
 #endif
 
-       entry = create_proc_entry("spurious", 0444, desc->dir);
-       if (entry) {
-               entry->data = (void *)(long)irq;
-               entry->read_proc = irq_spurious_read;
-       }
+       proc_create_data("spurious", 0444, desc->dir,
+                        &irq_spurious_proc_fops, (void *)(long)irq);
 }
 
 #undef MAX_NAMELEN