linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Wenbin Mei <wenbin.mei@mediatek.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Chun-Hung Wu <chun-hung.wu@mediatek.com>,
	yong mao <yong.mao@mediatek.com>,
	Amey Narkhede <ameynarkhede03@gmail.com>,
	Marek Vasut <marex@denx.de>,
	linux-mmc@vger.kernel.org,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	ARM/Mediatek SoC support <linux-mediatek@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH] mmc: mediatek: mark PM functions as __maybe_unused
Date: Mon, 07 Dec 2020 12:33:18 +0000	[thread overview]
Message-ID: <IVYYKQ.T5GFS8Z1QTP2@crapouillou.net> (raw)
In-Reply-To: <CAK8P3a3srmTdY69j+g-wazMkrTL8_Grsw=vCMyizyA_7oOC4tg@mail.gmail.com>

Hi Arnd,

Le ven. 4 déc. 2020 à 15:14, Arnd Bergmann <arnd@kernel.org> a écrit 
:
> On Fri, Dec 4, 2020 at 11:02 AM Ulf Hansson <ulf.hansson@linaro.org> 
> wrote:
>>  On Thu, 3 Dec 2020 at 23:29, Arnd Bergmann <arnd@kernel.org> wrote:
> 
>>  > -#ifdef CONFIG_PM
>>  >  static void msdc_save_reg(struct msdc_host *host)
>> 
>>  Shouldn't msdc_save|restore_reg() be turned into "__maybe_unused" 
>> as well?
> 
> There is no need since the compiler can figure that out already when 
> there
> is a reference to the function from dead code.
> 
>>  >
>>  > -static int msdc_resume(struct device *dev)
>>  > +static int __maybe_unused msdc_resume(struct device *dev)
>>  >  {
>>  >         return pm_runtime_force_resume(dev);
>>  >  }
>>  > -#endif
>>  >
>>  >  static const struct dev_pm_ops msdc_dev_pm_ops = {
>> 
>>  You may also change this to a __maybe_unused, as long as you also
>>  assign the .pm pointer in the mt_msdc_driver with
>>  pm_ptr(&msdc_dev_pm_ops).
>> 
>>  Ideally the compiler should drop these functions/datas entirely 
>> then.
> 
> I don't see a lot of other instances of that yet, and it's fairly new.
> Maybe we should fix it before it gets propagated further.
> 
> I would suggest we redefine pm_ptr like
> 
> #define pm_ptr(_ptr) (IS_ENABLED(CONFIG_PM) ? (_ptr) : NULL)

By the way, as I'm ending up doing the same in a different context, I 
think it would be useful to have a IF_ENABLED() macro defined like this:

#define IF_ENABLED(_cfg, _ptr) (IS_ENABLED(_cfg) ? (_ptr) : NULL)

Then the pm_ptr(_ptr) macro could be defined like this:

#define pm_ptr(_ptr) IF_ENABLED(CONFIG_PM, _ptr)

Cheers,
-Paul

> and remove the __maybe_unused annotations on those that we
> already have. This also has the effect of dropping the unused
> data from the object, but without having to an an #ifdef or
> __maybe_unused.
> 
> Adding Paul and Rafael to Cc for clarification on this.
> 
>        Arnd



  parent reply	other threads:[~2020-12-07 12:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 22:29 [PATCH] mmc: mediatek: mark PM functions as __maybe_unused Arnd Bergmann
2020-12-04 10:02 ` Ulf Hansson
2020-12-04 14:14   ` Arnd Bergmann
2020-12-04 14:38     ` Ulf Hansson
2020-12-04 14:55       ` Arnd Bergmann
2020-12-04 18:04     ` Paul Cercueil
2020-12-07 12:33     ` Paul Cercueil [this message]
2020-12-08 14:04       ` Arnd Bergmann
2020-12-08 15:38         ` Paul Cercueil

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=IVYYKQ.T5GFS8Z1QTP2@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=ameynarkhede03@gmail.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=chaotian.jing@mediatek.com \
    --cc=chun-hung.wu@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wenbin.mei@mediatek.com \
    --cc=yong.mao@mediatek.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;
as well as URLs for NNTP newsgroup(s).