PATCH: /proc/irq/ fix

From: Roman Zippel (zippel@fh-brandenburg.de)
Date: Mon Mar 06 2000 - 12:52:07 EST


Hi,

Here is a patch to avoid multiple same entries in /proc/irq/ and shows
only the active interrupts. Although I'm not sure about the test against
no_irq_type, Ingo, do you want to show all possible interrupts in
/proc/irq/? Then the patch would be a bit smaller and only the
register_irq_proc() needs to removed from request_irq() (and one test
against no_irq_type is sufficient).

bye, Roman

Index: arch/i386/kernel/irq.c
===================================================================
RCS file: /usr/src/cvsroot/linux-2.3/arch/i386/kernel/irq.c,v
retrieving revision 1.1.1.19
diff -u -r1.1.1.19 irq.c
--- arch/i386/kernel/irq.c 2000/03/03 20:10:24 1.1.1.19
+++ arch/i386/kernel/irq.c 2000/03/03 22:33:39
@@ -70,6 +70,7 @@
         { [0 ... NR_IRQS-1] = { 0, &no_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}};
 
 static void register_irq_proc (unsigned int irq);
+static void unregister_irq_proc (unsigned int irq);
 
 /*
  * Special irq handlers.
@@ -668,6 +669,7 @@
                         if (!desc->action) {
                                 desc->status |= IRQ_DISABLED;
                                 desc->handler->shutdown(irq);
+ unregister_irq_proc(irq);
                         }
                         spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -884,7 +886,8 @@
         }
         spin_unlock_irqrestore(&desc->lock,flags);
 
- register_irq_proc(irq);
+ if (!shared)
+ register_irq_proc(irq);
         return 0;
 }
 
@@ -998,7 +1001,7 @@
         struct proc_dir_entry *entry;
         char name [MAX_NAMELEN];
 
- if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type))
+ if (!root_irq_dir || !irq_desc[irq].action)
                 return;
 
         memset(name, 0, MAX_NAMELEN);
@@ -1018,6 +1021,16 @@
         smp_affinity_entry[irq] = entry;
 }
 
+static void unregister_irq_proc (unsigned int irq)
+{
+ char name[MAX_NAMELEN];
+
+ remove_proc_entry("smp_affinity", irq_dir[irq]);
+
+ sprintf(name, "%d", irq);
+ remove_proc_entry(name, root_irq_dir);
+}
+
 unsigned long prof_cpu_mask = -1;
 
 void init_irq_proc (void)
@@ -1039,10 +1052,7 @@
         /*
          * Create entries for all existing IRQs.
          */
- for (i = 0; i < NR_IRQS; i++) {
- if (irq_desc[i].handler == &no_irq_type)
- continue;
+ for (i = 0; i < NR_IRQS; i++)
                 register_irq_proc(i);
- }
 }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:20 EST