]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: fix link error for !PM_SLEEP
authorArnd Bergmann <arnd@arndb.de>
Mon, 14 Jul 2025 08:16:25 +0000 (10:16 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Aug 2025 18:36:54 +0000 (14:36 -0400)
When power management is not enabled in the kernel build, the newly
added hibernation changes cause a link failure:

arm-linux-gnueabi-ld: drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o: in function `amdgpu_pmops_thaw':
amdgpu_drv.c:(.text+0x1514): undefined reference to `pm_hibernate_is_recovering'

Make the power management code in this driver conditional on
CONFIG_PM and CONFIG_PM_SLEEP

Fixes: 530694f54dd5 ("drm/amdgpu: do not resume device in thaw for normal hibernation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250714081635.4071570-1-arnd@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 8e8b7d2c3f42eefbf722281a9b16a9004aa4825f..141ba1f100d4d062ed9ec8f4e9cb1131294fd784 100644 (file)
@@ -2968,15 +2968,15 @@ out:
 }
 
 static const struct dev_pm_ops amdgpu_pm_ops = {
-       .prepare = amdgpu_pmops_prepare,
-       .complete = amdgpu_pmops_complete,
-       .suspend = amdgpu_pmops_suspend,
-       .suspend_noirq = amdgpu_pmops_suspend_noirq,
-       .resume = amdgpu_pmops_resume,
-       .freeze = amdgpu_pmops_freeze,
-       .thaw = amdgpu_pmops_thaw,
-       .poweroff = amdgpu_pmops_poweroff,
-       .restore = amdgpu_pmops_restore,
+       .prepare = pm_sleep_ptr(amdgpu_pmops_prepare),
+       .complete = pm_sleep_ptr(amdgpu_pmops_complete),
+       .suspend = pm_sleep_ptr(amdgpu_pmops_suspend),
+       .suspend_noirq = pm_sleep_ptr(amdgpu_pmops_suspend_noirq),
+       .resume = pm_sleep_ptr(amdgpu_pmops_resume),
+       .freeze = pm_sleep_ptr(amdgpu_pmops_freeze),
+       .thaw = pm_sleep_ptr(amdgpu_pmops_thaw),
+       .poweroff = pm_sleep_ptr(amdgpu_pmops_poweroff),
+       .restore = pm_sleep_ptr(amdgpu_pmops_restore),
        .runtime_suspend = amdgpu_pmops_runtime_suspend,
        .runtime_resume = amdgpu_pmops_runtime_resume,
        .runtime_idle = amdgpu_pmops_runtime_idle,
@@ -3121,7 +3121,7 @@ static struct pci_driver amdgpu_kms_pci_driver = {
        .probe = amdgpu_pci_probe,
        .remove = amdgpu_pci_remove,
        .shutdown = amdgpu_pci_shutdown,
-       .driver.pm = &amdgpu_pm_ops,
+       .driver.pm = pm_ptr(&amdgpu_pm_ops),
        .err_handler = &amdgpu_pci_err_handler,
        .dev_groups = amdgpu_sysfs_groups,
 };