All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] isci: switch to pci_alloc_irq_vectors
@ 2016-11-18  6:10 Christoph Hellwig
  2016-11-29 16:40 ` Martin K. Petersen
  2016-11-30 15:04 ` Artur Paszkiewicz
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-11-18  6:10 UTC (permalink / raw)
  To: artur.paszkiewicz; +Cc: intel-linux-scu, linux-scsi

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/isci/host.h |  1 -
 drivers/scsi/isci/init.c | 21 +++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 22a9bb1..b353992 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -295,7 +295,6 @@ enum sci_controller_states {
 #define SCI_MAX_MSIX_INT (SCI_NUM_MSI_X_INT*SCI_MAX_CONTROLLERS)
 
 struct isci_pci_info {
-	struct msix_entry msix_entries[SCI_MAX_MSIX_INT];
 	struct isci_host *hosts[SCI_MAX_CONTROLLERS];
 	struct isci_orom *orom;
 };
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 77128d68..7cddebb 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -350,16 +350,12 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
 	 */
 	num_msix = num_controllers(pdev) * SCI_NUM_MSI_X_INT;
 
-	for (i = 0; i < num_msix; i++)
-		pci_info->msix_entries[i].entry = i;
-
-	err = pci_enable_msix_exact(pdev, pci_info->msix_entries, num_msix);
+	err = pci_alloc_irq_vectors(pdev, num_msix, num_msix, PCI_IRQ_MSIX);
 	if (err)
 		goto intx;
 
 	for (i = 0; i < num_msix; i++) {
 		int id = i / SCI_NUM_MSI_X_INT;
-		struct msix_entry *msix = &pci_info->msix_entries[i];
 		irq_handler_t isr;
 
 		ihost = pci_info->hosts[id];
@@ -369,8 +365,8 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
 		else
 			isr = isci_msix_isr;
 
-		err = devm_request_irq(&pdev->dev, msix->vector, isr, 0,
-				       DRV_NAME"-msix", ihost);
+		err = devm_request_irq(&pdev->dev, pci_irq_vector(pdev, i),
+				isr, 0, DRV_NAME"-msix", ihost);
 		if (!err)
 			continue;
 
@@ -378,18 +374,19 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
 		while (i--) {
 			id = i / SCI_NUM_MSI_X_INT;
 			ihost = pci_info->hosts[id];
-			msix = &pci_info->msix_entries[i];
-			devm_free_irq(&pdev->dev, msix->vector, ihost);
+			devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i),
+					ihost);
 		}
-		pci_disable_msix(pdev);
+		pci_free_irq_vectors(pdev);
 		goto intx;
 	}
 	return 0;
 
  intx:
 	for_each_isci_host(i, ihost, pdev) {
-		err = devm_request_irq(&pdev->dev, pdev->irq, isci_intx_isr,
-				       IRQF_SHARED, DRV_NAME"-intx", ihost);
+		err = devm_request_irq(&pdev->dev, pci_irq_vector(pdev, 0),
+				isci_intx_isr, IRQF_SHARED, DRV_NAME"-intx",
+				ihost);
 		if (err)
 			break;
 	}
-- 
2.1.4


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

* Re: [PATCH] isci: switch to pci_alloc_irq_vectors
  2016-11-18  6:10 [PATCH] isci: switch to pci_alloc_irq_vectors Christoph Hellwig
@ 2016-11-29 16:40 ` Martin K. Petersen
  2016-11-30 15:04 ` Artur Paszkiewicz
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-11-29 16:40 UTC (permalink / raw)
  To: artur.paszkiewicz, Dan Williams
  Cc: Christoph Hellwig, intel-linux-scu, linux-scsi

>>>>> "Christoph" == Christoph Hellwig <hch@lst.de> writes:

Artur or Dan: Please review!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] isci: switch to pci_alloc_irq_vectors
  2016-11-18  6:10 [PATCH] isci: switch to pci_alloc_irq_vectors Christoph Hellwig
  2016-11-29 16:40 ` Martin K. Petersen
@ 2016-11-30 15:04 ` Artur Paszkiewicz
  1 sibling, 0 replies; 3+ messages in thread
From: Artur Paszkiewicz @ 2016-11-30 15:04 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: intel-linux-scu, linux-scsi

On 11/18/2016 07:10 AM, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/scsi/isci/host.h |  1 -
>  drivers/scsi/isci/init.c | 21 +++++++++------------
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
> index 22a9bb1..b353992 100644
> --- a/drivers/scsi/isci/host.h
> +++ b/drivers/scsi/isci/host.h
> @@ -295,7 +295,6 @@ enum sci_controller_states {
>  #define SCI_MAX_MSIX_INT (SCI_NUM_MSI_X_INT*SCI_MAX_CONTROLLERS)
>  
>  struct isci_pci_info {
> -	struct msix_entry msix_entries[SCI_MAX_MSIX_INT];
>  	struct isci_host *hosts[SCI_MAX_CONTROLLERS];
>  	struct isci_orom *orom;
>  };
> diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
> index 77128d68..7cddebb 100644
> --- a/drivers/scsi/isci/init.c
> +++ b/drivers/scsi/isci/init.c
> @@ -350,16 +350,12 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
>  	 */
>  	num_msix = num_controllers(pdev) * SCI_NUM_MSI_X_INT;
>  
> -	for (i = 0; i < num_msix; i++)
> -		pci_info->msix_entries[i].entry = i;
> -
> -	err = pci_enable_msix_exact(pdev, pci_info->msix_entries, num_msix);
> +	err = pci_alloc_irq_vectors(pdev, num_msix, num_msix, PCI_IRQ_MSIX);
>  	if (err)
>  		goto intx;

pci_enable_msix_exact() returns 0 or -ERROR but pci_alloc_irq_vectors()
returns the number of vectors allocated if successful, so this also
should be changed:

-	if (err)
+	if (err < 0)
		goto intx;

The rest looks good to me.

Thanks,
Artur

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

end of thread, other threads:[~2016-11-30 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18  6:10 [PATCH] isci: switch to pci_alloc_irq_vectors Christoph Hellwig
2016-11-29 16:40 ` Martin K. Petersen
2016-11-30 15:04 ` Artur Paszkiewicz

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.