* [PATCH] drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP
@ 2022-03-30 18:05 Nathan Chancellor
2022-04-11 0:53 ` Dmitry Baryshkov
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2022-03-30 18:05 UTC (permalink / raw)
To: Rob Clark, Sean Paul
Cc: linux-arm-msm, patches, dri-devel, Abhinav Kumar,
Nathan Chancellor, freedreno, linux-kernel
When building with CONFIG_PM=y and CONFIG_PM_SLEEP=n (such as ARCH=riscv
allmodconfig), the following warnings/errors occur:
drivers/gpu/drm/msm/adreno/adreno_device.c:679:12: error: 'adreno_system_resume' defined but not used [-Werror=unused-function]
679 | static int adreno_system_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/adreno/adreno_device.c:655:12: error: 'adreno_system_suspend' defined but not used [-Werror=unused-function]
655 | static int adreno_system_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
These functions are only used in SET_SYSTEM_SLEEP_PM_OPS(), which
evaluates to empty when CONFIG_PM_SLEEP is not set, making these
functions unused.
Traditionally, these functions are marked as __maybe_unused but in this
case, there is already an '#ifdef CONFIG_PM' in the code, so just do the
same thing with CONFIG_PM_SLEEP to resolve the warning.
Fixes: 7e4167c9e021 ("drm/msm/gpu: Park scheduler threads for system suspend")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 661dfa7681fb..b25915230bab 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -621,6 +621,7 @@ static int adreno_runtime_suspend(struct device *dev)
return gpu->funcs->pm_suspend(gpu);
}
+#ifdef CONFIG_PM_SLEEP
static void suspend_scheduler(struct msm_gpu *gpu)
{
int i;
@@ -681,8 +682,8 @@ static int adreno_system_resume(struct device *dev)
resume_scheduler(dev_to_gpu(dev));
return pm_runtime_force_resume(dev);
}
-
-#endif
+#endif /* CONFIG_PM_SLEEP */
+#endif /* CONFIG_PM */
static const struct dev_pm_ops adreno_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
base-commit: 05241de1f69eb7f56b0a5e0bec96a7752fad1b2f
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP
2022-03-30 18:05 [PATCH] drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP Nathan Chancellor
@ 2022-04-11 0:53 ` Dmitry Baryshkov
2022-04-11 18:15 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Baryshkov @ 2022-04-11 0:53 UTC (permalink / raw)
To: Nathan Chancellor, Rob Clark, Sean Paul
Cc: linux-arm-msm, patches, dri-devel, Abhinav Kumar, freedreno,
linux-kernel
On 30/03/2022 21:05, Nathan Chancellor wrote:
> When building with CONFIG_PM=y and CONFIG_PM_SLEEP=n (such as ARCH=riscv
> allmodconfig), the following warnings/errors occur:
>
> drivers/gpu/drm/msm/adreno/adreno_device.c:679:12: error: 'adreno_system_resume' defined but not used [-Werror=unused-function]
> 679 | static int adreno_system_resume(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/msm/adreno/adreno_device.c:655:12: error: 'adreno_system_suspend' defined but not used [-Werror=unused-function]
> 655 | static int adreno_system_suspend(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> These functions are only used in SET_SYSTEM_SLEEP_PM_OPS(), which
> evaluates to empty when CONFIG_PM_SLEEP is not set, making these
> functions unused.
>
> Traditionally, these functions are marked as __maybe_unused but in this
> case, there is already an '#ifdef CONFIG_PM' in the code, so just do the
> same thing with CONFIG_PM_SLEEP to resolve the warning.
>
> Fixes: 7e4167c9e021 ("drm/msm/gpu: Park scheduler threads for system suspend")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I'd suggest using __maybe_unused instead (and maybe even sending the
followup patch changing the #ifdef CONFIG_PM to __maybe_unused too):
If the code is included into the compilation, it means it's more widely
compile tested. Which tends to reveal obscure bugs, dependencies, etc.
> ---
> drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
> index 661dfa7681fb..b25915230bab 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_device.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
> @@ -621,6 +621,7 @@ static int adreno_runtime_suspend(struct device *dev)
> return gpu->funcs->pm_suspend(gpu);
> }
>
> +#ifdef CONFIG_PM_SLEEP
> static void suspend_scheduler(struct msm_gpu *gpu)
> {
> int i;
> @@ -681,8 +682,8 @@ static int adreno_system_resume(struct device *dev)
> resume_scheduler(dev_to_gpu(dev));
> return pm_runtime_force_resume(dev);
> }
> -
> -#endif
> +#endif /* CONFIG_PM_SLEEP */
> +#endif /* CONFIG_PM */
>
> static const struct dev_pm_ops adreno_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
>
> base-commit: 05241de1f69eb7f56b0a5e0bec96a7752fad1b2f
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP
2022-04-11 0:53 ` Dmitry Baryshkov
@ 2022-04-11 18:15 ` Nathan Chancellor
0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-04-11 18:15 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Sean Paul, linux-arm-msm, Abhinav Kumar, dri-devel, linux-kernel,
patches, freedreno
On Mon, Apr 11, 2022 at 03:53:01AM +0300, Dmitry Baryshkov wrote:
> On 30/03/2022 21:05, Nathan Chancellor wrote:
> > When building with CONFIG_PM=y and CONFIG_PM_SLEEP=n (such as ARCH=riscv
> > allmodconfig), the following warnings/errors occur:
> >
> > drivers/gpu/drm/msm/adreno/adreno_device.c:679:12: error: 'adreno_system_resume' defined but not used [-Werror=unused-function]
> > 679 | static int adreno_system_resume(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/msm/adreno/adreno_device.c:655:12: error: 'adreno_system_suspend' defined but not used [-Werror=unused-function]
> > 655 | static int adreno_system_suspend(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
> >
> > These functions are only used in SET_SYSTEM_SLEEP_PM_OPS(), which
> > evaluates to empty when CONFIG_PM_SLEEP is not set, making these
> > functions unused.
> >
> > Traditionally, these functions are marked as __maybe_unused but in this
> > case, there is already an '#ifdef CONFIG_PM' in the code, so just do the
> > same thing with CONFIG_PM_SLEEP to resolve the warning.
> >
> > Fixes: 7e4167c9e021 ("drm/msm/gpu: Park scheduler threads for system suspend")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> I'd suggest using __maybe_unused instead (and maybe even sending the
> followup patch changing the #ifdef CONFIG_PM to __maybe_unused too):
>
> If the code is included into the compilation, it means it's more widely
> compile tested. Which tends to reveal obscure bugs, dependencies, etc.
Thanks, I looked into it and there was a recent rework of the PM macros
that allows us to eliminate the existing #ifdef. I have sent v2:
https://lore.kernel.org/20220411181249.2758344-1-nathan@kernel.org/
Cheers,
Nathan
> > ---
> > drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
> > index 661dfa7681fb..b25915230bab 100644
> > --- a/drivers/gpu/drm/msm/adreno/adreno_device.c
> > +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
> > @@ -621,6 +621,7 @@ static int adreno_runtime_suspend(struct device *dev)
> > return gpu->funcs->pm_suspend(gpu);
> > }
> > +#ifdef CONFIG_PM_SLEEP
> > static void suspend_scheduler(struct msm_gpu *gpu)
> > {
> > int i;
> > @@ -681,8 +682,8 @@ static int adreno_system_resume(struct device *dev)
> > resume_scheduler(dev_to_gpu(dev));
> > return pm_runtime_force_resume(dev);
> > }
> > -
> > -#endif
> > +#endif /* CONFIG_PM_SLEEP */
> > +#endif /* CONFIG_PM */
> > static const struct dev_pm_ops adreno_pm_ops = {
> > SET_SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
> >
> > base-commit: 05241de1f69eb7f56b0a5e0bec96a7752fad1b2f
>
>
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-11 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 18:05 [PATCH] drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP Nathan Chancellor
2022-04-11 0:53 ` Dmitry Baryshkov
2022-04-11 18:15 ` Nathan Chancellor
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).