linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Marek Vasut <marek.vasut@gmail.com>,
	linux-pci@vger.kernel.org,
	Kazufumi Ikeda <kaz-ikeda@xc.jp.nec.com>,
	Gaku Inami <gaku.inami.xw@bp.renesas.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Simon Horman <horms+renesas@verge.net.au>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH V2] PCI: rcar: Add the initialization of PCIe link in resume_noirq
Date: Tue, 19 Mar 2019 16:18:03 +0000	[thread overview]
Message-ID: <20190319161803.GB12647@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <20190308171738.GB214730@google.com>

On Fri, Mar 08, 2019 at 11:17:38AM -0600, Bjorn Helgaas wrote:

[...]

> > >> +static int rcar_pcie_resume_noirq(struct device *dev)
> > >> +{
> > >> +	struct rcar_pcie *pcie = dev_get_drvdata(dev);
> > >> +
> > >> +	if (rcar_pci_read_reg(pcie, PMSR) &&
> > >> +	    !(rcar_pci_read_reg(pcie, PCIETCTLR) & DL_DOWN))
> > >> +		return 0;
> > >> +
> > >> +	/* Re-establish the PCIe link */
> > >> +	rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
> > >> +	return rcar_pcie_wait_for_dl(pcie);
> > >> +}
> > >> +
> > >> +static const struct dev_pm_ops rcar_pcie_pm_ops = {
> > >> +	.resume_noirq = rcar_pcie_resume_noirq,
> > >> +};
> > > 
> > > I think there's the beginning of a convention to use #ifdef
> > > CONFIG_PM_SLEEP around the ops themselves [1].  Otherwise I think
> > > we'll get a warning about unused code when CONFIG_PM_SLEEP is unset.
> > 
> > Only if I used SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() , but I set the
> > resume_noirq directly.
> 
> Fair enough.  I guess in this case if CONFIG_PM_SLEEP is unset, you
> set the pointer, which avoids the "unused function" warning, but we
> just never use that function pointer.
> 
> My intent is to avoid needless differences when possible, so when I
> review things like this I look at how other drivers do things.  It
> looks like all the other controllers use
> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() or similar:
> 
>   git grep -A3 "static.*dev_pm_ops" drivers/pci/controller
> 
> In the rcar case you only need the resume_fn, not the suspend_fn, so
> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() does a little more than you need and
> you'd have to pass NULL for suspend_fn.  I didn't check them all
> (suspend_noirq, freeze_noirq, poweroff_noirq), but at least for
> suspend_noirq, all users check for NULL before calling through the
> .suspend_noirq() function pointer, so I think that should be safe.

It is a matter of consistency across drivers, yes, but that's something
I can easily solve with a clean-up patch on top of Marek's one.

I would merge this patch as-is and convert all the drivers to a uniform
convention (which one I shall see).

On a side note, this patch looks like a fix to me (even though it is
not trivial for me to add a sensible Fixes: tag) and should be treated
as such, so it should go in one of the upcoming -rc* (and I float the
idea of sending it to stable kernels on which S2R is basically broken).

Lorenzo

  parent reply	other threads:[~2019-03-19 16:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-17 13:24 [PATCH V2] PCI: rcar: Add the initialization of PCIe link in resume_noirq marek.vasut
2019-02-19 17:24 ` Wolfram Sang
2019-02-25  9:58   ` Simon Horman
2019-03-07 20:50 ` Bjorn Helgaas
2019-03-07 22:49   ` Marek Vasut
2019-03-08 17:17     ` Bjorn Helgaas
2019-03-08 21:35       ` Marek Vasut
2019-03-11 10:10         ` Rafael J. Wysocki
2019-03-19 16:18       ` Lorenzo Pieralisi [this message]
2019-03-22 11:31 ` Lorenzo Pieralisi
2019-03-22 12:09   ` Marek Vasut
2019-03-22 12:18     ` Lorenzo Pieralisi
2019-03-22 12:29       ` Geert Uytterhoeven
2019-03-22 12:33         ` Marek Vasut
2019-03-22 12:42           ` Geert Uytterhoeven
2019-03-22 12:49             ` Marek Vasut
2019-03-25 16:54 ` Lorenzo Pieralisi
2019-03-25 19:44   ` 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=20190319161803.GB12647@e107981-ln.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=gaku.inami.xw@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=helgaas@kernel.org \
    --cc=horms+renesas@verge.net.au \
    --cc=kaz-ikeda@xc.jp.nec.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=marek.vasut@gmail.com \
    --cc=phil.edworthy@renesas.com \
    --cc=rjw@rjwysocki.net \
    --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).