drm/amdgpu: drm_device to amdgpu_device by inline-f (v2)

Get the amdgpu_device from the DRM device by use
of an inline function, drm_to_adev(). The inline
function resolves a pointer to struct drm_device
to a pointer to struct amdgpu_device.

v2: Use a typed visible static inline function
    instead of an invisible macro.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Luben Tuikov
2020-08-24 12:27:47 -04:00
committed by Alex Deucher
parent 50166d1ce5
commit 1348969ab6
44 changed files with 303 additions and 300 deletions

View File

@@ -986,6 +986,11 @@ struct amdgpu_device {
struct ratelimit_state throttling_logging_rs;
};
static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
{
return ddev->dev_private;
}
static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev)
{
return container_of(bdev, struct amdgpu_device, mman.bdev);