]> err.no Git - linux-2.6/blobdiff - kernel/irq/proc.c
Merge branch 'r6040' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev...
[linux-2.6] / kernel / irq / proc.c
index 6d3be06e8ce6362d2f2e106452c9c5383ebc6cfc..c2f2ccb0549a18a8552e0c8a018a198e4c70195e 100644 (file)
@@ -16,30 +16,18 @@ static struct proc_dir_entry *root_irq_dir;
 
 #ifdef CONFIG_SMP
 
-#ifdef CONFIG_GENERIC_PENDING_IRQ
-void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
-{
-       set_balance_irq_affinity(irq, mask_val);
-
-       /*
-        * Save these away for later use. Re-progam when the
-        * interrupt is pending
-        */
-       set_pending_irq(irq, mask_val);
-}
-#else
-void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
-{
-       set_balance_irq_affinity(irq, mask_val);
-       irq_desc[irq].affinity = mask_val;
-       irq_desc[irq].chip->set_affinity(irq, mask_val);
-}
-#endif
-
 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;
@@ -47,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)
@@ -55,13 +47,16 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
        cpumask_t new_value, tmp;
 
        if (!irq_desc[irq].chip->set_affinity || no_irq_affinity ||
-                               CHECK_IRQ_PER_CPU(irq_desc[irq].status))
+           irq_balancing_disabled(irq))
                return -EIO;
 
        err = cpumask_parse_user(buffer, count, new_value);
        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
@@ -73,25 +68,44 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
                   code to set default SMP affinity. */
                return select_smp_affinity(irq) ? -EINVAL : full_count;
 
-       proc_set_irq_affinity(irq, new_value);
+       irq_set_affinity(irq, new_value);
 
        return full_count;
 }
 
 #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)
 {
        struct irq_desc *desc = irq_desc + irq;
        struct irqaction *action;
+       unsigned long flags;
+       int ret = 1;
 
-       for (action = desc->action ; action; action = action->next)
+       spin_lock_irqsave(&desc->lock, flags);
+       for (action = desc->action ; action; action = action->next) {
                if ((action != new_action) && action->name &&
-                               !strcmp(new_action->name, action->name))
-                       return 0;
-       return 1;
+                               !strcmp(new_action->name, action->name)) {
+                       ret = 0;
+                       break;
+               }
+       }
+       spin_unlock_irqrestore(&desc->lock, flags);
+       return ret;
 }
 
 void register_handler_proc(unsigned int irq, struct irqaction *action)
@@ -116,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) ||
@@ -130,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);
 
@@ -142,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