Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3177072ybi; Fri, 5 Jul 2019 03:12:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkBNPL3vdUb0gnVjnbI8CpjEXCpCV9EKPKae/PgI7TGVJSVQ3vsnVlcwxGUlD1jdS4nVS/ X-Received: by 2002:a17:90a:2430:: with SMTP id h45mr4597279pje.14.1562321559021; Fri, 05 Jul 2019 03:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562321559; cv=none; d=google.com; s=arc-20160816; b=HIwW9AY5o/t/IiaVHORB0AAgE242QGvAZABR/7svg3+pLwfN792WWmexgxdJg5C4PD ShBGOJgTLSdHY1ZkX5z907+RKG5Vb9fDcKHU8ggPK6S0rURaqzLn+EGPzY0lUEIN25pA IVdyDzxVUyr/JgesaCeDDTv0C2xLbcoAEmigqz9T1B/Yi992Mv+zMp+FKt7SakpI7K2z MfWS1PqODMBY9i2mwdDgyZT2x7ZfodIDZ0scXPL2ORECinCg6Oetyyck++J3SzwfqsYx Kl1DUtmZilPuAixi50oCnrsDOzyeAgh3UyRccR5REldoN4LsytI9S8AI/wPRx2lAXw+w 1cvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=iuPlrRbm3SRRKi5NaJZmZm/BQsmRFpOi0nq1gIpKbP4=; b=hBvV0v7ebbYEBMrkx+B02ZtwyFwX1ruISDFIbrVQQcsaMtXldPj6W6vSzi2RElpHFn Zfit9dEKPEmiYvdknF9Tl10oiStayFCnvuR26yAXGbugIqBm0xZVd7S0i6ge/e+nxRcj HiO/JPIJl90hYZS+rpuVUgxfNLKwiz6U5FjkR7o4oCPkUt+Osc7YPmiuAqx+8oiaSg0s 9lbSaNo83RStXLsiD0KAZXFRAzetAdyx01elxHrwghh6KC2Aa94szCy5M+SYIS0dglSJ ngZ6D8PXVVVLPlVZIOlWr6TRjn8QcXH0MKdaaK43NMKeFZTekL4jAizM68ZXfWwlAShI LAlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=UOIH9ZOk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l70si7585438pje.68.2019.07.05.03.12.23; Fri, 05 Jul 2019 03:12:38 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=UOIH9ZOk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728308AbfGEKL7 (ORCPT + 99 others); Fri, 5 Jul 2019 06:11:59 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:8879 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726005AbfGEKL7 (ORCPT ); Fri, 5 Jul 2019 06:11:59 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 05 Jul 2019 03:11:56 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 05 Jul 2019 03:11:57 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 05 Jul 2019 03:11:57 -0700 Received: from [192.168.1.141] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 5 Jul 2019 10:11:54 +0000 Subject: Re: [PATCH] PCI: tegra: Fix support for GPIO based PERST# To: Lorenzo Pieralisi , Jon Hunter CC: Thierry Reding , Bjorn Helgaas , , , References: <20190705084850.30777-1-jonathanh@nvidia.com> <20190705095008.GB17491@e121166-lin.cambridge.arm.com> X-Nvconfidentiality: public From: Manikanta Maddireddy Message-ID: <3269adc0-215a-be7b-0820-bea7c07f6dcc@nvidia.com> Date: Fri, 5 Jul 2019 15:41:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190705095008.GB17491@e121166-lin.cambridge.arm.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-US DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1562321516; bh=iuPlrRbm3SRRKi5NaJZmZm/BQsmRFpOi0nq1gIpKbP4=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type: Content-Transfer-Encoding:Content-Language; b=UOIH9ZOkFY4izZikflUYNA89wYJRhxtFgSvBW14H6qXL07AVK3Fb1vwlgI7cH6Iqm s0Kxngl3iyS68AKHteo58uPEi9wtS3Of1z7CTDOvTgRMdIVG1tzELjDFklSoZpQXfI ZB5vha0G6LAuwan2sfcyKSsvHXtuLTONdfXml2utCvQWnIeORZm/9/IxMgt5FOxajn NoxBPLEBwi65NoPWkxVfvw3KGHicZSVjY7PHl/WaGbXeQ8dS1MuJiDZ1hd7GFzr/3w Sgf6/EPffOTVfeJEb01y94SFH4MRTSOeQbIMMH3djzb6UBYwTFAavpusdgf13CGHly NfIqqvr95FCsQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05-Jul-19 3:20 PM, Lorenzo Pieralisi wrote: > On Fri, Jul 05, 2019 at 09:48:50AM +0100, Jon Hunter wrote: >> Commit 5e5e9c23f82a ("PCI: tegra: Add support for GPIO based PERST#") >> calls the function devm_gpiod_get_from_of_node() to request a GPIO. >> Unfortunately, around the same time this was merged, commit 025bf37725f1 >> ("gpio: Fix return value mismatch of function gpiod_get_from_of_node()") >> was also merged to fix the return value of the function >> devm_gpiod_get_from_of_node() that was incorrectly returning NULL >> instead of an error pointer encoded with -ENOENT if no GPIO was found. >> When this fix for the GPIO subsystem was merged, PCI support for Tegra >> devices that did not provide a GPIO for the PERST# (which is optional) >> broke because the Tegra PCI driver was expecting NULL to be returned if >> no GPIO was present and not -ENOENT. >> >> Fix this by checking to see if -ENOENT is returned from the function >> devm_gpiod_get_from_of_node(), to indicate there is no GPIO for PERST# >> present, and if this is the case set the variable 'reset_gpio' to NULL. >> If the variable 'reset_gpio' is NULL then the Tegra PCI driver will >> fallback to using the AFI register to toggle the PERST#. Finally, >> correct the comment now that NULL is no longer returned from >> devm_gpiod_get_from_of_node(). >> >> Fixes: 5e5e9c23f82a ("PCI: tegra: Add support for GPIO based PERST#") >> Signed-off-by: Jon Hunter >> --- >> drivers/pci/controller/pci-tegra.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) > Can I squash this in the original commit (ie Fixes: tag above) ? I do > not think there is any issue with that, if there is please do let me > know. > > Thanks, > Lorenzo Reviewed-by: Manikanta Maddireddy Thank you Jon for publishing the fix. Hi Lorenzo, Yes, this patch can be squashed in the original commit. Apologies for the inconvenience. Manikanta >> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c >> index 9cc03a2549c0..ff8a346f3e04 100644 >> --- a/drivers/pci/controller/pci-tegra.c >> +++ b/drivers/pci/controller/pci-tegra.c >> @@ -2295,18 +2295,22 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) >> } >> >> /* >> - * Returns null if reset-gpios property is not populated and >> - * fall back to using AFI per port register to toggle PERST# >> - * SFIO line. >> + * Returns -ENOENT if reset-gpios property is not populated >> + * and in this case fall back to using AFI per port register >> + * to toggle PERST# SFIO line. >> */ >> rp->reset_gpio = devm_gpiod_get_from_of_node(dev, port, >> "reset-gpios", 0, >> GPIOD_OUT_LOW, >> label); >> if (IS_ERR(rp->reset_gpio)) { >> - err = PTR_ERR(rp->reset_gpio); >> - dev_err(dev, "failed to get reset GPIO: %d\n", err); >> - return err; >> + if (PTR_ERR(rp->reset_gpio) == -ENOENT) { >> + rp->reset_gpio = NULL; >> + } else { >> + dev_err(dev, "failed to get reset GPIO: %d\n", >> + err); >> + return PTR_ERR(rp->reset_gpio); >> + } >> } >> >> list_add_tail(&rp->list, &pcie->ports); >> -- >> 2.17.1 >>