aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-11-15 03:09:16 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-15 11:59:19 -0500
commit228322f13fe20bd29e81fca8341cc1fc7ffc5929 (patch)
tree7c587e6a0ebd88aa868d1f8c074e1f29c7918ca8 /arch
parent09071e35f9f0b308c37c9853766de573591589ea (diff)
[PATCH] v850: Fix show_interrupts
A variable was being used in multiple conflicting ways. I also restructured the code a bit for clarity. Signed-off-by: Miles Bader <miles@gnu.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/v850/kernel/irq.c81
1 files changed, 43 insertions, 38 deletions
diff --git a/arch/v850/kernel/irq.c b/arch/v850/kernel/irq.c
index 9e85969ba976..534eb8ab97a7 100644
--- a/arch/v850/kernel/irq.c
+++ b/arch/v850/kernel/irq.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * arch/v850/kernel/irq.c -- High-level interrupt handling 2 * arch/v850/kernel/irq.c -- High-level interrupt handling
3 * 3 *
4 * Copyright (C) 2001,02,03,04 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,04,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,04,05 Miles Bader <miles@gnu.org>
6 * Copyright (C) 1994-2000 Ralf Baechle 6 * Copyright (C) 1994-2000 Ralf Baechle
7 * Copyright (C) 1992 Linus Torvalds 7 * Copyright (C) 1992 Linus Torvalds
8 * 8 *
@@ -84,50 +84,55 @@ volatile unsigned long irq_err_count, spurious_count;
84 84
85int show_interrupts(struct seq_file *p, void *v) 85int show_interrupts(struct seq_file *p, void *v)
86{ 86{
87 int i = *(loff_t *) v; 87 int irq = *(loff_t *) v;
88 struct irqaction * action;
89 unsigned long flags;
90 88
91 if (i == 0) { 89 if (irq == 0) {
90 int cpu;
92 seq_puts(p, " "); 91 seq_puts(p, " ");
93 for (i=0; i < 1 /*smp_num_cpus*/; i++) 92 for (cpu=0; cpu < 1 /*smp_num_cpus*/; cpu++)
94 seq_printf(p, "CPU%d ", i); 93 seq_printf(p, "CPU%d ", cpu);
95 seq_putc(p, '\n'); 94 seq_putc(p, '\n');
96 } 95 }
97 96
98 if (i < NR_IRQS) { 97 if (irq < NR_IRQS) {
99 int j, count, num; 98 unsigned long flags;
100 const char *type_name = irq_desc[i].handler->typename; 99 struct irqaction *action;
101 spin_lock_irqsave(&irq_desc[j].lock, flags);
102 action = irq_desc[i].action;
103 if (!action)
104 goto skip;
105
106 count = 0;
107 num = -1;
108 for (j = 0; j < NR_IRQS; j++)
109 if (irq_desc[j].handler->typename == type_name) {
110 if (i == j)
111 num = count;
112 count++;
113 }
114 100
115 seq_printf(p, "%3d: ",i); 101 spin_lock_irqsave(&irq_desc[irq].lock, flags);
116 seq_printf(p, "%10u ", kstat_irqs(i)); 102
117 if (count > 1) { 103 action = irq_desc[irq].action;
118 int prec = (num >= 100 ? 3 : num >= 10 ? 2 : 1); 104 if (action) {
119 seq_printf(p, " %*s%d", 14 - prec, type_name, num); 105 int j;
120 } else 106 int count = 0;
121 seq_printf(p, " %14s", type_name); 107 int num = -1;
108 const char *type_name = irq_desc[irq].handler->typename;
109
110 for (j = 0; j < NR_IRQS; j++)
111 if (irq_desc[j].handler->typename == type_name){
112 if (irq == j)
113 num = count;
114 count++;
115 }
116
117 seq_printf(p, "%3d: ",irq);
118 seq_printf(p, "%10u ", kstat_irqs(irq));
119 if (count > 1) {
120 int prec = (num >= 100 ? 3 : num >= 10 ? 2 : 1);
121 seq_printf(p, " %*s%d", 14 - prec,
122 type_name, num);
123 } else
124 seq_printf(p, " %14s", type_name);
122 125
123 seq_printf(p, " %s", action->name); 126 seq_printf(p, " %s", action->name);
124 for (action=action->next; action; action = action->next) 127 for (action=action->next; action; action = action->next)
125 seq_printf(p, ", %s", action->name); 128 seq_printf(p, ", %s", action->name);
126 seq_putc(p, '\n'); 129 seq_putc(p, '\n');
127skip: 130 }
128 spin_unlock_irqrestore(&irq_desc[j].lock, flags); 131
129 } else if (i == NR_IRQS) 132 spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
133 } else if (irq == NR_IRQS)
130 seq_printf(p, "ERR: %10lu\n", irq_err_count); 134 seq_printf(p, "ERR: %10lu\n", irq_err_count);
135
131 return 0; 136 return 0;
132} 137}
133 138