@@ -127,7 +127,7 @@ int main(int argc, char **argv)
sigaction(SIGQUIT, &sig_act, NULL);
/* Prepare data structures */
- irqs = lub_list_new(NULL);
+ irqs = lub_list_new(irq_list_compare);
/* Main loop */
while (!sigterm) {
@@ -1,13 +1,17 @@
#ifndef _irq_h
#define _irq_h
-struct irq_t {
+struct irq_s {
int irq;
char *desc; /* IRQ text description */
};
+typedef struct irq_s irq_t;
#define SYSFS_PCI_PATH "/sys/bus/pci/devices"
+/* Compare function for global IRQ list */
+int irq_list_compare(const void *first, const void *second);
+
/* IRQ list functions */
int irqs_populate(lub_list_t *irqs);
@@ -12,6 +12,13 @@
#include "lub/list.h"
#include "irq.h"
+int irq_list_compare(const void *first, const void *second)
+{
+ const irq_t *f = (const irq_t *)first;
+ const irq_t *s = (const irq_t *)second;
+ return (f->irq - s->irq);
+}
static int irqs_populate_pci(lub_list_t *irqs)
{
DIR *dir;