From patchwork Wed Jan 6 10:49:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 59229 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp6503061lbb; Wed, 6 Jan 2016 02:50:27 -0800 (PST) X-Received: by 10.66.229.2 with SMTP id sm2mr141744163pac.28.1452077427686; Wed, 06 Jan 2016 02:50:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 86si17279055pfo.28.2016.01.06.02.50.27; Wed, 06 Jan 2016 02:50:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752181AbcAFKuZ (ORCPT + 3 others); Wed, 6 Jan 2016 05:50:25 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:39652 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbcAFKuU (ORCPT ); Wed, 6 Jan 2016 05:50:20 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id u06Ao2hR006069; Wed, 6 Jan 2016 04:50:02 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u06Ao2UT018038; Wed, 6 Jan 2016 04:50:02 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Wed, 6 Jan 2016 04:50:02 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u06Anspg015959; Wed, 6 Jan 2016 04:49:58 -0600 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , , , , , , Subject: [PATCH 1/2] pci: host: pci-dra7xx: use "num-lanes" property to find phy count Date: Wed, 6 Jan 2016 16:19:52 +0530 Message-ID: <1452077393-25880-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1452077393-25880-1-git-send-email-kishon@ti.com> References: <1452077393-25880-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org use "num-lanes" property to find phy count instead of the number phy-names property. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/pci/host/pci-dra7xx.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c index 5963adc..05bbeee 100644 --- a/drivers/pci/host/pci-dra7xx.c +++ b/drivers/pci/host/pci-dra7xx.c @@ -70,7 +70,7 @@ struct dra7xx_pcie { void __iomem *base; struct phy **phy; - int phy_count; + int lanes; struct device *dev; struct pcie_port pp; }; @@ -364,7 +364,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) int ret; int irq; int i; - int phy_count; + u32 lanes; struct phy **phy; void __iomem *base; struct resource *res; @@ -402,17 +402,16 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) if (!base) return -ENOMEM; - phy_count = of_property_count_strings(np, "phy-names"); - if (phy_count < 0) { - dev_err(dev, "unable to find the strings\n"); - return phy_count; + if (of_property_read_u32(np, "num-lanes", &lanes)) { + dev_err(dev, "Failed to parse the number of lanes\n"); + return -EINVAL; } - phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); + phy = devm_kzalloc(dev, sizeof(*phy) * lanes, GFP_KERNEL); if (!phy) return -ENOMEM; - for (i = 0; i < phy_count; i++) { + for (i = 0; i < lanes; i++) { snprintf(name, sizeof(name), "pcie-phy%d", i); phy[i] = devm_phy_get(dev, name); if (IS_ERR(phy[i])) @@ -432,7 +431,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) dra7xx->base = base; dra7xx->phy = phy; dra7xx->dev = dev; - dra7xx->phy_count = phy_count; + dra7xx->lanes = lanes; pm_runtime_enable(dev); ret = pm_runtime_get_sync(dev); @@ -489,7 +488,7 @@ static int __exit dra7xx_pcie_remove(struct platform_device *pdev) struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev); struct pcie_port *pp = &dra7xx->pp; struct device *dev = &pdev->dev; - int count = dra7xx->phy_count; + int count = dra7xx->lanes; if (pp->irq_domain) irq_domain_remove(pp->irq_domain); @@ -535,7 +534,7 @@ static int dra7xx_pcie_resume(struct device *dev) static int dra7xx_pcie_suspend_noirq(struct device *dev) { struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); - int count = dra7xx->phy_count; + int count = dra7xx->lanes; while (count--) { phy_power_off(dra7xx->phy[count]); @@ -548,7 +547,7 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev) static int dra7xx_pcie_resume_noirq(struct device *dev) { struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev); - int phy_count = dra7xx->phy_count; + int phy_count = dra7xx->lanes; int ret; int i;