Hi Jonathan, Le jeudi 06 juillet 2023 à 10:37 +0800, Jonathan Cameron a écrit : > On Wed, 5 Jul 2023 22:43:02 +0200 > Paul Cercueil <paul@xxxxxxxxxxxxxxx> 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. > > > > Note that the driver should most likely be updated to use the > > platform_driver.driver.pm.{suspend,resume} callbacks. > > Agreed. In this particular case I'd be tempted to do that first > so that we don't introduce pm_ptr() usage for these hooks. > Look at the platform device core, I suspect they should be > pm_sleep_ptr() > but not 100% sure. Ok, I'll just convert it then, the diff won't be much bigger. Cheers, -Paul > Jonathan > > > > > Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx> > > --- > > drivers/i2c/busses/i2c-kempld.c | 9 ++------- > > 1 file changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-kempld.c > > b/drivers/i2c/busses/i2c-kempld.c > > index 281058e3ea46..cb61e7b9202c 100644 > > --- a/drivers/i2c/busses/i2c-kempld.c > > +++ b/drivers/i2c/busses/i2c-kempld.c > > @@ -350,7 +350,6 @@ static void kempld_i2c_remove(struct > > platform_device *pdev) > > i2c_del_adapter(&i2c->adap); > > } > > > > -#ifdef CONFIG_PM > > static int kempld_i2c_suspend(struct platform_device *pdev, > > pm_message_t state) > > { > > struct kempld_i2c_data *i2c = platform_get_drvdata(pdev); > > @@ -377,10 +376,6 @@ static int kempld_i2c_resume(struct > > platform_device *pdev) > > > > return 0; > > } > > -#else > > -#define kempld_i2c_suspend NULL > > -#define kempld_i2c_resume NULL > > -#endif > > > > static struct platform_driver kempld_i2c_driver = { > > .driver = { > > @@ -388,8 +383,8 @@ static struct platform_driver kempld_i2c_driver > > = { > > }, > > .probe = kempld_i2c_probe, > > .remove_new = kempld_i2c_remove, > > - .suspend = kempld_i2c_suspend, > > - .resume = kempld_i2c_resume, > > + .suspend = pm_ptr(kempld_i2c_suspend), > > + .resume = pm_ptr(kempld_i2c_resume), > > }; > > > > module_platform_driver(kempld_i2c_driver); >