From: David Cohen <david.a.cohen@linux.intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>,
sarah.a.sharp@linux.intel.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-usb@vger.kernel.org, santosh.shilimkar@ti.com
Subject: Re: [RFC/PATCH 3/3] usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP
Date: Fri, 13 Dec 2013 07:46:56 -0800 [thread overview]
Message-ID: <20131213154656.GA6006@psi-dev26.jf.intel.com> (raw)
In-Reply-To: <CAPDyKFoXjRsLTZzFy3cTafqwFg4JX01=Gb=eL23eeb9ddZiofA@mail.gmail.com>
On Fri, Dec 13, 2013 at 09:19:34AM +0100, Ulf Hansson wrote:
> On 13 December 2013 06:18, David Cohen <david.a.cohen@linux.intel.com> wrote:
> > From: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >
> > Drivers using SET_*_PM_OPS() no longer need to #ifdef for CONFIG_PM_*
> > So, let's remove the unnecessary #ifdef's.
> >
> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > ---
> > drivers/usb/host/xhci-plat.c | 7 +------
> > 1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > index d9c169f470d3..b1d93c344e04 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -197,7 +197,6 @@ static int xhci_plat_remove(struct platform_device *dev)
> > return 0;
> > }
> >
> > -#ifdef CONFIG_PM
>
> I think you can solve this in another way.
>
> As a start, I would suggest to change above to CONFIG_PM_SLEEP
>
> > static int xhci_plat_suspend(struct device *dev)
> > {
> > struct usb_hcd *hcd = dev_get_drvdata(dev);
> > @@ -217,10 +216,6 @@ static int xhci_plat_resume(struct device *dev)
> > static const struct dev_pm_ops xhci_plat_pm_ops = {
> > SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
> > };
> > -#define DEV_PM_OPS (&xhci_plat_pm_ops)
> > -#else
> > -#define DEV_PM_OPS NULL
> > -#endif /* CONFIG_PM */
>
> Remove the use of DEV_PM_OPS define. Instead use below macro and
> outside #ifdef CONFIG_PM_SLEEP.
>
> "static SIMPLE_DEV_PM_OPS(xhci_plat_pm_ops, xhci_plat_suspend,
> xhci_plat_resume)"
>
> That should do the trick I believe, without the need for changing the
> existing SET_SYSTEM_SLEEP_PM_OPS macro in patch1.
Yes, it does. That matches my suggestion in this e-mail:
http://marc.info/?l=linux-kernel&m=138690490016503&w=2
But I personally don't like #ifdef's. In this case, SET_*_PM_OPS()
macros handle #ifdef's when setting the callbacks. My intention is to
extend it to callbacks' implementation too making the code cleaner
Br, David Cohen
>
> Kind regards
> Ulf Hansson
>
> >
> > #ifdef CONFIG_OF
> > static const struct of_device_id usb_xhci_of_match[] = {
> > @@ -235,7 +230,7 @@ static struct platform_driver usb_xhci_driver = {
> > .remove = xhci_plat_remove,
> > .driver = {
> > .name = "xhci-hcd",
> > - .pm = DEV_PM_OPS,
> > + .pm = &xhci_plat_pm_ops,
> > .of_match_table = of_match_ptr(usb_xhci_of_match),
> > },
> > };
> > --
> > 1.8.4.2
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2013-12-13 15:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 5:18 [RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart David Cohen
2013-12-13 5:18 ` [RFC/PATCH 1/3] pm: make PM " David Cohen
2013-12-15 17:51 ` Pavel Machek
2013-12-15 19:25 ` David Cohen
2013-12-20 19:55 ` Pavel Machek
2013-12-20 20:23 ` David Cohen
2014-01-14 22:42 ` David Cohen
2014-01-22 21:21 ` David Cohen
2013-12-13 5:18 ` [RFC/PATCH 2/3] usb/xhci: implement proper static inline stubs when !CONFIG_PM David Cohen
2013-12-13 5:18 ` [RFC/PATCH 3/3] usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP David Cohen
2013-12-13 8:19 ` Ulf Hansson
2013-12-13 15:46 ` David Cohen [this message]
2013-12-19 5:12 ` [RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart David Cohen
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=20131213154656.GA6006@psi-dev26.jf.intel.com \
--to=david.a.cohen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=santosh.shilimkar@ti.com \
--cc=sarah.a.sharp@linux.intel.com \
--cc=ulf.hansson@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