linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Marek Vasut <marek.vasut@gmail.com>,
	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>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH V5] PCI: rcar: Use runtime PM to control controller clock
Date: Mon, 9 Apr 2018 14:26:36 +0200	[thread overview]
Message-ID: <20180409122636.6rmtzhqqlpqxyear@verge.net.au> (raw)
In-Reply-To: <CAMuHMdUF0oG+fdWv2CissD9tviHiVCg3ofW3oR3vY+=Km41tAg@mail.gmail.com>

On Mon, Apr 09, 2018 at 01:47:38PM +0200, Geert Uytterhoeven wrote:
> Hi Simon, Marek,
> 
> On Mon, Apr 9, 2018 at 1:41 PM, Simon Horman <horms@verge.net.au> wrote:
> > On Mon, Apr 09, 2018 at 10:20:05AM +0200, Marek Vasut wrote:
> >> On 04/09/2018 10:07 AM, Geert Uytterhoeven wrote:
> >> > On Sun, Apr 8, 2018 at 3:09 PM, 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>
> >> >> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> >> >> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> >> >> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> >> >> Cc: Simon Horman <horms+renesas@verge.net.au>
> >> >> Cc: Wolfram Sang <wsa@the-dreams.de>
> >> >> Cc: linux-renesas-soc@vger.kernel.org
> >> >> To: linux-pci@vger.kernel.org
> >> >> ---
> >> >> V2: - Reorder the fail path in rcar_pcie_probe() to cater for the
> >> >>       reordering of function calls in probe
> >> >>     - Dispose of fail_clk in rcar_pcie_get_resources()
> >> >> V3: - Fix up the failpath in probe function
> >> >> V4: - Rebase on recent linux-next
> >> >> V5: - Do not call pci_free_resource_list(&pcie->resources) if
> >> >>       rcar_pcie_parse_request_of_pci_ranges() fails, since that
> >> >>       functiona calls pci_free_resource_list() already.
> >> >
> >> > Thanks for the update!
> >> >
> >> >> --- a/drivers/pci/host/pcie-rcar.c
> >> >> +++ b/drivers/pci/host/pcie-rcar.c
> >> >
> >> >> @@ -1124,22 +1111,22 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> >> >>         if (err)
> >> >>                 goto err_free_bridge;
> >> >>
> >> >> +       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;
> >> >> +       }
> >> >> +
> >> >
> >> > As you moved the pm_runtime setup up...
> >> >
> >> >>         err = rcar_pcie_get_resources(pcie);
> >> >>         if (err < 0) {
> >> >>                 dev_err(dev, "failed to request resources: %d\n", err);
> >> >> -               goto err_free_resource_list;
> >> >> +               goto err_pm_put;
> >> >>         }
> >> >>
> >> >>         err = rcar_pcie_parse_map_dma_ranges(pcie, dev->of_node);
> >> >>         if (err)
> >> >> -               goto err_free_resource_list;
> >> >> -
> >> >> -       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;
> >> >> -       }
> >> >> +               goto err_pm_put;
> >> >>
> >> >>         /* Failure to get a link might just be that no cards are inserted */
> >> >>         hw_init_fn = of_device_get_match_data(dev);
> >> >> @@ -1174,9 +1161,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> >> >>
> >> >>  err_pm_disable:
> >> >>         pm_runtime_disable(dev);
> >> >
> >> > ... shouldn't it be moved down here, for symmetry?
> >>
> >> I am reasonably certain the failpath should be correct now. Did I still
> >> miss something ?
> >
> > It looks correct to me too. Geert are Marek and I missing something?
> 
> Probably it will still work fine, but after this patch, Runtime PM is enabled
> early, and disabled early, which is not symmetrical.
> 
> I like symmetry ;-)

Understood. I think that is reasonable.
Marek, would you care to respin?

  reply	other threads:[~2018-04-09 12:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 13:09 [PATCH V5] PCI: rcar: Use runtime PM to control controller clock Marek Vasut
2018-04-09  8:07 ` Geert Uytterhoeven
2018-04-09  8:20   ` Marek Vasut
2018-04-09 11:41     ` Simon Horman
2018-04-09 11:47       ` Geert Uytterhoeven
2018-04-09 12:26         ` Simon Horman [this message]
2018-04-10 14:31           ` Marek Vasut
2018-04-10 14:42             ` Geert Uytterhoeven
2018-04-10 15:25               ` Marek Vasut
2018-04-10 15:28                 ` Geert Uytterhoeven
2018-04-10 16:17                   ` Marek Vasut
2018-04-13 12:48                     ` Simon Horman
2018-04-13 17:48                       ` Lorenzo Pieralisi
2018-05-01 10:55                       ` Lorenzo Pieralisi
2018-05-14 15:32                         ` Marek Vasut
2018-05-14 15:49                           ` Lorenzo Pieralisi
2018-05-21 11:08                             ` Marek Vasut
2018-05-21 13:03                               ` Lorenzo Pieralisi
2018-05-21 13:09                                 ` Marek Vasut
2018-04-19 10:00                     ` Geert Uytterhoeven
2018-05-21 12:57                       ` Marek Vasut

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=20180409122636.6rmtzhqqlpqxyear@verge.net.au \
    --to=horms@verge.net.au \
    --cc=dien.pham.ry@rvc.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=hien.dang.eb@renesas.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=marek.vasut@gmail.com \
    --cc=phil.edworthy@renesas.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).