drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning
Subsystems (4)
PATCH RESEND 1/1 drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning
From: Palmer Dabbelt <[email protected]>
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.
---
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(+)
drivers/gpu/drm/rockchip/cdn-dp-core.c +2 -0
@@ -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) {
Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Quoted 8 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
cdn_dp_resumeis only used underPM_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 <[email protected]>
Quoted 12 lines
---
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(+)drivers/gpu/drm/rockchip/cdn-dp-core.c +0
-0
drivers/gpu/drm/rockchip/cdn-dp-core.c static int cdn_dp_suspend(struct device *dev) · line 1127
Quoted 5 lines
drivers/gpu/drm/rockchip/cdn-dp-core.c +1
-0@@ -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.
drivers/gpu/drm/rockchip/cdn-dp-core.c static int cdn_dp_resume(struct device *dev) · line 1142
Quoted 10 lines
drivers/gpu/drm/rockchip/cdn-dp-core.c +1
-0{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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Quoted 9 lines · Geert Uytterhoeven
Quoted 5 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
+#ifdef
CONFIG_PM_SLEEP
static intcdn_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