Skip to content

Commit 390d645

Browse files
nathanchancerobclark
authored andcommitted
drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP
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. To resolve this, use the SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() macros, which were introduced in commit 1a3c7bb ("PM: core: Add new *_PM_OPS macros, deprecate old ones"). They are designed to avoid these compiler warnings while still guarding their use on CONFIG_PM{,_SLEEP}=y. Fixes: 7e4167c ("drm/msm/gpu: Park scheduler threads for system suspend") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20220411181249.2758344-1-nathan@kernel.org Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 8b2c181 commit 390d645

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/gpu/drm/msm/adreno/adreno_device.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ static const struct of_device_id dt_match[] = {
599599
{}
600600
};
601601

602-
#ifdef CONFIG_PM
603602
static int adreno_runtime_resume(struct device *dev)
604603
{
605604
struct msm_gpu *gpu = dev_to_gpu(dev);
@@ -682,11 +681,9 @@ static int adreno_system_resume(struct device *dev)
682681
return pm_runtime_force_resume(dev);
683682
}
684683

685-
#endif
686-
687684
static const struct dev_pm_ops adreno_pm_ops = {
688-
SET_SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
689-
SET_RUNTIME_PM_OPS(adreno_runtime_suspend, adreno_runtime_resume, NULL)
685+
SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
686+
RUNTIME_PM_OPS(adreno_runtime_suspend, adreno_runtime_resume, NULL)
690687
};
691688

692689
static struct platform_driver adreno_driver = {

0 commit comments

Comments
 (0)