Merge remote branch 'linus/master'
[powerpc.git] / kernel / irq / proc.c
index ddde0ef..c2f2ccb 100644 (file)
@@ -19,7 +19,15 @@ static struct proc_dir_entry *root_irq_dir;
 static int irq_affinity_read_proc(char *page, char **start, off_t off,
                                  int count, int *eof, void *data)
 {
-       int len = cpumask_scnprintf(page, count, irq_desc[(long)data].affinity);
+       struct irq_desc *desc = irq_desc + (long)data;
+       cpumask_t *mask = &desc->affinity;
+       int len;
+
+#ifdef CONFIG_GENERIC_PENDING_IRQ
+       if (desc->status & IRQ_MOVE_PENDING)
+               mask = &desc->pending_mask;
+#endif
+       len = cpumask_scnprintf(page, count, *mask);
 
        if (count - len < 2)
                return -EINVAL;
@@ -27,6 +35,10 @@ static int irq_affinity_read_proc(char *page, char **start, off_t off,
        return len;
 }
 
+#ifndef is_affinity_mask_valid
+#define is_affinity_mask_valid(val) 1
+#endif
+
 int no_irq_affinity;
 static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
                                   unsigned long count, void *data)
@@ -42,6 +54,9 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
        if (err)
                return err;
 
+       if (!is_affinity_mask_valid(new_value))
+               return -EINVAL;
+
        /*
         * Do not allow disabling IRQs completely - it's a too easy
         * way to make the system unusable accidentally :-) At least
@@ -60,6 +75,18 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
 
 #endif
 
+static int irq_spurious_read(char *page, char **start, off_t off,
+                                 int count, int *eof, void *data)
+{
+       struct irq_desc *d = &irq_desc[(long) data];
+       return sprintf(page, "count %u\n"
+                            "unhandled %u\n"
+                            "last_unhandled %u ms\n",
+                       d->irq_count,
+                       d->irqs_unhandled,
+                       jiffies_to_msecs(d->last_unhandled));
+}
+
 #define MAX_NAMELEN 128
 
 static int name_unique(unsigned int irq, struct irqaction *new_action)
@@ -103,6 +130,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 void register_irq_proc(unsigned int irq)
 {
        char name [MAX_NAMELEN];
+       struct proc_dir_entry *entry;
 
        if (!root_irq_dir ||
                (irq_desc[irq].chip == &no_irq_chip) ||
@@ -117,8 +145,6 @@ void register_irq_proc(unsigned int irq)
 
 #ifdef CONFIG_SMP
        {
-               struct proc_dir_entry *entry;
-
                /* create /proc/irq/<irq>/smp_affinity */
                entry = create_proc_entry("smp_affinity", 0600, irq_desc[irq].dir);
 
@@ -129,6 +155,12 @@ void register_irq_proc(unsigned int irq)
                }
        }
 #endif
+
+       entry = create_proc_entry("spurious", 0444, irq_desc[irq].dir);
+       if (entry) {
+               entry->data = (void *)(long)irq;
+               entry->read_proc = irq_spurious_read;
+       }
 }
 
 #undef MAX_NAMELEN