drm: Compile time enabling for asserts in drm_mm

Use CONFIG_DRM_DEBUG_MM to conditionally enable the internal and
validation checking using BUG_ON. Ideally these paths should all be
exercised by CI selftests (with the asserts enabled).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-4-chris@chris-wilson.co.uk
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-4-chris@chris-wilson.co.uk
This commit is contained in:
Chris Wilson
2016-12-22 08:36:06 +00:00
committed by Daniel Vetter
parent 2bc98c8651
commit b3ee963fe4
2 changed files with 30 additions and 23 deletions

View File

@@ -48,6 +48,12 @@
#include <linux/stackdepot.h>
#endif
#ifdef CONFIG_DRM_DEBUG_MM
#define DRM_MM_BUG_ON(expr) BUG_ON(expr)
#else
#define DRM_MM_BUG_ON(expr) BUILD_BUG_ON_INVALID(expr)
#endif
enum drm_mm_search_flags {
DRM_MM_SEARCH_DEFAULT = 0,
DRM_MM_SEARCH_BEST = 1 << 0,
@@ -155,7 +161,7 @@ static inline u64 __drm_mm_hole_node_start(const struct drm_mm_node *hole_node)
*/
static inline u64 drm_mm_hole_node_start(const struct drm_mm_node *hole_node)
{
BUG_ON(!hole_node->hole_follows);
DRM_MM_BUG_ON(!hole_node->hole_follows);
return __drm_mm_hole_node_start(hole_node);
}