public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: cs42l43: fix defined but not used warnings
@ 2023-09-05  2:12 zhangshida
  2023-09-20  9:52 ` Lee Jones
  0 siblings, 1 reply; 8+ messages in thread
From: zhangshida @ 2023-09-05  2:12 UTC (permalink / raw)
  To: lee; +Cc: linux-kernel, zhangshida, starzhangzsd, k2ci

From: Shida Zhang <zhangshida@kylinos.cn>

Warnings were generated during compiling for functions like
cs42l43_*_{resume,suspend}:

../drivers/mfd/cs42l43.c:1138:12: error: ‘cs42l43_runtime_resume’ defined but not used [-Werror=unused-function]
 1138 | static int cs42l43_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~
../drivers/mfd/cs42l43.c:1124:12: error: ‘cs42l43_runtime_suspend’ defined but not used [-Werror=unused-function]
 1124 | static int cs42l43_runtime_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~
../drivers/mfd/cs42l43.c:1106:12: error: ‘cs42l43_resume’ defined but not used [-Werror=unused-function]
 1106 | static int cs42l43_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~
../drivers/mfd/cs42l43.c:1076:12: error: ‘cs42l43_suspend’ defined but not used [-Werror=unused-function]
 1076 | static int cs42l43_suspend(struct device *dev)

Fix it by guarding it with CONFIG_PM/CONFIG_PM_SLEEP.

Reported-by: k2ci <kernel-bot@kylinos.cn>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 drivers/mfd/cs42l43.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
index 37b23e9bae82..e589a61c118d 100644
--- a/drivers/mfd/cs42l43.c
+++ b/drivers/mfd/cs42l43.c
@@ -1073,6 +1073,7 @@ void cs42l43_dev_remove(struct cs42l43 *cs42l43)
 }
 EXPORT_SYMBOL_NS_GPL(cs42l43_dev_remove, MFD_CS42L43);
 
+#ifdef CONFIG_PM_SLEEP
 static int cs42l43_suspend(struct device *dev)
 {
 	struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
@@ -1120,7 +1121,9 @@ static int cs42l43_resume(struct device *dev)
 
 	return 0;
 }
+#endif
 
+#ifdef CONFIG_PM
 static int cs42l43_runtime_suspend(struct device *dev)
 {
 	struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
@@ -1176,6 +1179,7 @@ static int cs42l43_runtime_resume(struct device *dev)
 
 	return ret;
 }
+#endif
 
 EXPORT_NS_GPL_DEV_PM_OPS(cs42l43_pm_ops, MFD_CS42L43) = {
 	SET_SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-25  8:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05  2:12 [PATCH] mfd: cs42l43: fix defined but not used warnings zhangshida
2023-09-20  9:52 ` Lee Jones
2023-09-21  2:46   ` Stephen Zhang
2023-09-21 10:37     ` Lee Jones
2023-09-22  2:01       ` Stephen Zhang
2023-09-22  7:26   ` Geert Uytterhoeven
2023-09-25  7:56     ` Lee Jones
2023-09-25  8:31       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox