diff mbox series

[11/23] i2c: kempld: Remove #ifdef guards for PM related functions

Message ID 20230705204314.89800-12-paul@crapouillou.net
State New
Headers show
Series i2c: Use new PM macros | expand

Commit Message

Paul Cercueil July 5, 2023, 8:43 p.m. UTC
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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/i2c/busses/i2c-kempld.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox series

Patch

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