[PATCH] drm/amd/amdgpu: Cancel delay work before unload driver

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

 



move cancel_delayed_work_sync() to the begining
of amdgpu_device_fini() to cancel unfinished
works which are no longer needed.

Change-Id: I8831935b797c78b971aa7233697c36140374f1ac
Signed-off-by: Jesse Zhang <zhexi.zhang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c     | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f0ad05d..5b8af69 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3115,6 +3115,12 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 
 	DRM_INFO("amdgpu: finishing device.\n");
 	adev->shutdown = true;
+
+	/* Cancel unfinished delay work before unload driver */
+	cancel_delayed_work_sync(&adev->delayed_init_work);
+	cancel_delayed_work_sync(&adev->uvd.idle_work);
+	cancel_delayed_work_sync(&adev->vce.idle_work);
+
 	/* disable all interrupts */
 	amdgpu_irq_disable_all(adev);
 	if (adev->mode_info.mode_config_initialized){
@@ -3134,7 +3140,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 		adev->firmware.gpu_info_fw = NULL;
 	}
 	adev->accel_working = false;
-	cancel_delayed_work_sync(&adev->delayed_init_work);
 	/* free i2c buses */
 	if (!amdgpu_device_has_dc_support(adev))
 		amdgpu_i2c_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index d121bbd..fc6c949 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -364,6 +364,8 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
 		struct amdgpu_ring *ring = adev->rings[i];
 		long tmo;
 
+		if (adev->shutdown)
+			return 0;
 		/* KIQ rings don't have an IB test because we never submit IBs
 		 * to them and they have no interrupt support.
 		 */
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




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

  Powered by Linux