/** * amdgpu_driver_unload_kms - Main unload function for KMS. * * @dev: drm dev pointer * * This is the main unload function for KMS (all asics). * Returns 0 on success. */ void amdgpu_driver_unload_kms(struct drm_device *dev) { struct amdgpu_device *adev = dev->dev_private; if (adev == NULL) return; if (adev->rmmio == NULL) goto done_free; if (amdgpu_sriov_vf(adev)) amdgpu_virt_request_full_gpu(adev, false); if (amdgpu_device_is_px(dev)) { pm_runtime_get_sync(dev->dev); pm_runtime_forbid(dev->dev); } amdgpu_amdkfd_device_fini(adev); amdgpu_acpi_fini(adev); amdgpu_device_fini(adev); done_free: kfree(adev); dev->dev_private = NULL; }
/** * amdgpu_driver_unload_kms - Main unload function for KMS. * * @dev: drm dev pointer * * This is the main unload function for KMS (all asics). * Returns 0 on success. */ int amdgpu_driver_unload_kms(struct drm_device *dev) { struct amdgpu_device *adev = dev->dev_private; if (adev == NULL) return 0; if (adev->rmmio == NULL) goto done_free; if (amdgpu_device_is_px(dev)) { pm_runtime_get_sync(dev->dev); pm_runtime_forbid(dev->dev); } amdgpu_amdkfd_device_fini(adev); amdgpu_acpi_fini(adev); amdgpu_device_fini(adev); done_free: kfree(adev); dev->dev_private = NULL; return 0; }