Skip to contentSkip to conversation

s5p-fimc: Only build suspend/resume for PM

PATCH Superseded Thierry Reding 2 participants 3 messages Oct 2, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s5p-fimc: Only build suspend/resume for PM

From: Thierry Reding <[email protected]>

If power management is disabled these functions become unused, so there is no reason to build them. This fixes a couple of build warnings when PM(_SLEEP,_RUNTIME) is not enabled.

---
 drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/exynos4-is/fimc-core.c +2 -0
index b70fd996d794..8e7435bfa1f9 100644
@@ -832,6 +832,7 @@ err:
 	return -ENXIO;
 }
 
+#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
 static int fimc_m2m_suspend(struct fimc_dev *fimc)
 {
 	unsigned long flags;
@@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc)
 
 	return 0;
 }
+#endif
 
 static const struct of_device_id fimc_of_match[];
 
Signature · 1 line
2.1.0
#1 lore raw

Em Thu, 02 Oct 2014 10:48:11 +0200
Thierry Reding <[email protected]> escreveu:

Quoted 24 lines

From: Thierry Reding <[email protected]>

If power management is disabled these functions become unused, so there is no reason to build them. This fixes a couple of build warnings when PM(_SLEEP,_RUNTIME) is not enabled.

---
 drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/exynos4-is/fimc-core.c +1 -0
index b70fd996d794..8e7435bfa1f9 100644
@@ -832,6 +832,7 @@ err:
 	return -ENXIO;
 }
 
+#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
 static int fimc_m2m_suspend(struct fimc_dev *fimc)
 {
 	unsigned long flags;

drivers/media/platform/exynos4-is/fimc-core.c static int fimc_m2m_resume(struct fimc_dev *fimc) · line 874

Quoted 4 lines
drivers/media/platform/exynos4-is/fimc-core.c +1 -0
@@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc)
 
 	return 0;
 }
+#endif

The patch obviously is correct, but I'm wandering if aren't there a way to avoid the if/endif.

Not tested here, but perhaps if we mark those functions as inline, the C compiler would do the right thing without generating any warnings.

If not, maybe we could use some macro like:

#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
	#define PM_SLEEP_FUNC
#else
	#define PM_SLEEP_FUNC	inline

#endif

And put it at pm.h.

That should be enough to shut up to warning without adding any footprint if PM is disabled.

Regards,
Mauro

#2 lore raw
Quoted 44 lines · Mauro Carvalho Chehab

Em Thu, 02 Oct 2014 10:48:11 +0200
Thierry Reding <[email protected]> escreveu:

Quoted 24 lines

From: Thierry Reding <[email protected]>

If power management is disabled these functions become unused, so there is no reason to build them. This fixes a couple of build warnings when PM(_SLEEP,_RUNTIME) is not enabled.

---
 drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/exynos4-is/fimc-core.c +1 -0
index b70fd996d794..8e7435bfa1f9 100644
@@ -832,6 +832,7 @@ err:
 	return -ENXIO;
 }
 
+#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
 static int fimc_m2m_suspend(struct fimc_dev *fimc)
 {
 	unsigned long flags;

drivers/media/platform/exynos4-is/fimc-core.c static int fimc_m2m_resume(struct fimc_dev *fimc) · line 874

Quoted 4 lines
drivers/media/platform/exynos4-is/fimc-core.c +1 -0
@@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc)
 
 	return 0;
 }
+#endif

The patch obviously is correct, but I'm wandering if aren't there a way to avoid the if/endif.

Not tested here, but perhaps if we mark those functions as inline, the C compiler would do the right thing without generating any warnings.

If not, maybe we could use some macro like:

#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
	#define PM_SLEEP_FUNC
#else
	#define PM_SLEEP_FUNC	inline
Quoted 6 lines

#endif

And put it at pm.h.

That should be enough to shut up to warning without adding any footprint if PM is disabled.

I think you could use __maybe_unused to that effect, but it has the disadvantage of hiding such messages forever. For instance if the suspend/resume code was ever to be removed, then you wouldn't get a warning at all.

And there's a corresponding #ifdef for the fimc_runtime_{suspend,resume} and fimc_{suspend,resume} already anyway, so I don't see much point in trying to avoid this particular #ifdef.

Thierry