diff mbox

[2/5] pci: switch msix_program_entries to use pci_msix_desc_addr

Message ID 1468315218-20490-3-git-send-email-hch@lst.de (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Christoph Hellwig July 12, 2016, 9:20 a.m. UTC
Instead of relying on the msix_entry structure for the vector number read
it from the msi_desc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/pci/msi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Alexander Gordeev July 12, 2016, 12:59 p.m. UTC | #1
On Tue, Jul 12, 2016 at 06:20:15PM +0900, Christoph Hellwig wrote:
> Instead of relying on the msix_entry structure for the vector number read
> it from the msi_desc.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/pci/msi.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 0d94fbf..a385f39 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -713,11 +713,9 @@ static void msix_program_entries(struct pci_dev *dev,
>  	int i = 0;
>  
>  	for_each_pci_msi_entry(entry, dev) {
> -		int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE +
> -						PCI_MSIX_ENTRY_VECTOR_CTRL;
> -
>  		entries[i].vector = entry->irq;
> -		entry->masked = readl(entry->mask_base + offset);
> +		entry->masked = readl(pci_msix_desc_addr(entry) +
> +				PCI_MSIX_ENTRY_VECTOR_CTRL);
>  		msix_mask_irq(entry, 1);
>  		i++;
>  	}
> -- 
> 2.1.4
> 
Reviewed-by: Alexander Gordeev <agordeev@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 0d94fbf..a385f39 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -713,11 +713,9 @@  static void msix_program_entries(struct pci_dev *dev,
 	int i = 0;
 
 	for_each_pci_msi_entry(entry, dev) {
-		int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE +
-						PCI_MSIX_ENTRY_VECTOR_CTRL;
-
 		entries[i].vector = entry->irq;
-		entry->masked = readl(entry->mask_base + offset);
+		entry->masked = readl(pci_msix_desc_addr(entry) +
+				PCI_MSIX_ENTRY_VECTOR_CTRL);
 		msix_mask_irq(entry, 1);
 		i++;
 	}