Minor /proc/interrupts patch

Paul Gortmaker (gpg109@rsphy1.anu.edu.au)
Fri, 19 Jul 1996 01:28:13 +1000 (EST)


This is mostly cosmetic, but regardless has annoyed me for a while now.
Drivers like the printer driver only grab the irq for a second or two
(for a page or two of printing) and you never see any data for them
in /proc/interrupts as to the # of interrupts generated, etc.

However, the kernel maintains the interrupt event count independently
of the irq_action associated with that IRQ number, so we can report
the event count even if the IRQ is presently free. Here is what I mean:

-----------------------------------------
olga:~> cat /proc/interrupts
0: 19970147 timer
1: 180474 keyboard
2: 0 cascade
3: 138931 + serial
4: 600716 (currently free)
5: 861 (currently free)
6: 111 (currently free)
7: 52 (currently free)
8: 10495 + rtc
9: 2933492 WD8013
10: 189 PAS16
11: 865252 + BusLogic BT-747A
12: 320325 + serial
13: 1 math error
14: 114459 + ide0
15: 197 (currently free)
olga:~>
--------------------------------------------

In this case, the two LPT ports (5 and 7), the floppy (6), /dev/ttyS0 (4)
and /dev/ttyS3 (15) are presently idle, but we still get access to the
event count information for those IRQ lines that are unregistered.
[[ Yes, I have no free IRQ lines -- 16 IRQ lines is as bad as 1024 cyl. ]]

Trivial patch follows. Replace the "continue" with an "else" if you want.

Paul.

--- /tmp/linux/arch/i386/kernel/irq.c Thu Jun 6 20:44:42 1996
+++ linux/arch/i386/kernel/irq.c Tue Jul 16 17:44:04 1996
@@ -230,8 +230,11 @@

for (i = 0 ; i < 16 ; i++) {
action = irq_action[i];
- if (!action)
+ if (!action) {
+ len += sprintf(buf+len, "%2d: %8d (currently free)\n",
+ i, kstat.interrupts[i]);
continue;
+ }
len += sprintf(buf+len, "%2d: %8d %c %s",
i, kstat.interrupts[i],
(action->flags & SA_INTERRUPT) ? '+' : ' ',