Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

From: Paul Cercueil
Date: Mon Aug 08 2022 - 06:14:31 EST



[...]

---
drivers/mfd/sec-core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 1fb29c45f5cf..a467de2b2fea 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -455,7 +455,6 @@ static void sec_pmic_shutdown(struct i2c_client
*i2c)
regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0);
}

-#ifdef CONFIG_PM_SLEEP
static int sec_pmic_suspend(struct device *dev)

Did you test W=1 with !CONFIG_PM_SLEEP? No warnings?

I tested the PR with !CONFIG_PM_SLEEP, correct. sec-core.o compiles
fine. No warnings with W=1.

Ah, I see now. _DEFINE_DEV_PM_OPS uses __maybe_unused for such case.

Actually it doesn't :) Since the (dev_pm_ops) structure is always (and should always be) referenced through pm_sleep_ptr() or pm_ptr(), the symbols are never seen as unused by the compiler, but are automatically dropped by the compiler when the related config option is turned off.

Cheers,
-Paul