From: Salah Triki <salah.triki@gmail.com>
To: Eli Billauer <eli.billauer@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Cc: salah.triki@gmail.com
Subject: [PATCH v2] char: xillybus: Replace deprecated MSI API
Date: Thu, 17 Jul 2025 17:26:59 +0100 [thread overview]
Message-ID: <aHkkU-BHX2Zn0SWY@pc> (raw)
In-Reply-To: <aed95641-4c95-5fbb-f359-885a3e2144f7@outbound.gmail.com>
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@gmail.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
next prev parent reply other threads:[~2025-07-17 16:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 19:39 [PATCH] char: xillybus: Replace deprecated MSI API Salah Triki
2025-07-17 13:51 ` Eli Billauer
2025-07-17 16:26 ` Salah Triki [this message]
2025-07-18 0:55 ` [PATCH v3] " Salah Triki
2025-07-18 14:19 ` Eli Billauer
2025-07-19 4:51 ` [PATCH v4] " Salah Triki
2025-07-19 12:22 ` Eli Billauer
2025-07-19 12:35 ` Salah Triki
2025-07-20 8:33 ` Greg Kroah-Hartman
2025-07-20 8:56 ` Salah Triki
2025-07-20 9:07 ` Greg Kroah-Hartman
2025-07-20 17:03 ` Salah Triki
2025-07-21 5:41 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aHkkU-BHX2Zn0SWY@pc \
--to=salah.triki@gmail.com \
--cc=arnd@arndb.de \
--cc=eli.billauer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox