From patchwork Mon Sep 28 12:57:37 2015 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: 54202 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id C3D8222DEE for ; Mon, 28 Sep 2015 12:58:22 +0000 (UTC) Received: by laka1 with SMTP id a1sf49067273lak.0 for ; Mon, 28 Sep 2015 05:58:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=OnNw2s5ehnrML7kZtlppehSCMUaQccY8Qto1uXFySfo=; b=Zwh+TIc/QyU9Eg2DGq21w9uA4xq+NkvMU9/lDumjINZyDxAKBLWWKStrQF4v1p7RR7 +3wttb9pdiELDj3TAPVnkpVKfhpem8p/f00XZhNzBFZu+6MqMeecN7sVX0sQPCduG0Ug AmxDRyST3c99E52YoN952QpGpYwMUglofuDoNcyUC1Anjdf0de+J+3pYyBbCjVtGYeeP 7eZ8p04q9pfkXge3UTxO5C74VnEgAJquDVKHnMktXipmuiNYiET3VVxpDCLwwhWRPQkV lNdLMwpVAdv4ss9f6y0bJjnf4jSf8yrioJBpAJToxn8lsHBgwiVjEAj751+kkjyYzohq N3Xg== X-Gm-Message-State: ALoCoQnm2cun2oMdxz8h9QZCJTeITuyX3POqodwlbDR1taWSQbxTFhdKyIHA1v2PfBouM/HlE9Df X-Received: by 10.152.29.132 with SMTP id k4mr3069015lah.8.1443445101319; Mon, 28 Sep 2015 05:58:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.230 with SMTP id 6ls129306lax.7.gmail; Mon, 28 Sep 2015 05:58:21 -0700 (PDT) X-Received: by 10.112.13.40 with SMTP id e8mr5337315lbc.82.1443445101143; Mon, 28 Sep 2015 05:58:21 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id f8si8178287laf.167.2015.09.28.05.58.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2015 05:58:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labzv5 with SMTP id zv5so13864588lab.1 for ; Mon, 28 Sep 2015 05:58:21 -0700 (PDT) X-Received: by 10.25.150.199 with SMTP id y190mr3666262lfd.35.1443445100951; Mon, 28 Sep 2015 05:58:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1543701lbq; Mon, 28 Sep 2015 05:58:20 -0700 (PDT) X-Received: by 10.50.79.164 with SMTP id k4mr14950586igx.16.1443445099962; Mon, 28 Sep 2015 05:58:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 42si11983811iok.146.2015.09.28.05.58.19; Mon, 28 Sep 2015 05:58:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933687AbbI1M6R (ORCPT + 30 others); Mon, 28 Sep 2015 08:58:17 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:57481 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933547AbbI1M5s (ORCPT ); Mon, 28 Sep 2015 08:57:48 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8SCvlQx011783; Mon, 28 Sep 2015 07:57:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8SCvllE016162; Mon, 28 Sep 2015 07:57:47 -0500 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; Mon, 28 Sep 2015 07:57:47 -0500 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 t8SCvf8S030418; Mon, 28 Sep 2015 07:57:45 -0500 From: Kishon Vijay Abraham I To: CC: , , , , , Subject: [RFC PATCH 1/2] pci: host: pci-dra7xx: use "num-lanes" property to find phy count Date: Mon, 28 Sep 2015 18:27:37 +0530 Message-ID: <1443445058-643-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1443445058-643-1-git-send-email-kishon@ti.com> References: <1443445058-643-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , use "num-lanes" property to find phy count instead of the number phy-names property. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/host/pci-dra7xx.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c index 199e29a..e15b2e2 100644 --- a/drivers/pci/host/pci-dra7xx.c +++ b/drivers/pci/host/pci-dra7xx.c @@ -66,7 +66,7 @@ struct dra7xx_pcie { void __iomem *base; struct phy **phy; - int phy_count; + int lanes; struct device *dev; struct pcie_port pp; }; @@ -328,7 +328,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; @@ -362,17 +362,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])) @@ -392,7 +391,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); @@ -449,7 +448,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); @@ -495,7 +494,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]); @@ -508,7 +507,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;