From 3f85fb3462dc1c87a9353eb38714468d46248b2e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 22 Dec 2016 08:36:37 +0000 Subject: drm: Wrap drm_mm_node.hole_follows Insulate users from changes to the internal hole tracking within struct drm_mm_node by using an accessor for hole_follows. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen [danvet: resolve conflicts in i915_vma.c] Signed-off-by: Daniel Vetter --- include/drm/drm_mm.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index aed93cbc4bde..7da7a171d6d5 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -155,6 +155,22 @@ static inline bool drm_mm_initialized(const struct drm_mm *mm) return mm->hole_stack.next; } +/** + * drm_mm_hole_follows - checks whether a hole follows this node + * @node: drm_mm_node to check + * + * Holes are embedded into the drm_mm using the tail of a drm_mm_node. + * If you wish to know whether a hole follows this particular node, + * query this function. + * + * Returns: + * True if a hole follows the @node. + */ +static inline bool drm_mm_hole_follows(const struct drm_mm_node *node) +{ + return node->hole_follows; +} + static inline u64 __drm_mm_hole_node_start(const struct drm_mm_node *hole_node) { return hole_node->start + hole_node->size; @@ -166,14 +182,14 @@ static inline u64 __drm_mm_hole_node_start(const struct drm_mm_node *hole_node) * * This is useful for driver-specific debug dumpers. Otherwise drivers should * not inspect holes themselves. Drivers must check first whether a hole indeed - * follows by looking at node->hole_follows. + * follows by looking at drm_mm_hole_follows() * * Returns: * Start of the subsequent hole. */ static inline u64 drm_mm_hole_node_start(const struct drm_mm_node *hole_node) { - DRM_MM_BUG_ON(!hole_node->hole_follows); + DRM_MM_BUG_ON(!drm_mm_hole_follows(hole_node)); return __drm_mm_hole_node_start(hole_node); } @@ -188,7 +204,7 @@ static inline u64 __drm_mm_hole_node_end(const struct drm_mm_node *hole_node) * * This is useful for driver-specific debug dumpers. Otherwise drivers should * not inspect holes themselves. Drivers must check first whether a hole indeed - * follows by looking at node->hole_follows. + * follows by looking at drm_mm_hole_follows(). * * Returns: * End of the subsequent hole. -- cgit v1.2.3