[PATCH v4] char: xillybus: Replace deprecated MSI API

Salah Triki posted 1 patch 2 months, 2 weeks ago
drivers/char/xillybus/xillybus_pcie.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Salah Triki 2 months, 2 weeks ago
Replace deprecated pci_enable_msi() with pci_alloc_irq_vectors().

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
Changes in v4:
   - Drop devm_add_action() since it is useless

Changes in v3:
    - Some checkpatch cleanups

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/xillybus/xillybus_pcie.c b/drivers/char/xillybus/xillybus_pcie.c
index 9858711e3e79..c8b4cdfe695a 100644
--- a/drivers/char/xillybus/xillybus_pcie.c
+++ b/drivers/char/xillybus/xillybus_pcie.c
@@ -76,7 +76,8 @@ 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;
-- 
2.43.0
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Greg Kroah-Hartman 2 months, 2 weeks ago
On Sat, Jul 19, 2025 at 05:51:36AM +0100, Salah Triki wrote:
> Replace deprecated pci_enable_msi() with pci_alloc_irq_vectors().

This says what you are doing, but not _WHY_ you are doing it.

If this was a simple search/replace, why would it not have been done
already?  Are you _SURE_ this is correct, and if so, why?  You need to
prove it here...

thanks,

greg k-h
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Salah Triki 2 months, 2 weeks ago
On Sun, Jul 20, 2025 at 10:33:47AM +0200, Greg Kroah-Hartman wrote:
> 
> This says what you are doing, but not _WHY_ you are doing it.
> 

I did the replacement because pci_enable_msi() is deprecated, isn't that
enough ?

Best regards,
Salah Triki
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Greg Kroah-Hartman 2 months, 2 weeks ago
On Sun, Jul 20, 2025 at 09:56:29AM +0100, Salah Triki wrote:
> On Sun, Jul 20, 2025 at 10:33:47AM +0200, Greg Kroah-Hartman wrote:
> > 
> > This says what you are doing, but not _WHY_ you are doing it.
> > 
> 
> I did the replacement because pci_enable_msi() is deprecated, isn't that
> enough ?

If it was a simple search/replace, why wouldn't have been done already?

Again, you need to prove why this is ok at all.  pci_enable_msi()
shouldn't be used in new drivers, but what's wrong with it being in
existing drivers?  Especially in ones that you can't test to verify it
still works after changing the code?

thanks,

greg k-h
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Salah Triki 2 months, 2 weeks ago
Do you agree that for someone who wants to contribute to the kernel by doing
cleanups, it is better to do these cleanups on a part that is not directly
related to the drivers, because it is necessary to have hardware to test the
changes.

Best regards,
Salah Triki
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Greg Kroah-Hartman 2 months, 2 weeks ago
On Sun, Jul 20, 2025 at 06:03:50PM +0100, Salah Triki wrote:
> Do you agree that for someone who wants to contribute to the kernel by doing
> cleanups, it is better to do these cleanups on a part that is not directly
> related to the drivers, because it is necessary to have hardware to test the
> changes.

I'm sorry, but I have no context here for what you are asking about.

Please always quote emails properly, and realize that some of us get
hundreds, if not thousands, of emails a day to deal with.

thanks,

greg k-h
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Eli Billauer 2 months, 2 weeks ago
Thanks, and sorry for the back-and-forth.

Acked-by: Eli Billauer <eli.billauer@gmail.com>

On 19/07/2025 6:51, Salah Triki wrote:
> Replace deprecated pci_enable_msi() with pci_alloc_irq_vectors().
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> Changes in v4:
>     - Drop devm_add_action() since it is useless
> 
> Changes in v3:
>      - Some checkpatch cleanups
> 
> 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 | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/xillybus/xillybus_pcie.c b/drivers/char/xillybus/xillybus_pcie.c
> index 9858711e3e79..c8b4cdfe695a 100644
> --- a/drivers/char/xillybus/xillybus_pcie.c
> +++ b/drivers/char/xillybus/xillybus_pcie.c
> @@ -76,7 +76,8 @@ 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;
Re: [PATCH v4] char: xillybus: Replace deprecated MSI API
Posted by Salah Triki 2 months, 2 weeks ago
You are welcome

Best regards,
Salah Triki