[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240331135037.191479-5-o-takashi@sakamocchi.jp>
Date: Sun, 31 Mar 2024 22:50:37 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 4/4] 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.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/ohci.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index c14e6efaba36..f3b610f86aac 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3623,7 +3623,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) {
@@ -3754,12 +3754,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;
}
@@ -3779,7 +3784,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);
@@ -3789,6 +3794,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
@@ -3808,7 +3814,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");
--
2.43.0
Powered by blists - more mailing lists