From 2ee476f77ffe5a7ecbd4e1e20fa0859cb541530d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 17 Sep 2020 14:03:46 +1000 Subject: drm/ttm: add a simple assign mem to bo wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pattern is called in a few places, just clean it up. Reviewed-by: Christian König Signed-off-by: Dave Airlie Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-6-airlied@gmail.com --- include/drm/ttm/ttm_bo_driver.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/drm') diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 7846dfa507f7..25cc932d63f1 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -539,6 +539,13 @@ static inline void ttm_bo_move_to_lru_tail_unlocked(struct ttm_buffer_object *bo spin_unlock(&ttm_bo_glob.lru_lock); } +static inline void ttm_bo_assign_mem(struct ttm_buffer_object *bo, + struct ttm_resource *new_mem) +{ + bo->mem = *new_mem; + new_mem->mm_node = NULL; +} + /** * ttm_bo_move_null = assign memory for a buffer object. * @bo: The bo to assign the memory to @@ -552,8 +559,7 @@ static inline void ttm_bo_move_null(struct ttm_buffer_object *bo, struct ttm_resource *old_mem = &bo->mem; WARN_ON(old_mem->mm_node != NULL); - *old_mem = *new_mem; - new_mem->mm_node = NULL; + ttm_bo_assign_mem(bo, new_mem); } /** -- cgit v1.2.3-59-g8ed1b