Re: [PATCH] mmc: mediatek: mark PM functions as __maybe_unused

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Le ven. 4 déc. 2020 à 15:14, Arnd Bergmann <arnd@xxxxxxxxxx> a écrit :
On Fri, Dec 4, 2020 at 11:02 AM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
 On Thu, 3 Dec 2020 at 23:29, Arnd Bergmann <arnd@xxxxxxxxxx> 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)

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.

I didn't think about that. That's smarter and much more elegant.

Cheers,
-Paul





[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux