Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3513012ybl; Mon, 12 Aug 2019 01:35:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhHBVZ5EBzpbHRqc2BoQPLk8WZ+mcCmwEBbKR3+QSFy18HXlKmtFherCw6fYPBbM3K4FhC X-Received: by 2002:a17:90a:5887:: with SMTP id j7mr22099245pji.136.1565598905084; Mon, 12 Aug 2019 01:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565598905; cv=none; d=google.com; s=arc-20160816; b=jFy2oQ67UvIcXLEHlAAjrWcrfhjemzNpnK6ZZ0G7o5NTHrwqlzk/SB2jW+fkt8Zehj uxt1j4lQv+HSAc2McVRrCooNLa8pRIWXZxSgRj4l/o7/O7QdLUUo4e4lIOlcT9rj9Qn6 PXrYHaRVFBIJUF8q+DMsG33Qb/kbPWZpUNTt5KCSjcM8hRvgV0CmL6kyedIe9ye9/JNx GnMvF+z5NYuLSBLMwiINTR+vHjzPQwXj1Z7plhiwJjLXSDtuwTy70ljNIHBrHTVWU648 lTtWcbYlF9K3FLlb6c/Afng5DnrespxMBZ5dcEnD/zAOE8IsT+Ss99NZiIkfppw6GTHT XfhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=p+VEwaVX9rUgGdS9VioRxGKc4XuR35KvmTNy+1EmhgI=; b=PddfCVeiJO/Rq+aR8HB4ZclNeF5wmkGj07HlS+2IZyp376khmTv2LHJHm6cDhBFYTb 3rE9m48kLSbhPaKOFR2bzgsjfA28unWVlw60jFJh0xJiiTaHSZi4hV2QBVZs/pz/bLI2 TGlX/c4j+uXJHalspeBdd3JgP335nPH6lCFJak51vv2ScvJzlZko0Sb2Y5hka1CH47Fo /l1y0YkoJOdNMlWt4Kdc7pCKsu0YRbzjNPHsuyymAU4ndfuaKK9/58w7Ka9ilJN4vRgn K/GJqhvck5pfjftYaq4JBmRU0Ear/42WkI9TCTRyjfRpUPsovgVWQBGRneyB6RVwWwv9 rb3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si64520836pgb.47.2019.08.12.01.34.48; Mon, 12 Aug 2019 01:35:05 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbfHLIeQ (ORCPT + 99 others); Mon, 12 Aug 2019 04:34:16 -0400 Received: from foss.arm.com ([217.140.110.172]:45070 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbfHLIeQ (ORCPT ); Mon, 12 Aug 2019 04:34:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45E8B15A2; Mon, 12 Aug 2019 01:34:15 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5BF93F718; Mon, 12 Aug 2019 01:34:14 -0700 (PDT) Date: Mon, 12 Aug 2019 09:34:13 +0100 From: Andrew Murray To: "Z.q. Hou" Cc: "linux-pci@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "gustavo.pimentel@synopsys.com" , "jingoohan1@gmail.com" , "bhelgaas@google.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , Leo Li , "lorenzo.pieralisi@arm.com" , "M.h. Lian" Subject: Re: [PATCH 2/4] PCI: dwc: Return directly when num-lanes is not found Message-ID: <20190812083412.GT56241@e119886-lin.cambridge.arm.com> References: <20190812042435.25102-1-Zhiqiang.Hou@nxp.com> <20190812042435.25102-3-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190812042435.25102-3-Zhiqiang.Hou@nxp.com> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 12, 2019 at 04:22:22AM +0000, Z.q. Hou wrote: > From: Hou Zhiqiang > > The num-lanes is optional, so probably it isn't added > on some platforms. The subsequent programming is base > on the num-lanes, hence return when it is not found. > > Signed-off-by: Hou Zhiqiang > --- > drivers/pci/controller/dwc/pcie-designware.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 7d25102c304c..0a89bfd1636e 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -423,8 +423,10 @@ void dw_pcie_setup(struct dw_pcie *pci) > > > ret = of_property_read_u32(np, "num-lanes", &lanes); > - if (ret) > - lanes = 0; > + if (ret) { > + dev_dbg(pci->dev, "property num-lanes isn't found\n"); > + return; > + } The existing code would assign a value of 0 to lanes when num-lanes isn't specified, however this value isn't supported by the following switch statement - thus we'd also print an error and return. Therefore the only and subtle effect effect of this patch is to change a dev_err to a dev_dbg when num-lanes isn't specified and avoid a read of PCIE_PORT_LINK_CONTROL. Given that num-lanes is described as optional this makes perfect sense. Though the commit message/hunk does give the apperance that this provides a more functional change. Anyway: Reviewed-by: Andrew Murray > > /* Set the number of lanes */ > val = dw_pcie_readl_dbi(pci, PCIE_PORT_LINK_CONTROL); > -- > 2.17.1 >