lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 4 Dec 2020 15:38:49 +0100
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Chaotian Jing <chaotian.jing@...iatek.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Wenbin Mei <wenbin.mei@...iatek.com>,
        Arnd Bergmann <arnd@...db.de>,
        Chun-Hung Wu <chun-hung.wu@...iatek.com>,
        yong mao <yong.mao@...iatek.com>,
        Amey Narkhede <ameynarkhede03@...il.com>,
        Marek Vasut <marex@...x.de>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Paul Cercueil <paul@...pouillou.net>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH] mmc: mediatek: mark PM functions as __maybe_unused

On Fri, 4 Dec 2020 at 15:14, Arnd Bergmann <arnd@...nel.org> wrote:
>
> On Fri, Dec 4, 2020 at 11:02 AM Ulf Hansson <ulf.hansson@...aro.org> wrote:
> > On Thu, 3 Dec 2020 at 23:29, Arnd Bergmann <arnd@...nel.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.

Alright, thanks for clarifying.

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

Why is this better than the original definition?

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

I didn't quite get this (sorry it's Friday afternoon... getting
tired), can you perhaps give a concrete example?

That said, I have applied your patch for fixes, but let's try to sort
out the above to make sure we are all on the same page.

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ