linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] s5p-fimc: Only build suspend/resume for PM
@ 2014-10-02  8:48 Thierry Reding
  2014-10-02 13:43 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2014-10-02  8:48 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c
index b70fd996d794..8e7435bfa1f9 100644
--- a/drivers/media/platform/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/exynos4-is/fimc-core.c
@@ -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[];
 
-- 
2.1.0


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

* Re: [PATCH] [media] s5p-fimc: Only build suspend/resume for PM
  2014-10-02  8:48 [PATCH] [media] s5p-fimc: Only build suspend/resume for PM Thierry Reding
@ 2014-10-02 13:43 ` Mauro Carvalho Chehab
  2014-10-02 13:50   ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2014-10-02 13:43 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-media, linux-kernel

Em Thu, 02 Oct 2014 10:48:11 +0200
Thierry Reding <thierry.reding@gmail.com> escreveu:

> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c
> index b70fd996d794..8e7435bfa1f9 100644
> --- a/drivers/media/platform/exynos4-is/fimc-core.c
> +++ b/drivers/media/platform/exynos4-is/fimc-core.c
> @@ -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

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

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

* Re: [PATCH] [media] s5p-fimc: Only build suspend/resume for PM
  2014-10-02 13:43 ` Mauro Carvalho Chehab
@ 2014-10-02 13:50   ` Thierry Reding
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2014-10-02 13:50 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2209 bytes --]

On Thu, Oct 02, 2014 at 10:43:21AM -0300, Mauro Carvalho Chehab wrote:
> Em Thu, 02 Oct 2014 10:48:11 +0200
> Thierry Reding <thierry.reding@gmail.com> escreveu:
> 
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > 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.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c
> > index b70fd996d794..8e7435bfa1f9 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-core.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-core.c
> > @@ -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
> 
> 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.

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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-10-02 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02  8:48 [PATCH] [media] s5p-fimc: Only build suspend/resume for PM Thierry Reding
2014-10-02 13:43 ` Mauro Carvalho Chehab
2014-10-02 13:50   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).