linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	"Lukas F . Hartmann" <lukas@mntmn.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Richard Zhu <hongxing.zhu@nxp.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH 1/2] PCI: imx: Fix probe failure without power domain
Date: Tue, 22 Jan 2019 09:52:20 +0000	[thread overview]
Message-ID: <VI1PR04MB5533FD41536472C64A4A5559EE980@VI1PR04MB5533.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 20190122094430.rg76mkemz5wvk5t3@pengutronix.de

On 1/22/19 11:44 AM, Uwe Kleine-König wrote:
> On Tue, Jan 22, 2019 at 09:17:22AM +0000, Leonard Crestez wrote:
>> On 1/22/2019 9:12 AM, Uwe Kleine-König wrote:
>>> On Mon, Jan 21, 2019 at 10:50:04PM +0000, Leonard Crestez wrote:
>>>> On chips without a separate power domain for PCI (such as 6q/6qp) the
>>>> imx6_pcie_attach_pd function incorrectly returns an error.
>>>>
>>>> Fix by returning 0 if dev_pm_domain_attach_by_name doesn't find
>>>> anything.
>>>>
>>>> Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support")
>>>>
>>>> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
>>>> @@ -308,10 +308,13 @@ static int imx6_pcie_attach_pd(struct device *dev)
>>>>    		return 0;
>>>>    
>>>>    imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie");
>>>>    if (IS_ERR(imx6_pcie->pd_pcie))
>>>>    	return PTR_ERR(imx6_pcie->pd_pcie);
>>>> +	/* Do nothing when power domain missing */
>>>> +	if (!imx6_pcie->pd_pcie)
>>>> +		return 0;
>>>
>>> As I said in the mail that proposed this patch for testing: I think it
>>> would be better to change dev_pm_domain_attach_by_name to not return an
>>> error indication by returning NULL or an ERR_PTR value. (Or change
>>> device_link_add to accept NULL if NULL is a dummy value.)
>>
>> I'm not sure what you mean. Should dev_pm_domain_attach_by_name return
>> ERR_PTR(-ENOENT) for name not found? It would still require special
>> handling for callers.
> 
> Yes, callers would still need to handle an error, but they only need to
> check for IS_ERR(retval) instead of IS_ERR(retval) && retval != NULL.

But "not found" is not treated as an error here, it's what happens when 
no PD is assigned. The fix makes imx6_pcie_attach_pd return success in 
this case.

Making dev_pm_domain_attach_by_name return ENOENT would still require a 
special case for ENOENT here.

--
Regards,
Leonard

  reply	other threads:[~2019-01-22  9:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 22:50 [PATCH 0/2] PCI: imx: imx6_pcie_attach_pd Leonard Crestez
2019-01-21 22:50 ` [PATCH 1/2] PCI: imx: Fix probe failure without power domain Leonard Crestez
2019-01-22  7:12   ` Uwe Kleine-König
2019-01-22  9:17     ` Leonard Crestez
2019-01-22  9:44       ` Uwe Kleine-König
2019-01-22  9:52         ` Leonard Crestez [this message]
2019-01-21 22:50 ` [PATCH 2/2] PCI: imx: Fix checking pd_pcie_phy device_link Leonard Crestez
2019-01-25 17:59 ` [PATCH 0/2] PCI: imx: imx6_pcie_attach_pd 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=VI1PR04MB5533FD41536472C64A4A5559EE980@VI1PR04MB5533.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lukas@mntmn.com \
    --cc=rafael@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ulf.hansson@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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).