diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2024-03-31 22:50:37 +0900 |
---|---|---|
committer | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2024-05-06 11:06:04 +0900 |
commit | e41b2c1532d6d43945a59e7d844a258b5a82f307 (patch) | |
tree | 2c88678ad5da62a42159a85b633487226927062c /drivers/firewire | |
parent | b9d9a025bf2fa93d421cc5e54bf1dfaa3a55d60a (diff) |
firewire: ohci: use pci_irq_vector() to retrieve allocated interrupt line
The pci_irq_vector() is available to retrieve the allocated interrupt line
instead of the direct access to the member of device structure.
Link: https://lore.kernel.org/r/20240331135037.191479-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/ohci.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 34262856f680..0de45baf3569 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -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, flags, err; + int i, flags, irq, err; size_t size; if (dev->vendor == PCI_VENDOR_ID_PINNACLE_SYSTEMS) { @@ -3762,12 +3762,17 @@ static int pci_probe(struct pci_dev *dev, err = pci_alloc_irq_vectors(dev, 1, 1, flags); if (err < 0) return err; + irq = pci_irq_vector(dev, 0); + if (irq < 0) { + err = irq; + goto fail_msi; + } - err = request_threaded_irq(dev->irq, irq_handler, NULL, + err = request_threaded_irq(irq, irq_handler, NULL, pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED, ohci_driver_name, ohci); if (err < 0) { - ohci_err(ohci, "failed to allocate interrupt %d\n", dev->irq); + ohci_err(ohci, "failed to allocate interrupt %d\n", irq); goto fail_msi; } @@ -3787,7 +3792,7 @@ static int pci_probe(struct pci_dev *dev, return 0; fail_irq: - free_irq(dev->irq, ohci); + free_irq(irq, ohci); fail_msi: pci_free_irq_vectors(dev); @@ -3797,6 +3802,7 @@ static int pci_probe(struct pci_dev *dev, static void pci_remove(struct pci_dev *dev) { struct fw_ohci *ohci = pci_get_drvdata(dev); + int irq; /* * If the removal is happening from the suspend state, LPS won't be @@ -3816,7 +3822,9 @@ static void pci_remove(struct pci_dev *dev) software_reset(ohci); - free_irq(dev->irq, ohci); + irq = pci_irq_vector(dev, 0); + if (irq >= 0) + free_irq(irq, ohci); pci_free_irq_vectors(dev); dev_notice(&dev->dev, "removing fw-ohci device\n"); |