Skip to content

Commit

Permalink
drm/i915/fence: replace BUG_ON() with BUILD_BUG_ON()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jani Nikula committed Aug 31, 2022
1 parent 6f10c4d commit 03e067b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/i915/i915_sw_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion drivers/gpu/drm/i915/i915_sw_fence.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 03e067b

Please sign in to comment.