Separate the drm_mm_node walking from the actual handling.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 59b491998049..d6688a2e525a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -727,12 +727,10 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device 
*bdev, struct ttm_reso
 static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
                                           unsigned long page_offset)
 {
-       uint64_t offset = (page_offset << PAGE_SHIFT);
-       struct drm_mm_node *mm;
+       struct amdgpu_res_cursor cursor;
 
-       mm = amdgpu_find_mm_node(&bo->mem, &offset);
-       return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start +
-               (offset >> PAGE_SHIFT);
+       amdgpu_res_first(&bo->mem, (u64)page_offset << PAGE_SHIFT, 0, &cursor);
+       return (bo->mem.bus.base + cursor.start) >> PAGE_SHIFT;
 }
 
 /**
-- 
2.25.1

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

Reply via email to