Thread (31 messages) read the whole thread 31 messages, 13 authors, 2016-03-11
STALE3797d

[PATCH 13/14] [media] omap3isp: use IS_ENABLED() to hide pm functions

From: arnd@arndb.de (Arnd Bergmann)
Date: 2016-03-02 16:04:30
Also in: linux-media, lkml
Subsystem: media input infrastructure (v4l/dvb), the rest · Maintainers: Mauro Carvalho Chehab, Linus Torvalds

The omap3isp driver hides is power management functions using #ifdef
but it fails to hide the isp_suspend_modules/isp_resume_modules
functions in the same way, which leads to a build warning when
CONFIG_PM is disabled:

drivers/media/platform/omap3isp/isp.c:1183:12: error: 'isp_suspend_modules' defined but not used [-Werror=unused-function]
drivers/media/platform/omap3isp/isp.c:1217:13: error: 'isp_resume_modules' defined but not used [-Werror=unused-function]

As the driver manually defines its dev_pm_ops structure and all
members are NULL without CONFIG_PM, we can simply avoid referencing
the structure using an IS_ENABLED() check, and drop all the #ifdef
to avoid all warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/platform/omap3isp/isp.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index f9e5245f26ac..7f118baca270 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1713,8 +1713,6 @@ void omap3isp_print_status(struct isp_device *isp)
 	dev_dbg(isp->dev, "--------------------------------------------\n");
 }
 
-#ifdef CONFIG_PM
-
 /*
  * Power management support.
  *
@@ -1785,15 +1783,6 @@ static void isp_pm_complete(struct device *dev)
 	isp_resume_modules(isp);
 }
 
-#else
-
-#define isp_pm_prepare	NULL
-#define isp_pm_suspend	NULL
-#define isp_pm_resume	NULL
-#define isp_pm_complete	NULL
-
-#endif /* CONFIG_PM */
-
 static void isp_unregister_entities(struct isp_device *isp)
 {
 	omap3isp_csi2_unregister_entities(&isp->isp_csi2a);
@@ -2611,7 +2600,7 @@ static struct platform_driver omap3isp_driver = {
 	.id_table = omap3isp_id_table,
 	.driver = {
 		.name = "omap3isp",
-		.pm	= &omap3isp_pm_ops,
+		.pm	= IS_ENABLED(CONFIG_PM) ? &omap3isp_pm_ops : NULL,
 		.of_match_table = omap3isp_of_table,
 	},
 };
-- 
2.7.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help