LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, Deepak Saxena <dsaxena@plexity.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
Date: Wed, 11 Mar 2015 08:44:07 -0700	[thread overview]
Message-ID: <20150311154407.GA37516@dtor-ws> (raw)
In-Reply-To: <20150311105957.GA5351@gondor.apana.org.au>

Hi Herbert,

On Wed, Mar 11, 2015 at 09:59:57PM +1100, Herbert Xu wrote:
> On Mon, Mar 09, 2015 at 10:36:36AM -0700, Dmitry Torokhov wrote:
> > Instead of using #ifdefs let's mark suspend and resume methods as
> > __maybe_unused which will suppress compiler warnings about them being
> > unused and provide better compile coverage. This will not increase image
> > size.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/char/hw_random/omap-rng.c | 15 +++------------
> >  1 file changed, 3 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> > index 7f3597d..5c171b1 100644
> > --- a/drivers/char/hw_random/omap-rng.c
> > +++ b/drivers/char/hw_random/omap-rng.c
> > @@ -422,9 +422,7 @@ static int omap_rng_remove(struct platform_device *pdev)
> >  	return 0;
> >  }
> >  
> > -#ifdef CONFIG_PM_SLEEP
> > -
> > -static int omap_rng_suspend(struct device *dev)
> > +static int __maybe_unused omap_rng_suspend(struct device *dev)
> >  {
> >  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
> >  
> > @@ -434,7 +432,7 @@ static int omap_rng_suspend(struct device *dev)
> >  	return 0;
> >  }
> >  
> > -static int omap_rng_resume(struct device *dev)
> > +static int __maybe_unused omap_rng_resume(struct device *dev)
> >  {
> >  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
> >  
> > @@ -445,18 +443,11 @@ static int omap_rng_resume(struct device *dev)
> >  }
> >  
> >  static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume);
> > -#define	OMAP_RNG_PM	(&omap_rng_pm)
> > -
> > -#else
> > -
> > -#define	OMAP_RNG_PM	NULL
> > -
> > -#endif
> >  
> >  static struct platform_driver omap_rng_driver = {
> >  	.driver = {
> >  		.name		= "omap_rng",
> > -		.pm		= OMAP_RNG_PM,
> > +		.pm		= &omap_rng_pm,
> 
> This will cause omap_rng_suspend/omap_rng_resume to be referenced
> always, thus rendering the __maybe_unused moot, no?

SIMPLE_DEV_PM_OPS() produces an empty omap_rng_pm structure in case of
!CONFIG_PM_SLEEP so neither omap_rng_suspend nor omap_rng_resume will
end up being referenced.

Thanks.

-- 
Dmitry

  reply	other threads:[~2015-03-11 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
2015-03-11 10:59   ` Herbert Xu
2015-03-11 15:44     ` Dmitry Torokhov [this message]
2015-03-11 21:00       ` Herbert Xu
2015-03-11 21:08         ` Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 3/4] hwrng: octeon - remove incorrect __exit markups Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 4/4] hwrng: pseries-rng - remove incorrect __init/__exit markups Dmitry Torokhov
2015-03-11 14:13 ` [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Herbert Xu

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=20150311154407.GA37516@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=dsaxena@plexity.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods' \
    /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

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).