From a4fbf90c2395ffa13176e8b002b7ef89a0ffc667 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Mon, 28 May 2018 08:33:08 -0400 Subject: [PATCH 079/112] irq_db: don't fail entirely if we don't have a pci bus aarch64 expects to have several interrupts that aren't associated to devices on a pci bus. However, rebuild_irq_db skips all interrupts if /sys/bus/pci/devices doesn't exist. Fix this by still calling add_missing_irq on all collected interrupts regardless of the pci bus directory. Signed-off-by: Neil Horman --- classify.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/classify.c b/classify.c index d3688fe..a977dc9 100644 --- a/classify.c +++ b/classify.c @@ -39,7 +39,7 @@ GList *cl_banned_irqs = NULL; static GList *cl_banned_modules = NULL; #define SYSFS_DIR "/sys" -#define SYSDEV_DIR "/sys/bus/pci/devices" +#define SYSPCI_DIR "/sys/bus/pci/devices" #define PCI_MAX_CLASS 0x14 #define PCI_MAX_SERIAL_SUBCLASS 0x81 @@ -616,8 +616,8 @@ static void build_one_dev_entry(const char *dirname, GList *tmp_irqs) char devpath[PATH_MAX]; struct user_irq_policy pol; - sprintf(path, "%s/%s/msi_irqs", SYSDEV_DIR, dirname); - sprintf(devpath, "%s/%s", SYSDEV_DIR, dirname); + sprintf(path, "%s/%s/msi_irqs", SYSPCI_DIR, dirname); + sprintf(devpath, "%s/%s", SYSPCI_DIR, dirname); msidir = opendir(path); @@ -646,7 +646,7 @@ static void build_one_dev_entry(const char *dirname, GList *tmp_irqs) return; } - sprintf(path, "%s/%s/irq", SYSDEV_DIR, dirname); + sprintf(path, "%s/%s/irq", SYSPCI_DIR, dirname); fd = fopen(path, "r"); if (!fd) return; @@ -764,22 +764,21 @@ void rebuild_irq_db(void) tmp_irqs = collect_full_irq_list(); - devdir = opendir(SYSDEV_DIR); - if (!devdir) - goto free; + devdir = opendir(SYSPCI_DIR); - do { - entry = readdir(devdir); - - if (!entry) - break; + if (devdir) { + do { + entry = readdir(devdir); - build_one_dev_entry(entry->d_name, tmp_irqs); + if (!entry) + break; - } while (entry != NULL); + build_one_dev_entry(entry->d_name, tmp_irqs); - closedir(devdir); + } while (entry != NULL); + closedir(devdir); + } for_each_irq(tmp_irqs, add_missing_irq, interrupts_db); -- 1.8.3.1