From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>,
Michael Turquette <mturquette@baylibre.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Antoine Tenart <antoine.tenart@bootlin.com>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Nadav Haklai <nadavh@marvell.com>,
linux-clk@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/2] clk: mvebu: armada-37xx-periph: add suspend/resume support
Date: Fri, 6 Jul 2018 18:03:41 +0200 [thread overview]
Message-ID: <20180706180341.02c5c203@xps13> (raw)
In-Reply-To: <153089271821.143105.13475046419256564594@swboyd.mtv.corp.google.com>
Hi Stephen,
Stephen Boyd <sboyd@kernel.org> wrote on Fri, 06 Jul 2018 08:58:38
-0700:
> Quoting Miquel Raynal (2018-06-26 02:09:18)
> > Hi Gregory,
> >=20
> > On Wed, 02 May 2018 18:18:37 +0200, Gregory CLEMENT
> > <gregory.clement@bootlin.com> wrote: =20
> > > On sam., avril 21 2018, Miquel Raynal <miquel.raynal@bootlin.com> wr=
ote: =20
> > > > =20
> > > > +#if defined(CONFIG_PM) =20
> > >=20
> > > I think you could get rid of this conditional code. Have a look on wh=
at
> > > is done in others drivers around DEV_PM_OPS and __maybe_unused. =20
> >=20
> > Thanks for pointing it.
> >=20
> > Actually most implementations do not use __maybe_unused but do
> > something like:
> >=20
> > #if defined(CONFIG_PM)
> >=20
> > static int xxx_pm_suspend() { ... }
> >=20
> > static void xxx_pm_resume() { ... }
> >=20
> > static struct pm_ops ops;
> > #define XXX_DEV_PM_OPS &ops
> > #else
> > #define XXX_DEV_PM_OPS NULL
> > #endif /* CONFIG_PM */=20
> >=20
> > And then in the platform_driver structure:
> >=20
> > .pm =3D XXX_DEV_PM_OPS,
> >=20
> > This way, the only #if/#endif is "out" of the current code and the
> > ".pm =3D" line is free of preprocessor macros.
> > =20
>=20
> Yes, less preprocessor conditionals throughout the code is better for
> code readability and maintainability. Please remove the conditionals and
> use __maybe_unused instead. Sadly, we'll waste 48 bytes on the
> save/restore registers, but that's OK.
>=20
Mmmh. Looking at current code I thought the above was the preferred
way. Ok then, I'll repost with the conditionals removed and
__maybe_unused on the suspend/resume functions as initially suggested
by Gregory.
Thanks,
Miqu=C3=A8l
prev parent reply other threads:[~2018-07-06 16:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-21 14:23 [PATCH 1/2] clk: mvebu: armada-37xx-periph: save the IP base address in the driver data Miquel Raynal
2018-04-21 14:23 ` [PATCH 2/2] clk: mvebu: armada-37xx-periph: add suspend/resume support Miquel Raynal
2018-05-02 16:18 ` Gregory CLEMENT
2018-06-26 9:09 ` Miquel Raynal
2018-07-06 15:58 ` Stephen Boyd
2018-07-06 16:03 ` Miquel Raynal [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=20180706180341.02c5c203@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=antoine.tenart@bootlin.com \
--cc=gregory.clement@bootlin.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mturquette@baylibre.com \
--cc=nadavh@marvell.com \
--cc=sboyd@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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