Skip to content

Commit 8e3967a

Browse files
Perry Yuanalexdeucher
authored andcommitted
drm/amdgpu: Fix build error when CONFIG_SUSPEND is disabled
The variable `pm_suspend_target_state` is conditionally defined only when `CONFIG_SUSPEND` is enabled (see `include/linux/suspend.h`). Directly referencing it without guarding by `#ifdef CONFIG_SUSPEND` causes build failures when suspend functionality is disabled (e.g., `CONFIG_SUSPEND=n`). Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Perry Yuan <perry.yuan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 6716a82 commit 8e3967a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,18 +2597,22 @@ static int amdgpu_pmops_suspend(struct device *dev)
25972597
else if (amdgpu_acpi_is_s3_active(adev))
25982598
adev->in_s3 = true;
25992599
if (!adev->in_s0ix && !adev->in_s3) {
2600+
#if IS_ENABLED(CONFIG_SUSPEND)
26002601
/* don't allow going deep first time followed by s2idle the next time */
26012602
if (adev->last_suspend_state != PM_SUSPEND_ON &&
26022603
adev->last_suspend_state != pm_suspend_target_state) {
26032604
drm_err_once(drm_dev, "Unsupported suspend state %d\n",
26042605
pm_suspend_target_state);
26052606
return -EINVAL;
26062607
}
2608+
#endif
26072609
return 0;
26082610
}
26092611

2612+
#if IS_ENABLED(CONFIG_SUSPEND)
26102613
/* cache the state last used for suspend */
26112614
adev->last_suspend_state = pm_suspend_target_state;
2615+
#endif
26122616

26132617
return amdgpu_device_suspend(drm_dev, true);
26142618
}

0 commit comments

Comments
 (0)