From: David Cohen <david.a.cohen@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>,
Josh Cartwright <joshc@codeaurora.org>,
linux-pm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] usb: phy: msm: use ASSIGN_*_PM_OPS variants
Date: Thu, 27 Feb 2014 15:41:31 -0800 [thread overview]
Message-ID: <20140227234129.GA21032@psi-dev26.jf.intel.com> (raw)
In-Reply-To: <20140227190324.GC4421@kroah.com>
On Thu, Feb 27, 2014 at 11:03:24AM -0800, Greg Kroah-Hartman wrote:
> On Tue, Feb 25, 2014 at 12:33:36PM -0600, Felipe Balbi wrote:
> > Hi,
> >
> > On Mon, Feb 24, 2014 at 11:08:27AM -0600, Josh Cartwright wrote:
> > > Use ASSIGN_SYSTEM_SLEEP_PM_OPS and ASSIGN_RUNTIME_PM_OPS in the
> > > initializer for msm_otg_dev_pm_ops. Doing so allows us to eliminate
> > > preprocessor conditionals around the specified callbacks.
> > >
> > > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > > ---
> > > drivers/usb/phy/phy-msm-usb.c | 13 +++----------
> > > 1 file changed, 3 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> > > index 5b37b81..c04f2e3 100644
> > > --- a/drivers/usb/phy/phy-msm-usb.c
> > > +++ b/drivers/usb/phy/phy-msm-usb.c
> > > @@ -414,8 +414,6 @@ static int msm_otg_reset(struct usb_phy *phy)
> > > #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000)
> > > #define PHY_RESUME_TIMEOUT_USEC (100 * 1000)
> > >
> > > -#ifdef CONFIG_PM
> > > -
> > > #define USB_PHY_SUSP_DIG_VOL 500000
> > > static int msm_hsusb_config_vddcx(int high)
> > > {
> > > @@ -609,7 +607,6 @@ skip_phy_resume:
> > >
> > > return 0;
> > > }
> > > -#endif
> > >
> > > static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
> > > {
> > > @@ -1664,7 +1661,6 @@ static int msm_otg_remove(struct platform_device *pdev)
> > > return 0;
> > > }
> > >
> > > -#ifdef CONFIG_PM_RUNTIME
> > > static int msm_otg_runtime_idle(struct device *dev)
> > > {
> > > struct msm_otg *motg = dev_get_drvdata(dev);
> > > @@ -1699,9 +1695,7 @@ static int msm_otg_runtime_resume(struct device *dev)
> > > dev_dbg(dev, "OTG runtime resume\n");
> > > return msm_otg_resume(motg);
> > > }
> > > -#endif
> > >
> > > -#ifdef CONFIG_PM_SLEEP
> > > static int msm_otg_pm_suspend(struct device *dev)
> > > {
> > > struct msm_otg *motg = dev_get_drvdata(dev);
> > > @@ -1731,12 +1725,11 @@ static int msm_otg_pm_resume(struct device *dev)
> > >
> > > return 0;
> > > }
> > > -#endif
> > >
> > > static const struct dev_pm_ops msm_otg_dev_pm_ops = {
> > > - SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume)
> > > - SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume,
> > > - msm_otg_runtime_idle)
> > > + ASSIGN_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume)
> > > + ASSIGN_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume,
> > > + msm_otg_runtime_idle)
> >
> > if the patch introducing assign_if() gets accepted, I'm ok with this
> > patch.
>
> I can't take that patch at this point in time, it's just too ugly...
>
> As are those crazy SET_SYSTEM_SLEEP_PM_OPS() macros, ick, who made those
> things?
>
> What language are we trying to program in here people?
Since we're discussing this topic here, I'd like point my RFC which gets
rid of same ifdeffery in a different way:
http://lkml.org/lkml/2013/12/13/4
Comments are welcome.
Br, David
>
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-02-27 23:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-24 17:08 [PATCH 0/3] introduce assign_if() macros in attempt to reduce ifdeffery Josh Cartwright
2014-02-24 17:08 ` [PATCH 1/3] typecheck: introduce assign_if() and assign_if_enabled() Josh Cartwright
2014-02-27 19:00 ` Greg Kroah-Hartman
2014-02-27 23:48 ` Josh Cartwright
2014-02-24 17:08 ` [PATCH 2/3] PM: define new ASSIGN_*_PM_OPS macros based on assign_if Josh Cartwright
2014-02-27 19:02 ` Greg Kroah-Hartman
2014-03-01 11:06 ` Pavel Machek
2014-03-01 16:02 ` Greg Kroah-Hartman
2014-03-01 16:26 ` Pavel Machek
2014-02-24 17:08 ` [PATCH 3/3] usb: phy: msm: use ASSIGN_*_PM_OPS variants Josh Cartwright
[not found] ` <1393261707-30565-4-git-send-email-joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-02-25 18:33 ` Felipe Balbi
2014-02-27 19:03 ` Greg Kroah-Hartman
2014-02-27 23:41 ` David Cohen [this message]
2014-02-27 23:44 ` Greg Kroah-Hartman
[not found] ` <20140227234425.GA32426-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-02-27 23:52 ` David Cohen
2014-02-28 8:48 ` Ulf Hansson
2014-02-28 16:52 ` Greg Kroah-Hartman
2014-03-01 11:24 ` Ulf Hansson
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=20140227234129.GA21032@psi-dev26.jf.intel.com \
--to=david.a.cohen@linux.intel.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=joshc@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.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).