]> git.baikalelectronics.ru Git - kernel.git/commitdiff
genirq/msi: Use PCI device property
authorThomas Gleixner <tglx@linutronix.de>
Fri, 10 Dec 2021 22:18:49 +0000 (23:18 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Dec 2021 21:16:37 +0000 (22:16 +0100)
to determine whether this is MSI or MSIX instead of consulting MSI
descriptors.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211210221813.434156196@linutronix.de
kernel/irq/msi.c

index 4a7a7f0f5102e5b22d2014ef165f17e6f9555b87..b3f73ef0376c8c63b69ddfaf85846fb8ac153e08 100644 (file)
@@ -77,21 +77,8 @@ EXPORT_SYMBOL_GPL(get_cached_msi_msg);
 static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
                             char *buf)
 {
-       struct msi_desc *entry;
-       bool is_msix = false;
-       unsigned long irq;
-       int retval;
-
-       retval = kstrtoul(attr->attr.name, 10, &irq);
-       if (retval)
-               return retval;
-
-       entry = irq_get_msi_desc(irq);
-       if (!entry)
-               return -ENODEV;
-
-       if (dev_is_pci(dev))
-               is_msix = entry->pci.msi_attrib.is_msix;
+       /* MSI vs. MSIX is per device not per interrupt */
+       bool is_msix = dev_is_pci(dev) ? to_pci_dev(dev)->msix_enabled : false;
 
        return sysfs_emit(buf, "%s\n", is_msix ? "msix" : "msi");
 }