Skip to content

Commit c6385e5

Browse files
committed
drm/amdgpu: drop legacy drm load and unload callbacks
We've moved the debugfs handling into a centralized place so we can remove the legacy load an unload callbacks. Tested-by: Thomas Zimmermann <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent d95665c commit c6385e5

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,10 +3120,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
31203120
} else
31213121
adev->ucode_sysfs_en = true;
31223122

3123-
r = amdgpu_debugfs_init(adev);
3124-
if (r)
3125-
DRM_ERROR("Creating debugfs files failed (%d).\n", r);
3126-
31273123
if ((amdgpu_testing & 1)) {
31283124
if (adev->accel_working)
31293125
amdgpu_test_moves(adev);
@@ -3245,7 +3241,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
32453241
amdgpu_ucode_sysfs_fini(adev);
32463242
if (IS_ENABLED(CONFIG_PERF_EVENTS))
32473243
amdgpu_pmu_fini(adev);
3248-
amdgpu_debugfs_fini(adev);
32493244
if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
32503245
amdgpu_discovery_fini(adev);
32513246
}

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
10211021
const struct pci_device_id *ent)
10221022
{
10231023
struct drm_device *dev;
1024+
struct amdgpu_device *adev;
10241025
unsigned long flags = ent->driver_data;
10251026
int ret, retry = 0;
10261027
bool supports_atomic = false;
@@ -1090,6 +1091,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
10901091

10911092
pci_set_drvdata(pdev, dev);
10921093

1094+
amdgpu_driver_load_kms(dev, ent->driver_data);
1095+
10931096
retry_init:
10941097
ret = drm_dev_register(dev, ent->driver_data);
10951098
if (ret == -EAGAIN && ++retry <= 3) {
@@ -1100,6 +1103,11 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
11001103
} else if (ret)
11011104
goto err_pci;
11021105

1106+
adev = dev->dev_private;
1107+
ret = amdgpu_debugfs_init(adev);
1108+
if (ret)
1109+
DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
1110+
11031111
return 0;
11041112

11051113
err_pci:
@@ -1113,13 +1121,16 @@ static void
11131121
amdgpu_pci_remove(struct pci_dev *pdev)
11141122
{
11151123
struct drm_device *dev = pci_get_drvdata(pdev);
1124+
struct amdgpu_device *adev = dev->dev_private;
11161125

11171126
#ifdef MODULE
11181127
if (THIS_MODULE->state != MODULE_STATE_GOING)
11191128
#endif
11201129
DRM_ERROR("Hotplug removal is not supported\n");
11211130
drm_dev_unplug(dev);
11221131
drm_dev_put(dev);
1132+
amdgpu_debugfs_fini(adev);
1133+
amdgpu_driver_unload_kms(dev);
11231134
pci_disable_device(pdev);
11241135
pci_set_drvdata(pdev, NULL);
11251136
}
@@ -1398,11 +1409,9 @@ static struct drm_driver kms_driver = {
13981409
DRIVER_GEM |
13991410
DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ |
14001411
DRIVER_SYNCOBJ_TIMELINE,
1401-
.load = amdgpu_driver_load_kms,
14021412
.open = amdgpu_driver_open_kms,
14031413
.postclose = amdgpu_driver_postclose_kms,
14041414
.lastclose = amdgpu_driver_lastclose_kms,
1405-
.unload = amdgpu_driver_unload_kms,
14061415
.get_vblank_counter = amdgpu_get_vblank_counter_kms,
14071416
.enable_vblank = amdgpu_enable_vblank_kms,
14081417
.disable_vblank = amdgpu_disable_vblank_kms,

0 commit comments

Comments
 (0)