linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning
@ 2021-09-06 19:49 Palmer Dabbelt
  2021-09-07  7:02 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2021-09-06 19:49 UTC (permalink / raw)
  To: hjc, heiko
  Cc: airlied, daniel, dri-devel, linux-arm-kernel, linux-rockchip,
	linux-kernel, kernel-team, Palmer Dabbelt

From: Palmer Dabbelt <palmerdabbelt@google.com>

cdn_dp_resume is only used under PM_SLEEP, and now that it's static an
unused function warning is triggered undner !PM_SLEEP.  This
conditionally enables the function to avoid the warning.

Fixes: 7c49abb4c2f8 ("drm/rockchip: cdn-dp-core: Make cdn_dp_core_suspend/resume static")
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
---
I sent this one out in January, but it looks like it got lost in the shuffle.
I'm getting this on a RISC-V allmodconfig now.
---
 drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 8ab3247dbc4a..bee0f2d2a9be 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1123,6 +1123,7 @@ static int cdn_dp_suspend(struct device *dev)
 	return ret;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int cdn_dp_resume(struct device *dev)
 {
 	struct cdn_dp_device *dp = dev_get_drvdata(dev);
@@ -1135,6 +1136,7 @@ static int cdn_dp_resume(struct device *dev)
 
 	return 0;
 }
+#endif
 
 static int cdn_dp_probe(struct platform_device *pdev)
 {
-- 
2.33.0.153.gba50c8fa24-goog


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

* Re: [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning
  2021-09-06 19:49 [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning Palmer Dabbelt
@ 2021-09-07  7:02 ` Geert Uytterhoeven
  2021-09-07  8:17   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-09-07  7:02 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Sandy Huang, Heiko Stuebner, David Airlie, Daniel Vetter,
	DRI Development, Linux ARM, open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List, Android Kernel Team, Palmer Dabbelt,
	Arnd Bergmann

On Mon, Sep 6, 2021 at 9:58 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
> From: Palmer Dabbelt <palmerdabbelt@google.com>
>
> cdn_dp_resume is only used under PM_SLEEP, and now that it's static an
> unused function warning is triggered undner !PM_SLEEP.  This
> conditionally enables the function to avoid the warning.
>
> Fixes: 7c49abb4c2f8 ("drm/rockchip: cdn-dp-core: Make cdn_dp_core_suspend/resume static")
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> ---
> I sent this one out in January, but it looks like it got lost in the shuffle.
> I'm getting this on a RISC-V allmodconfig now.
> ---
>  drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index 8ab3247dbc4a..bee0f2d2a9be 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> @@ -1123,6 +1123,7 @@ static int cdn_dp_suspend(struct device *dev)
>         return ret;
>  }
>
> +#ifdef CONFIG_PM_SLEEP
>  static int cdn_dp_resume(struct device *dev)

An alternative solution would be to tag the function with
__maybe_unused.

>  {
>         struct cdn_dp_device *dp = dev_get_drvdata(dev);
> @@ -1135,6 +1136,7 @@ static int cdn_dp_resume(struct device *dev)
>
>         return 0;
>  }
> +#endif
>
>  static int cdn_dp_probe(struct platform_device *pdev)
>  {

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning
  2021-09-07  7:02 ` Geert Uytterhoeven
@ 2021-09-07  8:17   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-09-07  8:17 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Palmer Dabbelt, Sandy Huang, Heiko Stuebner, David Airlie,
	Daniel Vetter, DRI Development, Linux ARM,
	open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List, Android Kernel Team, Palmer Dabbelt,
	Arnd Bergmann

On Tue, Sep 7, 2021 at 9:02 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Mon, Sep 6, 2021 at 9:58 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
> > From: Palmer Dabbelt <palmerdabbelt@google.com>

> >
> > +#ifdef CONFIG_PM_SLEEP
> >  static int cdn_dp_resume(struct device *dev)
>
> An alternative solution would be to tag the function with
> __maybe_unused.

Right. In this case, both are correct, but generally speaking I tend to use the
__maybe_unused variant because it's more reliable at fixing the warning for
good when there are additional functions called by the suspend/resume
helpers that now become unused in some configurations, or when you pick
the wrong set of #ifdefs.

Having fewer #ifdef checks also helps with build coverage testing when there
is a warning inside of an #ifdef.

       Arnd

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

end of thread, other threads:[~2021-09-07  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 19:49 [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning Palmer Dabbelt
2021-09-07  7:02 ` Geert Uytterhoeven
2021-09-07  8:17   ` Arnd Bergmann

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).