firewire: ohci: obsolete usage of deprecated API for MSI
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 31 Mar 2024 13:50:36 +0000 (22:50 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 6 May 2024 02:06:04 +0000 (11:06 +0900)
The usage of the pair of pci_enable_msi() and pci_disable_msi() is
deprecated.

This commit uses the preferred pair of API for the purpose. The call of
pci_alloc_irq_vectors() can have a subeffect to change the return value
of pci_dev_msi_enabled().

Link: https://lore.kernel.org/r/20240331135037.191479-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/ohci.c

index 0f55ef43292f2f88725f81191d25fdb77a0eaf2c..34262856f68076e14bd003d0511a4c5496a9cdb5 100644 (file)
@@ -3631,7 +3631,7 @@ static int pci_probe(struct pci_dev *dev,
        struct fw_ohci *ohci;
        u32 bus_options, max_receive, link_speed, version;
        u64 guid;
-       int i, err;
+       int i, flags, err;
        size_t size;
 
        if (dev->vendor == PCI_VENDOR_ID_PINNACLE_SYSTEMS) {
@@ -3756,8 +3756,13 @@ static int pci_probe(struct pci_dev *dev,
        guid = ((u64) reg_read(ohci, OHCI1394_GUIDHi) << 32) |
                reg_read(ohci, OHCI1394_GUIDLo);
 
+       flags = PCI_IRQ_INTX;
        if (!(ohci->quirks & QUIRK_NO_MSI))
-               pci_enable_msi(dev);
+               flags |= PCI_IRQ_MSI;
+       err = pci_alloc_irq_vectors(dev, 1, 1, flags);
+       if (err < 0)
+               return err;
+
        err = request_threaded_irq(dev->irq, irq_handler, NULL,
                                   pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED, ohci_driver_name,
                                   ohci);
@@ -3784,7 +3789,7 @@ static int pci_probe(struct pci_dev *dev,
  fail_irq:
        free_irq(dev->irq, ohci);
  fail_msi:
-       pci_disable_msi(dev);
+       pci_free_irq_vectors(dev);
 
        return err;
 }
@@ -3812,7 +3817,7 @@ static void pci_remove(struct pci_dev *dev)
        software_reset(ohci);
 
        free_irq(dev->irq, ohci);
-       pci_disable_msi(dev);
+       pci_free_irq_vectors(dev);
 
        dev_notice(&dev->dev, "removing fw-ohci device\n");
 }