All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Use pci_irq_vector function
@ 2018-05-14 17:27 Gustavo Pimentel
  2018-05-15 15:18 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Pimentel @ 2018-05-14 17:27 UTC (permalink / raw)
  To: bhelgaas, lorenzo.pieralisi, kishon; +Cc: linux-pci, Gustavo Pimentel

Replace "pdev->irq + index" operation by the pci_irq_vector() call,
that converts from device vector to Linux IRQ.
(suggestion made by Alan Douglas).

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
 drivers/misc/pci_endpoint_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index fe8897e..28d0cd9 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -203,7 +203,7 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
 	if (!val)
 		return false;
 
-	if (test->last_irq - pdev->irq == msi_num - 1)
+	if (pci_irq_vector(pdev, msi_num - 1) == test->last_irq)
 		return true;
 
 	return false;
@@ -525,12 +525,12 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	}
 
 	for (i = 1; i < irq; i++) {
-		err = devm_request_irq(dev, pdev->irq + i,
+		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
 				       pci_endpoint_test_irqhandler,
 				       IRQF_SHARED, DRV_MODULE_NAME, test);
 		if (err)
 			dev_err(dev, "failed to request IRQ %d for MSI %d\n",
-				pdev->irq + i, i + 1);
+				pci_irq_vector(pdev, i), i + 1);
 	}
 
 	for (bar = BAR_0; bar <= BAR_5; bar++) {
@@ -592,7 +592,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	}
 
 	for (i = 0; i < irq; i++)
-		devm_free_irq(dev, pdev->irq + i, test);
+		devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), test);
 
 err_disable_msi:
 	pci_disable_msi(pdev);
@@ -625,7 +625,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
 			pci_iounmap(pdev, test->bar[bar]);
 	}
 	for (i = 0; i < test->num_irqs; i++)
-		devm_free_irq(&pdev->dev, pdev->irq + i, test);
+		devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), test);
 	pci_disable_msi(pdev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] misc: pci_endpoint_test: Use pci_irq_vector function
  2018-05-14 17:27 [PATCH] misc: pci_endpoint_test: Use pci_irq_vector function Gustavo Pimentel
@ 2018-05-15 15:18 ` Lorenzo Pieralisi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2018-05-15 15:18 UTC (permalink / raw)
  To: Gustavo Pimentel; +Cc: bhelgaas, kishon, linux-pci

On Mon, May 14, 2018 at 06:27:48PM +0100, Gustavo Pimentel wrote:
> Replace "pdev->irq + index" operation by the pci_irq_vector() call,
> that converts from device vector to Linux IRQ.
> (suggestion made by Alan Douglas).

I have converted it to a Suggested-by tag.

> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> ---
>  drivers/misc/pci_endpoint_test.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied to pci/endpoint for v4.18, thanks.

Lorenzo

> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index fe8897e..28d0cd9 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -203,7 +203,7 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
>  	if (!val)
>  		return false;
>  
> -	if (test->last_irq - pdev->irq == msi_num - 1)
> +	if (pci_irq_vector(pdev, msi_num - 1) == test->last_irq)
>  		return true;
>  
>  	return false;
> @@ -525,12 +525,12 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  	}
>  
>  	for (i = 1; i < irq; i++) {
> -		err = devm_request_irq(dev, pdev->irq + i,
> +		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
>  				       pci_endpoint_test_irqhandler,
>  				       IRQF_SHARED, DRV_MODULE_NAME, test);
>  		if (err)
>  			dev_err(dev, "failed to request IRQ %d for MSI %d\n",
> -				pdev->irq + i, i + 1);
> +				pci_irq_vector(pdev, i), i + 1);
>  	}
>  
>  	for (bar = BAR_0; bar <= BAR_5; bar++) {
> @@ -592,7 +592,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  	}
>  
>  	for (i = 0; i < irq; i++)
> -		devm_free_irq(dev, pdev->irq + i, test);
> +		devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), test);
>  
>  err_disable_msi:
>  	pci_disable_msi(pdev);
> @@ -625,7 +625,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
>  			pci_iounmap(pdev, test->bar[bar]);
>  	}
>  	for (i = 0; i < test->num_irqs; i++)
> -		devm_free_irq(&pdev->dev, pdev->irq + i, test);
> +		devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), test);
>  	pci_disable_msi(pdev);
>  	pci_release_regions(pdev);
>  	pci_disable_device(pdev);
> -- 
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-15 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 17:27 [PATCH] misc: pci_endpoint_test: Use pci_irq_vector function Gustavo Pimentel
2018-05-15 15:18 ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.