Commit 2921d179 authored by Jiang Liu's avatar Jiang Liu Committed by Thomas Gleixner

powerpc/PCI: Use for_pci_msi_entry() to access MSI device list

Use accessor for_each_pci_msi_entry() to access MSI device list, so we
could easily move msi_list from struct pci_dev into struct device
later.
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Stuart Yoder <stuart.yoder@freescale.com>
Cc: Yijing Wang <wangyijing@huawei.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Olof Johansson <olof@lixom.net>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Daniel Axtens <dja@axtens.net>
Cc: Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Alexander Gordeev <agordeev@redhat.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Tudor Laurentiu <b10716@freescale.com>
Cc: Hongtao Jia <hongtao.jia@freescale.com>
Link: http://lkml.kernel.org/r/1436428847-8886-4-git-send-email-jiang.liu@linux.intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bbcffac3
...@@ -213,7 +213,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg) ...@@ -213,7 +213,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg)
return -ENODEV; return -ENODEV;
} }
entry = list_first_entry(&dev->msi_list, struct msi_desc, list); entry = first_pci_msi_entry(dev);
for (; dn; dn = of_get_next_parent(dn)) { for (; dn; dn = of_get_next_parent(dn)) {
if (entry->msi_attrib.is_64) { if (entry->msi_attrib.is_64) {
...@@ -269,7 +269,7 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -269,7 +269,7 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
if (rc) if (rc)
return rc; return rc;
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
virq = irq_create_direct_mapping(msic->irq_domain); virq = irq_create_direct_mapping(msic->irq_domain);
if (virq == NO_IRQ) { if (virq == NO_IRQ) {
dev_warn(&dev->dev, dev_warn(&dev->dev,
...@@ -292,7 +292,7 @@ static void axon_msi_teardown_msi_irqs(struct pci_dev *dev) ...@@ -292,7 +292,7 @@ static void axon_msi_teardown_msi_irqs(struct pci_dev *dev)
dev_dbg(&dev->dev, "axon_msi: tearing down msi irqs\n"); dev_dbg(&dev->dev, "axon_msi: tearing down msi irqs\n");
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
......
...@@ -66,7 +66,7 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -66,7 +66,7 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
pr_debug("pasemi_msi_teardown_msi_irqs, pdev %p\n", pdev); pr_debug("pasemi_msi_teardown_msi_irqs, pdev %p\n", pdev);
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
...@@ -94,7 +94,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -94,7 +94,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
msg.address_hi = 0; msg.address_hi = 0;
msg.address_lo = PASEMI_MSI_ADDR; msg.address_lo = PASEMI_MSI_ADDR;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
/* Allocate 16 interrupts for now, since that's the grouping for /* Allocate 16 interrupts for now, since that's the grouping for
* affinity. This can be changed later if it turns out 32 is too * affinity. This can be changed later if it turns out 32 is too
* few MSIs for someone, but restrictions will apply to how the * few MSIs for someone, but restrictions will apply to how the
......
...@@ -61,7 +61,7 @@ int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -61,7 +61,7 @@ int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
if (pdev->no_64bit_msi && !phb->msi32_support) if (pdev->no_64bit_msi && !phb->msi32_support)
return -ENODEV; return -ENODEV;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (!entry->msi_attrib.is_64 && !phb->msi32_support) { if (!entry->msi_attrib.is_64 && !phb->msi32_support) {
pr_warn("%s: Supports only 64-bit MSIs\n", pr_warn("%s: Supports only 64-bit MSIs\n",
pci_name(pdev)); pci_name(pdev));
...@@ -103,7 +103,7 @@ void pnv_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -103,7 +103,7 @@ void pnv_teardown_msi_irqs(struct pci_dev *pdev)
if (WARN_ON(!phb)) if (WARN_ON(!phb))
return; return;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
irq_set_msi_desc(entry->irq, NULL); irq_set_msi_desc(entry->irq, NULL);
......
...@@ -118,7 +118,7 @@ static void rtas_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -118,7 +118,7 @@ static void rtas_teardown_msi_irqs(struct pci_dev *pdev)
{ {
struct msi_desc *entry; struct msi_desc *entry;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
...@@ -350,7 +350,7 @@ static int check_msix_entries(struct pci_dev *pdev) ...@@ -350,7 +350,7 @@ static int check_msix_entries(struct pci_dev *pdev)
* So we must reject such requests. */ * So we must reject such requests. */
expected = 0; expected = 0;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->msi_attrib.entry_nr != expected) { if (entry->msi_attrib.entry_nr != expected) {
pr_debug("rtas_msi: bad MSI-X entries.\n"); pr_debug("rtas_msi: bad MSI-X entries.\n");
return -EINVAL; return -EINVAL;
...@@ -462,7 +462,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) ...@@ -462,7 +462,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
} }
i = 0; i = 0;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
hwirq = rtas_query_irq_number(pdn, i++); hwirq = rtas_query_irq_number(pdn, i++);
if (hwirq < 0) { if (hwirq < 0) {
pr_debug("rtas_msi: error (%d) getting hwirq\n", rc); pr_debug("rtas_msi: error (%d) getting hwirq\n", rc);
......
...@@ -129,7 +129,7 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -129,7 +129,7 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
struct msi_desc *entry; struct msi_desc *entry;
struct fsl_msi *msi_data; struct fsl_msi *msi_data;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
msi_data = irq_get_chip_data(entry->irq); msi_data = irq_get_chip_data(entry->irq);
...@@ -219,7 +219,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -219,7 +219,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
} }
} }
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
/* /*
* Loop over all the MSI devices until we find one that has an * Loop over all the MSI devices until we find one that has an
* available interrupt. * available interrupt.
......
...@@ -108,7 +108,7 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -108,7 +108,7 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
{ {
struct msi_desc *entry; struct msi_desc *entry;
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
...@@ -140,7 +140,7 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -140,7 +140,7 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
return -ENXIO; return -ENXIO;
} }
list_for_each_entry(entry, &pdev->msi_list, list) { for_each_pci_msi_entry(entry, pdev) {
hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1); hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
if (hwirq < 0) { if (hwirq < 0) {
pr_debug("u3msi: failed allocating hwirq\n"); pr_debug("u3msi: failed allocating hwirq\n");
......
...@@ -50,7 +50,7 @@ static int hsta_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -50,7 +50,7 @@ static int hsta_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
return -EINVAL; return -EINVAL;
} }
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
irq = msi_bitmap_alloc_hwirqs(&ppc4xx_hsta_msi.bmp, 1); irq = msi_bitmap_alloc_hwirqs(&ppc4xx_hsta_msi.bmp, 1);
if (irq < 0) { if (irq < 0) {
pr_debug("%s: Failed to allocate msi interrupt\n", pr_debug("%s: Failed to allocate msi interrupt\n",
...@@ -108,7 +108,7 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev) ...@@ -108,7 +108,7 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev)
struct msi_desc *entry; struct msi_desc *entry;
int irq; int irq;
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
......
...@@ -93,7 +93,7 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -93,7 +93,7 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
if (!msi_data->msi_virqs) if (!msi_data->msi_virqs)
return -ENOMEM; return -ENOMEM;
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
if (int_no >= 0) if (int_no >= 0)
break; break;
...@@ -127,7 +127,7 @@ void ppc4xx_teardown_msi_irqs(struct pci_dev *dev) ...@@ -127,7 +127,7 @@ void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n"); dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n");
list_for_each_entry(entry, &dev->msi_list, list) { for_each_pci_msi_entry(entry, dev) {
if (entry->irq == NO_IRQ) if (entry->irq == NO_IRQ)
continue; continue;
irq_set_msi_desc(entry->irq, NULL); irq_set_msi_desc(entry->irq, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment