[PATCH 2/2] drm/amd/display: call amdgpu_dm_fini whewn sw_fini.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fix issue: unload amdgpu, can't load amdgpu again.

the error as:
[drm:drm_debugfs_init [drm]] *ERROR* Cannot create /sys/kernel/debug/dri/0
[drm:drm_minor_register [drm]] *ERROR* DRM: Failed to initialize /sys/kernel/debug/dri.

Change-Id: If94a24ad5b30e32c3445b554bfd2884e2d27eaf9
Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++--
 drivers/gpu/drm/amd/display/dc/core/dc.c          | 7 ++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9813688..233d1cf 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -401,9 +401,8 @@ void amdgpu_dm_fini(struct amdgpu_device *adev)
 		adev->dm.freesync_module = NULL;
 	}
 	/* DC Destroy TODO: Replace destroy DAL */
-	{
+	if (adev->dm.dc)
 		dc_destroy(&adev->dm.dc);
-	}
 	return;
 }
 
@@ -419,6 +418,10 @@ static int dm_sw_init(void *handle)
 
 static int dm_sw_fini(void *handle)
 {
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	amdgpu_dm_fini(adev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 738acf0..b5c1295 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1582,7 +1582,12 @@ enum dc_irq_source dc_interrupt_to_irq_source(
 
 void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable)
 {
-	struct core_dc *core_dc = DC_TO_CORE(dc);
+	struct core_dc *core_dc;
+
+	if (dc == NULL)
+		return;
+	core_dc = DC_TO_CORE(dc);
+
 	dal_irq_service_set(core_dc->res_pool->irqs, src, enable);
 }
 
-- 
1.9.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux