[v4,08/10] PCI: dwc: keystone: Reuse designware domain allocation

Message ID 886911bf51e149b1c739a26d514f93f874b2c3e8.1514524551.git.gustavo.pimentel@synopsys.com
State Superseded
Headers show
Series
  • PCI: dwc: MSI-X feature
Related show

Commit Message

Gustavo Pimentel Dec. 29, 2017, 2:21 p.m.
Changes msi_host_init function content in order to reuse designware domain
allocation.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
Change v1->v2:
- Didn't exist.
Change v2->v3:
- Didn't exist.
Change v3->v4:
- New patch file.

 drivers/pci/dwc/pci-keystone-dw.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Kishon Vijay Abraham I Jan. 9, 2018, 8:53 a.m. | #1
Hi,

On Friday 29 December 2017 07:51 PM, Gustavo Pimentel wrote:
> Changes msi_host_init function content in order to reuse designware domain
> allocation.
> 
> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> ---
> Change v1->v2:
> - Didn't exist.
> Change v2->v3:
> - Didn't exist.
> Change v3->v4:
> - New patch file.
> 
>  drivers/pci/dwc/pci-keystone-dw.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c
> index 76e73d5..0390478 100644
> --- a/drivers/pci/dwc/pci-keystone-dw.c
> +++ b/drivers/pci/dwc/pci-keystone-dw.c
> @@ -165,24 +165,8 @@ void ks_dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq)
>  int ks_dw_pcie_msi_host_init(struct pcie_port *pp, struct msi_controller *chip)
>  {
>  	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> -	struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
> -	struct device *dev = pci->dev;
> -	int i;
> -
> -	pp->irq_domain = irq_domain_add_linear(ks_pcie->msi_intc_np,
> -					       MAX_MSI_IRQS,
> -					       &ks_dw_pcie_msi_domain_ops,
> -					       chip);
>  
> -	if (!pp->irq_domain) {
> -		dev_err(dev, "irq domain init failed\n");
> -		return -ENXIO;
> -	}
> -
> -	for (i = 0; i < MAX_MSI_IRQS; i++)
> -		irq_create_mapping(pp->irq_domain, i);
> -
> -	return 0;
> +	return dw_pcie_allocate_domains(pci);

With this version "pp" should be passed.

Thanks
Kishon

Patch

diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c
index 76e73d5..0390478 100644
--- a/drivers/pci/dwc/pci-keystone-dw.c
+++ b/drivers/pci/dwc/pci-keystone-dw.c
@@ -165,24 +165,8 @@  void ks_dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq)
 int ks_dw_pcie_msi_host_init(struct pcie_port *pp, struct msi_controller *chip)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
-	struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
-	struct device *dev = pci->dev;
-	int i;
-
-	pp->irq_domain = irq_domain_add_linear(ks_pcie->msi_intc_np,
-					       MAX_MSI_IRQS,
-					       &ks_dw_pcie_msi_domain_ops,
-					       chip);
 
-	if (!pp->irq_domain) {
-		dev_err(dev, "irq domain init failed\n");
-		return -ENXIO;
-	}
-
-	for (i = 0; i < MAX_MSI_IRQS; i++)
-		irq_create_mapping(pp->irq_domain, i);
-
-	return 0;
+	return dw_pcie_allocate_domains(pci);
 }
 
 void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie)