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]
Message-ID: <20220306162443.00006a0d@Huawei.com>
Date:   Sun, 6 Mar 2022 16:24:43 +0000
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Paul Cercueil <paul@...pouillou.net>
CC:     Arnd Bergmann <arnd@...db.de>,
        Randy Dunlap <rdunlap@...radead.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        Wei WANG <wei_wang@...lsil.com.cn>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH -next] misc: rtsx: fix build for CONFIG_PM not set

On Sun, 6 Mar 2022 15:12:12 +0000
Jonathan Cameron <Jonathan.Cameron@...wei.com> wrote:

> On Sun, 27 Feb 2022 17:56:31 +0000
> Paul Cercueil <paul@...pouillou.net> wrote:
> 
> > Le dim., févr. 27 2022 at 18:51:38 +0100, Arnd Bergmann 
> > <arnd@...db.de> a écrit :  
> > > On Sun, Feb 27, 2022 at 6:46 PM Paul Cercueil <paul@...pouillou.net> 
> > > wrote:    
> > >>  Le dim., févr. 27 2022 at 18:30:16 +0100, Arnd Bergmann
> > >> 
> > >>  There could be a DEFINE_DEV_PM_OPS(), but I don't think that's 
> > >> really
> > >>  needed - you can very well declare your struct dev_pm_ops without 
> > >> using
> > >>  one of these macros. Just make sure to use the SYSTEM_SLEEP_PM_OPS /
> > >>  RUNTIME_PM_OPS macros for the callbacks and pm_ptr() for the 
> > >> device.pm
> > >>  pointer.    
> > > 
> > > Ah, of course, so it comes down to
> > > s/SET_SYSTEM_SLEEP_PM_OPS/SYSTEM_SLEEP_PM_OPS/ while
> > > removing all the #ifdef an __maybe_unused annotations. The pm_ptr()
> > > in driver.pm makes this slightly more optimized AFAICT, but has no
> > > effect on behavior, right?    
> > 
> > The use of SYSTEM_SLEEP_PM_OPS makes sure that the callbacks are 
> > dropped if the dev_pm_ops is dead code, and the pm_ptr() must be used 
> > for the compiler to know that the dev_pm_ops is dead code.
> > 
> > -Paul
> > 
> >   
> 
> Hi Paul,
> 
> We have one remaining case which is still ugly to do.
> Where both SYSTEM_SLEEP_PM_OPS/RUNTIME_PM_OPS are set and
> the dev_pm_ops structure is exported.
> 
> For that one we still need to expose #ifdef fun in the
> drivers I think.
> 
> Any suggestions on a clean solution for that?
> 
> Currently I have this...
> 
> #ifdef CONFIG_PM
> const struct dev_pm_ops bmc150_magn_pm_ops = {
> 	SYSTEM_SLEEP_PM_OPS(...)
> 	RUNTIME_PM_OPS(...)
> };
> EXPORT_SYMBOL_NS(bmc150_magn_pm_ops, IIO_BMC150_MAGN);
> #else
> static const __maybe_unused dev_pm_ops bmc150_magn_pm_ops = {
With this renamed to dummy_bmc150_magn_pm_ops to avoid
the previous declared warning I'll otherwise get. oops.
> 	SYSTEM_SLEEP_PM_OPS(...)
> 	RUNTIME_PM_OPS(...)
> };
> #endif
> Not super clean but perhaps we do need
> EXPORT_NS_DEV_PM_OPS
> EXPORT_NS_GPL_DEV_PM_OPS
> and potentially the non namespaced versions.
> 
> Thanks,
> 
> Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ