drm/i915/fence: replace BUG_ON() with BUILD_BUG_ON()

Avoid BUG_ON(). Since __i915_sw_fence_init() is always called via a
wrapper macro, we can replace it with a compile time BUILD_BUG_ON().

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220830093411.1511040-5-jani.nikula@intel.com
This commit is contained in:
Jani Nikula
2022-08-30 12:34:11 +03:00
parent 6f10c4d623
commit 03e067bc73
2 changed files with 5 additions and 3 deletions

View File

@@ -241,8 +241,6 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence,
const char *name,
struct lock_class_key *key)
{
BUG_ON(!fn);
__init_waitqueue_head(&fence->wait, name, key);
fence->fn = fn;
#ifdef CONFIG_DRM_I915_SW_FENCE_CHECK_DAG

View File

@@ -48,11 +48,15 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence,
do { \
static struct lock_class_key __key; \
\
BUILD_BUG_ON((fn) == NULL); \
__i915_sw_fence_init((fence), (fn), #fence, &__key); \
} while (0)
#else
#define i915_sw_fence_init(fence, fn) \
__i915_sw_fence_init((fence), (fn), NULL, NULL)
do { \
BUILD_BUG_ON((fn) == NULL); \
__i915_sw_fence_init((fence), (fn), NULL, NULL); \
} while (0)
#endif
void i915_sw_fence_reinit(struct i915_sw_fence *fence);