[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHkkU-BHX2Zn0SWY@pc>
Date: Thu, 17 Jul 2025 17:26:59 +0100
From: Salah Triki <salah.triki@...il.com>
To: Eli Billauer <eli.billauer@...il.com>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Cc: salah.triki@...il.com
Subject: [PATCH v2] char: xillybus: Replace deprecated MSI API
Replace deprecated pci_enable_msi() with pci_alloc_irq_vectors(). And
add devm action to free irq vectors.
Signed-off-by: Salah Triki <salah.triki@...il.com>
---
Changes in v2:
- Replace PCI_IRQ_ALL_TYPES with PCI_IRQ_MSI
- Delete pci_free_irq_vectors(pdev) in remove function
- Add devm action that calls pci_free_irq_vectors(pdev)
drivers/char/xillybus/xillybus_pcie.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/char/xillybus/xillybus_pcie.c b/drivers/char/xillybus/xillybus_pcie.c
index 9858711e3e79..ed3b77cb8127 100644
--- a/drivers/char/xillybus/xillybus_pcie.c
+++ b/drivers/char/xillybus/xillybus_pcie.c
@@ -32,6 +32,11 @@ static const struct pci_device_id xillyids[] = {
{ /* End: all zeroes */ }
};
+static void xilly_pci_free_irq_vectors(void *data)
+{
+ pci_free_irq_vectors(data);
+}
+
static int xilly_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -76,11 +81,21 @@ static int xilly_probe(struct pci_dev *pdev,
pci_set_master(pdev);
/* Set up a single MSI interrupt */
- if (pci_enable_msi(pdev)) {
+ rc = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
+ if (rc < 0) {
dev_err(endpoint->dev,
"Failed to enable MSI interrupts. Aborting.\n");
return -ENODEV;
}
+
+ rc = devm_add_action(&pdev->dev, xilly_pci_free_irq_vectors, pdev);
+ if (rc) {
+ dev_err(endpoint->dev,
+ "Failed to add devm action. Aborting.\n");
+ pci_free_irq_vectors(pdev);
+ return -ENODEV;
+ }
+
rc = devm_request_irq(&pdev->dev, pdev->irq, xillybus_isr, 0,
xillyname, endpoint);
if (rc) {
--
2.43.0
Powered by blists - more mailing lists