linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vidya Sagar <vidyas@nvidia.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Andrew Murray <amurray@thegoodpenguin.co.uk>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: Jon Hunter <jonathanh@nvidia.com>, <linux-pci@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>
Subject: Re: [PATCH] PCI: tegra: Print -EPROBE_DEFER error message at debug level
Date: Thu, 19 Mar 2020 22:34:01 +0530	[thread overview]
Message-ID: <2e763237-fe19-68b3-d584-a3ad28689b87@nvidia.com> (raw)
In-Reply-To: <20200319131230.3216305-1-thierry.reding@gmail.com>



On 3/19/2020 6:42 PM, Thierry Reding wrote:
> External email: Use caution opening links or attachments
> 
> 
> From: Thierry Reding <treding@nvidia.com>
> 
> Probe deferral is an expected error condition that will usually be
> recovered from. Print such error messages at debug level to make them
> available for diagnostic purposes when building with debugging enabled
> and hide them otherwise to not spam the kernel log with them.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>   drivers/pci/controller/dwc/pcie-tegra194.c | 42 ++++++++++++++++++----
>   1 file changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 97d3f3db1020..e4870fa6ce9c 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1159,17 +1159,31 @@ static int tegra_pcie_dw_parse_dt(struct tegra_pcie_dw *pcie)
>          /* Endpoint mode specific DT entries */
>          pcie->pex_rst_gpiod = devm_gpiod_get(pcie->dev, "reset", GPIOD_IN);
>          if (IS_ERR(pcie->pex_rst_gpiod)) {
> -               dev_err(pcie->dev, "Failed to get PERST GPIO: %ld\n",
> -                       PTR_ERR(pcie->pex_rst_gpiod));
> -               return PTR_ERR(pcie->pex_rst_gpiod);
> +               int err = PTR_ERR(pcie->pex_rst_gpiod);
> +               const char *level = KERN_ERR;
> +
> +               if (err == -EPROBE_DEFER)
> +                       level = KERN_DEBUG;
> +
> +               dev_printk(level, pcie->dev,
> +                          dev_fmt("Failed to get PERST GPIO: %d\n"),
> +                          err);
> +               return err;
>          }
> 
>          pcie->pex_refclk_sel_gpiod = devm_gpiod_get(pcie->dev,
>                                                      "nvidia,refclk-select",
>                                                      GPIOD_OUT_HIGH);
>          if (IS_ERR(pcie->pex_refclk_sel_gpiod)) {
> -               dev_info(pcie->dev, "Failed to get REFCLK select GPIOs: %ld\n",
> -                        PTR_ERR(pcie->pex_refclk_sel_gpiod));
> +               int err = PTR_ERR(pcie->pex_refclk_sel_gpiod);
> +               const char *level = KERN_ERR;
> +
> +               if (err == -EPROBE_DEFER)
> +                       level = KERN_DEBUG;
> +
> +               dev_printk(level, pcie->dev,
> +                          dev_fmt("Failed to get REFCLK select GPIOs: %d\n"),
> +                          err);
>                  pcie->pex_refclk_sel_gpiod = NULL;
>          }
> 
> @@ -2058,13 +2072,27 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
> 
>          ret = tegra_pcie_dw_parse_dt(pcie);
>          if (ret < 0) {
> -               dev_err(dev, "Failed to parse device tree: %d\n", ret);
> +               const char *level = KERN_ERR;
> +
> +               if (ret == -EPROBE_DEFER)
> +                       level = KERN_DEBUG;
> +
> +               dev_printk(level, dev,
> +                          dev_fmt("Failed to parse device tree: %d\n"),
> +                          ret);
>                  return ret;
>          }
> 
>          ret = tegra_pcie_get_slot_regulators(pcie);
>          if (ret < 0) {
> -               dev_err(dev, "Failed to get slot regulators: %d\n", ret);
> +               const char *level = KERN_ERR;
> +
> +               if (ret == -EPROBE_DEFER)
> +                       level = KERN_DEBUG;
> +
> +               dev_printk(level, dev,
> +                          dev_fmt("Failed to get slot regulators: %d\n"),
> +                          ret);
>                  return ret;
>          }
> 
> --
> 2.24.1
> 

Reviewed-by: Vidya Sagar <vidyas@nvidia.com>
Tested-by: Vidya Sagar <vidyas@nvidia.com>

  reply	other threads:[~2020-03-19 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 13:12 [PATCH] PCI: tegra: Print -EPROBE_DEFER error message at debug level Thierry Reding
2020-03-19 17:04 ` Vidya Sagar [this message]
2020-03-19 18:05 ` Lorenzo Pieralisi
2020-03-23 13:34   ` Thierry Reding
2020-03-23 17:21     ` Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e763237-fe19-68b3-d584-a3ad28689b87@nvidia.com \
    --to=vidyas@nvidia.com \
    --cc=amurray@thegoodpenguin.co.uk \
    --cc=bhelgaas@google.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).