From: "Jesse.zhang@xxxxxxx" <Jesse.zhang@xxxxxxx> This reverts commit 330d97e9b14e0c85cc8b63e0092e4abcb9ce99c8. the dev->unplugged flag will also be set to true , Only uninstall the driver by amdgpu_exit,not actually unplug the device. that will cause a new issue. Signed-off-by: Jesse Zhang <jesse.zhang@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 12 +++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c | 8 ++------ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 10 ++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++------- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 9 ++------- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 8 ++------ 7 files changed, 15 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index c65feb97167d..3c89c74d67e0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -25,7 +25,6 @@ #include <linux/firmware.h> #include <linux/pm_runtime.h> -#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_gfx.h" @@ -1779,14 +1778,9 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev) void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev) { - int idx; - - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - amdgpu_gfx_sysfs_xcp_fini(adev); - amdgpu_gfx_sysfs_isolation_shader_fini(adev); - amdgpu_gfx_sysfs_reset_mask_fini(adev); - drm_dev_exit(idx); - } + amdgpu_gfx_sysfs_xcp_fini(adev); + amdgpu_gfx_sysfs_isolation_shader_fini(adev); + amdgpu_gfx_sysfs_reset_mask_fini(adev); } int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c index bf4dbceb18e1..43ea76ebbad8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c @@ -24,7 +24,6 @@ * */ -#include <drm/drm_drv.h> #include "amdgpu.h" #include "amdgpu_jpeg.h" #include "amdgpu_pm.h" @@ -448,11 +447,6 @@ int amdgpu_jpeg_sysfs_reset_mask_init(struct amdgpu_device *adev) void amdgpu_jpeg_sysfs_reset_mask_fini(struct amdgpu_device *adev) { - int idx; - - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - if (adev->jpeg.num_jpeg_inst) - device_remove_file(adev->dev, &dev_attr_jpeg_reset_mask); - drm_dev_exit(idx); - } + if (adev->jpeg.num_jpeg_inst) + device_remove_file(adev->dev, &dev_attr_jpeg_reset_mask); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c index 33a714ddfbbc..e8adfd0a570a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_preempt_mgr.c @@ -23,7 +23,6 @@ * Authors: Christian König, Felix Kuehling */ -#include <drm/drm_drv.h> #include "amdgpu.h" /** @@ -130,7 +129,7 @@ int amdgpu_preempt_mgr_init(struct amdgpu_device *adev) void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev) { struct ttm_resource_manager *man = &adev->mman.preempt_mgr; - int idx, ret; + int ret; ttm_resource_manager_set_used(man, false); @@ -138,10 +137,7 @@ void amdgpu_preempt_mgr_fini(struct amdgpu_device *adev) if (ret) return; - if (!drm_dev_enter(adev_to_drm(adev), &idx)) { - device_remove_file(adev->dev, &dev_attr_mem_info_preempt_used); - drm_dev_exit(idx); - } + device_remove_file(adev->dev, &dev_attr_mem_info_preempt_used); ttm_resource_manager_cleanup(man); ttm_set_driver_manager(&adev->mman.bdev, AMDGPU_PL_PREEMPT, NULL); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c index 24e9daacaabb..8c89b69edc20 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c @@ -21,7 +21,6 @@ * */ -#include <drm/drm_drv.h> #include <linux/firmware.h> #include "amdgpu.h" #include "amdgpu_sdma.h" @@ -449,14 +448,9 @@ int amdgpu_sdma_sysfs_reset_mask_init(struct amdgpu_device *adev) void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev) { - int idx; - if (!amdgpu_gpu_recovery) return; - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - if (adev->sdma.num_instances) - device_remove_file(adev->dev, &dev_attr_sdma_reset_mask); - drm_dev_exit(idx); - } + if (adev->sdma.num_instances) + device_remove_file(adev->dev, &dev_attr_sdma_reset_mask); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 25f490ad3a85..60e19052a1e2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -1310,11 +1310,6 @@ int amdgpu_vcn_sysfs_reset_mask_init(struct amdgpu_device *adev) void amdgpu_vcn_sysfs_reset_mask_fini(struct amdgpu_device *adev) { - int idx; - - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - if (adev->vcn.num_vcn_inst) - device_remove_file(adev->dev, &dev_attr_vcn_reset_mask); - drm_dev_exit(idx); - } + if (adev->vcn.num_vcn_inst) + device_remove_file(adev->dev, &dev_attr_vcn_reset_mask); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c index b5f5a1a81c29..02bda187f982 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c @@ -904,13 +904,8 @@ int amdgpu_vpe_sysfs_reset_mask_init(struct amdgpu_device *adev) void amdgpu_vpe_sysfs_reset_mask_fini(struct amdgpu_device *adev) { - int idx; - - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - if (adev->vpe.num_instances) - device_remove_file(adev->dev, &dev_attr_vpe_reset_mask); - drm_dev_exit(idx); - } + if (adev->vpe.num_instances) + device_remove_file(adev->dev, &dev_attr_vpe_reset_mask); } static const struct amdgpu_ring_funcs vpe_ring_funcs = { diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c index 54c05af2eed2..483a441b46aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c +++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c @@ -20,7 +20,6 @@ * OTHER DEALINGS IN THE SOFTWARE. * */ -#include <drm/drm_drv.h> #include "amdgpu.h" #include "df_v3_6.h" @@ -255,12 +254,9 @@ static void df_v3_6_sw_init(struct amdgpu_device *adev) static void df_v3_6_sw_fini(struct amdgpu_device *adev) { - int idx; - if (drm_dev_enter(adev_to_drm(adev), &idx)) { - device_remove_file(adev->dev, &dev_attr_df_cntr_avail); - drm_dev_exit(idx); - } + device_remove_file(adev->dev, &dev_attr_df_cntr_avail); + } static void df_v3_6_enable_broadcast_mode(struct amdgpu_device *adev, -- 2.25.1