summaryrefslogtreecommitdiffstats
path: root/include/drm/ttm/ttm_bo_driver.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-09-07 22:46:18 +0200
committerDave Airlie <airlied@redhat.com>2020-09-09 00:28:53 +0200
commitecfe6953fa00115414a6fefe49023a1ebc187a98 (patch)
tree3e52dbe04e22a22facc8586721a8cd0ed79a605f /include/drm/ttm/ttm_bo_driver.h
parentMAINTAINERS: add entry for VKMS (diff)
downloadlinux-ecfe6953fa00115414a6fefe49023a1ebc187a98.tar.xz
linux-ecfe6953fa00115414a6fefe49023a1ebc187a98.zip
drm/ttm: introduce ttm_bo_move_null
This pattern is cut-n-pasted across 4 drivers, switch it to a WARN_ON instead, as BUG_ON is considered a bad idea usually. Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200907204630.1406528-2-airlied@gmail.com
Diffstat (limited to 'include/drm/ttm/ttm_bo_driver.h')
-rw-r--r--include/drm/ttm/ttm_bo_driver.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a694388f7b13..ebba282667ba 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -521,6 +521,23 @@ static inline void ttm_bo_move_to_lru_tail_unlocked(struct ttm_buffer_object *bo
}
/**
+ * ttm_bo_move_null = assign memory for a buffer object.
+ * @bo: The bo to assign the memory to
+ * @new_mem: The memory to be assigned.
+ *
+ * Assign the memory from new_mem to the memory of the buffer object bo.
+ */
+static inline void ttm_bo_move_null(struct ttm_buffer_object *bo,
+ struct ttm_resource *new_mem)
+{
+ 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_unreserve
*
* @bo: A pointer to a struct ttm_buffer_object.