vserver 1.9.3
[linux-2.6.git] / arch / ppc / kernel / irq.c
index c1df603..d4612e9 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/random.h>
 #include <linux/seq_file.h>
 #include <linux/cpumask.h>
+#include <linux/profile.h>
 
 #include <asm/uaccess.h>
 #include <asm/bitops.h>
@@ -106,7 +107,7 @@ void *irq_kmalloc(size_t size, int pri)
                        cache_bitmask |= (1<<i);
                        return (void *)(&malloc_cache[i]);
                }
-       return 0;
+       return NULL;
 }
 
 void irq_kfree(void *ptr)
@@ -171,7 +172,12 @@ setup_irq(unsigned int irq, struct irqaction * new)
        if (!shared) {
                desc->depth = 0;
                desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING);
-               unmask_irq(irq);
+               if (desc->handler) {
+                       if (desc->handler->startup)
+                               desc->handler->startup(irq);
+                       else if (desc->handler->enable)
+                               desc->handler->enable(irq);
+               }
        }
        spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -241,7 +247,7 @@ int request_irq(unsigned int irq,
 
        action->handler = handler;
        action->flags = irqflags;                       
-       action->mask = 0;
+       cpus_clear(action->mask);
        action->name = devname;
        action->dev_id = dev_id;
        action->next = NULL;
@@ -304,8 +310,10 @@ void disable_irq_nosync(unsigned int irq)
 
 void disable_irq(unsigned int irq)
 {
+       irq_desc_t *desc = irq_desc + irq;
        disable_irq_nosync(irq);
-       synchronize_irq(irq);
+       if (desc->action)
+               synchronize_irq(irq);
 }
 
 /**
@@ -407,13 +415,15 @@ static inline void
 handle_irq_event(int irq, struct pt_regs *regs, struct irqaction *action)
 {
        int status = 0;
+       int ret;
 
        if (!(action->flags & SA_INTERRUPT))
                local_irq_enable();
 
        do {
-               status |= action->flags;
-               action->handler(irq, action->dev_id, regs);
+               ret = action->handler(irq, action->dev_id, regs);
+               if (ret == IRQ_HANDLED)
+                       status |= action->flags;
                action = action->next;
        } while (action);
        if (status & SA_SAMPLE_RANDOM)
@@ -613,30 +623,6 @@ static int irq_affinity_write_proc (struct file *file, const char __user *buffer
        return full_count;
 }
 
-static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
-                       int count, int *eof, void *data)
-{
-       int len = cpumask_scnprintf(page, count, *(cpumask_t *)data);
-       if (count - len < 2)
-               return -EINVAL;
-       len += sprintf(page + len, "\n");
-       return len;
-}
-
-static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer,
-                                       unsigned long count, void *data)
-{
-       cpumask_t *mask = (cpumask_t *)data, full_count = count, err;
-       cpumask_t new_value;
-
-       err = cpumask_parse(buffer, count, new_value);
-       if (err)
-               return err;
-
-       *mask = new_value;
-       return full_count;
-}
-
 #define MAX_NAMELEN 10
 
 static void register_irq_proc (unsigned int irq)
@@ -664,23 +650,14 @@ static void register_irq_proc (unsigned int irq)
        smp_affinity_entry[irq] = entry;
 }
 
-unsigned long prof_cpu_mask = -1;
-
 void init_irq_proc (void)
 {
-       struct proc_dir_entry *entry;
        int i;
 
        /* create /proc/irq */
-       root_irq_dir = proc_mkdir("irq", 0);
-
+       root_irq_dir = proc_mkdir("irq", NULL);
        /* create /proc/irq/prof_cpu_mask */
-       entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
-
-       entry->nlink = 1;
-       entry->data = (void *)&prof_cpu_mask;
-       entry->read_proc = prof_cpu_mask_read_proc;
-       entry->write_proc = prof_cpu_mask_write_proc;
+       create_prof_cpu_mask(root_irq_dir);
 
        /*
         * Create entries for all existing IRQs.