linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-pci <linux-pci@vger.kernel.org>,
	Dien Pham <dien.pham.ry@rvc.renesas.com>,
	Hien Dang <hien.dang.eb@renesas.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Simon Horman <horms+renesas@verge.net.au>,
	Wolfram Sang <wsa@the-dreams.de>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH V2] PCI: rcar: Use runtime PM to control controller clock
Date: Fri, 10 Nov 2017 21:34:24 +0100	[thread overview]
Message-ID: <e6bf9480-0b82-b5c1-484a-f7d852cf6a19@gmail.com> (raw)
In-Reply-To: <CAMuHMdVqkx-eVzW=0D8eOKZ2OGc-XTenYW8FHnKgBAvjKvv4tw@mail.gmail.com>

On 11/08/2017 11:08 AM, Geert Uytterhoeven wrote:
> Hi Marek,

Hi Geert,

> On Wed, Nov 8, 2017 at 10:58 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> From: Dien Pham <dien.pham.ry@rvc.renesas.com>
>>
>> The controller clock can be switched off during suspend/resume,
>> let runtime PM take care of that.
>>
>> Signed-off-by: Dien Pham <dien.pham.ry@rvc.renesas.com>
>> Signed-off-by: Hien Dang <hien.dang.eb@renesas.com>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
>> --- a/drivers/pci/host/pcie-rcar.c
>> +++ b/drivers/pci/host/pcie-rcar.c
>> @@ -1125,6 +1112,13 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>>
>>         rcar_pcie_parse_request_of_pci_ranges(pcie);
>>
>> +       pm_runtime_enable(pcie->dev);
>> +       err = pm_runtime_get_sync(pcie->dev);
>> +       if (err < 0) {
>> +               dev_err(pcie->dev, "pm_runtime_get_sync failed\n");
>> +               goto err_pm_disable;
>> +       }
>> +
>>         err = rcar_pcie_get_resources(pcie);
>>         if (err < 0) {
>>                 dev_err(dev, "failed to request resources: %d\n", err);
> 
> (out of context)
>                  goto err_free_bridge;
> 
> But that should do pm_runtime_put(), too.
> 
>> @@ -1135,13 +1129,6 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>>         if (err)
>>                 goto err_free_bridge;
>>
>> -       pm_runtime_enable(dev);
>> -       err = pm_runtime_get_sync(dev);
>> -       if (err < 0) {
>> -               dev_err(dev, "pm_runtime_get_sync failed\n");
>> -               goto err_pm_disable;
>> -       }
>> -
>>         /* Failure to get a link might just be that no cards are inserted */
>>         hw_init_fn = of_device_get_match_data(dev);
>>         err = hw_init_fn(pcie);
>> @@ -1173,13 +1160,13 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>>  err_pm_put:
>>         pm_runtime_put(dev);
> 
> "err_pm_put" should be moved, too.

ACK. I combed through the probe function one more time and I hope I'll
have it right in V3.

>> -err_pm_disable:
>> -       pm_runtime_disable(dev);
>> -
>>  err_free_bridge:
>>         pci_free_host_bridge(bridge);
>>         pci_free_resource_list(&pcie->resources);

^ IMO this should happen after pm_runtime_disable too , just to be
consistent.

>> +err_pm_disable:
>> +       pm_runtime_disable(dev);
>> +
>>         return err;
>>  }

[...]


-- 
Best regards,
Marek Vasut

      reply	other threads:[~2017-11-10 21:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  9:58 [PATCH V2] PCI: rcar: Use runtime PM to control controller clock Marek Vasut
2017-11-08 10:08 ` Geert Uytterhoeven
2017-11-10 20:34   ` Marek Vasut [this message]

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=e6bf9480-0b82-b5c1-484a-f7d852cf6a19@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=dien.pham.ry@rvc.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=hien.dang.eb@renesas.com \
    --cc=horms+renesas@verge.net.au \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=wsa@the-dreams.de \
    /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).