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: <445b8b63b75234730a277d091ae02d31c63ed2f0.camel@crapouillou.net>
Date:   Sat, 08 Jul 2023 10:46:20 +0200
From:   Paul Cercueil <paul@...pouillou.net>
To:     Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc:     Wolfram Sang <wsa@...nel.org>, linux-i2c@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/23] i2c: img-scb: Remove #ifdef guards for PM related
 functions

Hi Jonathan,

Le jeudi 06 juillet 2023 à 10:31 +0800, Jonathan Cameron a écrit :
> On Wed,  5 Jul 2023 22:43:01 +0200
> Paul Cercueil <paul@...pouillou.net> wrote:
> 
> > Use the new PM macros for the suspend and resume functions to be
> > automatically dropped by the compiler when CONFIG_PM or
> > CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.
> > 
> > This has the advantage of always compiling these functions in,
> > independently of any Kconfig option. Thanks to that, bugs and other
> > regressions are subsequently easier to catch.
> > 
> > Signed-off-by: Paul Cercueil <paul@...pouillou.net>
> I thought the _DEFINE macros weren't really intended for driver
> usage and it's good to keep the ability to change those details
> without updating lots of drivers.  Perhaps just express it long hand
> here?

Yeah you are right. The "long version" isn't much longer anyway.

Cheers,
-Paul

> Jonathan
> 
> 
> > ---
> >  drivers/i2c/busses/i2c-img-scb.c | 13 ++++---------
> >  1 file changed, 4 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-img-scb.c
> > b/drivers/i2c/busses/i2c-img-scb.c
> > index 4b674cfbc6fb..a92e3082542e 100644
> > --- a/drivers/i2c/busses/i2c-img-scb.c
> > +++ b/drivers/i2c/busses/i2c-img-scb.c
> > @@ -1454,7 +1454,6 @@ static int img_i2c_runtime_resume(struct
> > device *dev)
> >         return 0;
> >  }
> >  
> > -#ifdef CONFIG_PM_SLEEP
> >  static int img_i2c_suspend(struct device *dev)
> >  {
> >         struct img_i2c *i2c = dev_get_drvdata(dev);
> > @@ -1482,14 +1481,10 @@ static int img_i2c_resume(struct device
> > *dev)
> >  
> >         return 0;
> >  }
> > -#endif /* CONFIG_PM_SLEEP */
> >  
> > -static const struct dev_pm_ops img_i2c_pm = {
> > -       SET_RUNTIME_PM_OPS(img_i2c_runtime_suspend,
> > -                          img_i2c_runtime_resume,
> > -                          NULL)
> > -       SET_SYSTEM_SLEEP_PM_OPS(img_i2c_suspend, img_i2c_resume)
> > -};
> > +static _DEFINE_DEV_PM_OPS(img_i2c_pm, img_i2c_suspend,
> > img_i2c_resume,
> > +                         img_i2c_runtime_suspend,
> > img_i2c_runtime_resume,
> > +                         NULL);
> >  
> >  static const struct of_device_id img_scb_i2c_match[] = {
> >         { .compatible = "img,scb-i2c" },
> > @@ -1501,7 +1496,7 @@ static struct platform_driver
> > img_scb_i2c_driver = {
> >         .driver = {
> >                 .name           = "img-i2c-scb",
> >                 .of_match_table = img_scb_i2c_match,
> > -               .pm             = &img_i2c_pm,
> > +               .pm             = pm_ptr(&img_i2c_pm),
> >         },
> >         .probe = img_i2c_probe,
> >         .remove_new = img_i2c_remove,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ