sh: irq: Convert from irq_desc[] to irq_to_desc().
authorPaul Mundt <lethal@linux-sh.org>
Thu, 21 May 2009 16:26:16 +0000 (01:26 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Thu, 21 May 2009 16:26:16 +0000 (01:26 +0900)
This converts a few places that were using the old irq_desc[] array over
to the shiny new irq_to_desc() helper. Preperatory work for sparse irq
support.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/irq/intc-sh5.c
arch/sh/kernel/irq.c
arch/sh/kernel/sh_ksyms_32.c

index a619eaf..6c092f1 100644 (file)
@@ -152,14 +152,6 @@ static void end_intc_irq(unsigned int irq)
        enable_intc_irq(irq);
 }
 
-/* For future use, if we ever support IRLM=0) */
-void make_intc_irq(unsigned int irq)
-{
-       disable_irq_nosync(irq);
-       irq_desc[irq].chip = &intc_irq_type;
-       disable_intc_irq(irq);
-}
-
 void __init plat_irq_setup(void)
 {
        unsigned long long __dummy0, __dummy1=~0x00000000100000f0;
@@ -174,7 +166,7 @@ void __init plat_irq_setup(void)
 
        /* Set default: per-line enable/disable, priority driven ack/eoi */
        for (i = 0; i < NR_INTC_IRQS; i++)
-               irq_desc[i].chip = &intc_irq_type;
+               set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq);
 
 
        /* Disable all interrupts and set all priorities to 0 to avoid trouble */
index 3f1372e..878532b 100644 (file)
@@ -31,39 +31,64 @@ void ack_bad_irq(unsigned int irq)
 }
 
 #if defined(CONFIG_PROC_FS)
+/*
+ * /proc/interrupts printing:
+ */
+static int show_other_interrupts(struct seq_file *p, int prec)
+{
+       seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
+       return 0;
+}
+
 int show_interrupts(struct seq_file *p, void *v)
 {
-       int i = *(loff_t *) v, j;
-       struct irqaction * action;
-       unsigned long flags;
+       unsigned long flags, any_count = 0;
+       int i = *(loff_t *)v, j, prec;
+       struct irqaction *action;
+       struct irq_desc *desc;
+
+       if (i > nr_irqs)
+               return 0;
+
+       for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
+               j *= 10;
+
+       if (i == nr_irqs)
+               return show_other_interrupts(p, prec);
 
        if (i == 0) {
-               seq_puts(p, "           ");
+               seq_printf(p, "%*s", prec + 8, "");
                for_each_online_cpu(j)
-                       seq_printf(p, "CPU%d       ",j);
+                       seq_printf(p, "CPU%-8d", j);
                seq_putc(p, '\n');
        }
 
-       if (i < sh_mv.mv_nr_irqs) {
-               spin_lock_irqsave(&irq_desc[i].lock, flags);
-               action = irq_desc[i].action;
-               if (!action)
-                       goto unlock;
-               seq_printf(p, "%3d: ",i);
-               for_each_online_cpu(j)
-                       seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
-               seq_printf(p, " %14s", irq_desc[i].chip->name);
-               seq_printf(p, "-%-8s", irq_desc[i].name);
-               seq_printf(p, "  %s", action->name);
+       desc = irq_to_desc(i);
+       if (!desc)
+               return 0;
+
+       spin_lock_irqsave(&desc->lock, flags);
+       for_each_online_cpu(j)
+               any_count |= kstat_irqs_cpu(i, j);
+       action = desc->action;
+       if (!action && !any_count)
+               goto out;
 
-               for (action=action->next; action; action = action->next)
+       seq_printf(p, "%*d: ", prec, i);
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
+       seq_printf(p, " %14s", desc->chip->name);
+       seq_printf(p, "-%-8s", desc->name);
+
+       if (action) {
+               seq_printf(p, "  %s", action->name);
+               while ((action = action->next) != NULL)
                        seq_printf(p, ", %s", action->name);
-               seq_putc(p, '\n');
-unlock:
-               spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       } else if (i == sh_mv.mv_nr_irqs)
-               seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count));
+       }
 
+       seq_putc(p, '\n');
+out:
+       spin_unlock_irqrestore(&desc->lock, flags);
        return 0;
 }
 #endif
index 2d868c6..fcc5de3 100644 (file)
@@ -23,9 +23,6 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
 /* platform dependent support */
 EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(irq_desc);
-EXPORT_SYMBOL(no_irq_chip);
-
 EXPORT_SYMBOL(strlen);
 
 /* PCI exports */
@@ -40,11 +37,6 @@ EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(memmove);
 EXPORT_SYMBOL(__copy_user);
-
-#ifdef CONFIG_MMU
-EXPORT_SYMBOL(get_vm_area);
-#endif
-
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__ndelay);
 EXPORT_SYMBOL(__const_udelay);