drm/amdgpu/powerplay: enable sysfs and debugfs interfaces late
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Dec 2015 22:28:28 +0000 (17:28 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 21 Dec 2015 21:42:51 +0000 (16:42 -0500)
To avoid users accessing them before the module has finished
initializing them and make sure they are only created if
dpm has properly initialized.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c

index b8b4a4781f4d112d642bad11952a6d16167a5c2e..ddb90ebd0e7c66c3fd67aac3d9b549ddea95759d 100644 (file)
@@ -131,6 +131,10 @@ static int amdgpu_pp_late_init(void *handle)
                ret = adev->powerplay.ip_funcs->late_init(
                                        adev->powerplay.pp_handle);
 
+#ifdef CONFIG_DRM_AMD_POWERPLAY
+       if (adev->pp_enabled)
+               amdgpu_pm_sysfs_init(adev);
+#endif
        return ret;
 }
 
@@ -145,7 +149,6 @@ static int amdgpu_pp_sw_init(void *handle)
 
 #ifdef CONFIG_DRM_AMD_POWERPLAY
        if (adev->pp_enabled) {
-               amdgpu_pm_sysfs_init(adev);
                if (amdgpu_dpm == 0)
                        adev->pm.dpm_enabled = false;
                else