diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2015-09-18 13:58:35 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-09-18 13:58:35 -0500 |
commit | ea643e1a33576216de589cf525dbb40267fde5a9 (patch) | |
tree | fab9fddb5d81211c90717a1d2e0450dde2e5b7c3 /drivers/pci/host/pcie-designware.c | |
parent | 339e5b44eda2150baad183def6b7030fad5ec44e (diff) | |
download | op-kernel-dev-ea643e1a33576216de589cf525dbb40267fde5a9.zip op-kernel-dev-ea643e1a33576216de589cf525dbb40267fde5a9.tar.gz |
PCI: designware: Factor out MSI msg setup
Factor out the PCI MSI message setup from the single MSI setup function.
This will be reused by the multivector MSI setup.
No functional change yet.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
Diffstat (limited to 'drivers/pci/host/pcie-designware.c')
-rw-r--r-- | drivers/pci/host/pcie-designware.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index d726926..ea5b285 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -293,19 +293,9 @@ no_valid_irq: return -ENOSPC; } -static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev, - struct msi_desc *desc) +static void dw_msi_setup_msg(struct pcie_port *pp, unsigned int irq, u32 pos) { - int irq, pos; struct msi_msg msg; - struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata); - - if (desc->msi_attrib.is_msix) - return -EINVAL; - - irq = assign_irq(1, desc, &pos); - if (irq < 0) - return irq; if (pp->ops->get_msi_addr) msg.address_lo = pp->ops->get_msi_addr(pp); @@ -319,6 +309,22 @@ static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev, msg.data = pos; pci_write_msi_msg(irq, &msg); +} + +static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev, + struct msi_desc *desc) +{ + int irq, pos; + struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata); + + if (desc->msi_attrib.is_msix) + return -EINVAL; + + irq = assign_irq(1, desc, &pos); + if (irq < 0) + return irq; + + dw_msi_setup_msg(pp, irq, pos); return 0; } |