From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [Intel-gfx] [PATCH v2 5/5] drm/i915/fence: replace BUG_ON() with BUILD_BUG_ON()
Date: Tue, 30 Aug 2022 12:34:11 +0300 [thread overview]
Message-ID: <20220830093411.1511040-5-jani.nikula@intel.com> (raw)
In-Reply-To: <20220830093411.1511040-1-jani.nikula@intel.com>
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>
---
drivers/gpu/drm/i915/i915_sw_fence.c | 2 --
drivers/gpu/drm/i915/i915_sw_fence.h | 6 +++++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
index ae984c66c48a..6fc0d1b89690 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence.c
@@ -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
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.h b/drivers/gpu/drm/i915/i915_sw_fence.h
index a7c603bc1b01..619fc5a22f0c 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.h
+++ b/drivers/gpu/drm/i915/i915_sw_fence.h
@@ -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);
--
2.34.1
next prev parent reply other threads:[~2022-08-30 9:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 9:34 [Intel-gfx] [PATCH v2 1/5] drm/i915/crt: remove BUG_ON() Jani Nikula
2022-08-30 9:34 ` [Intel-gfx] [PATCH v2 2/5] drm/i915/dpll: replace BUG_ON() with drm_WARN_ON() Jani Nikula
2022-08-31 15:44 ` Andrzej Hajda
2022-08-31 15:55 ` Jani Nikula
2022-08-30 9:34 ` [Intel-gfx] [PATCH v2 3/5] drm/i915/pch: " Jani Nikula
2022-08-31 15:45 ` Andrzej Hajda
2022-08-30 9:34 ` [Intel-gfx] [PATCH v2 4/5] drm/i915/perf: replace BUG_ON() with WARN_ON() Jani Nikula
2022-08-30 9:34 ` Jani Nikula [this message]
2022-08-30 9:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/5] drm/i915/crt: remove BUG_ON() Patchwork
2022-08-30 10:03 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-08-31 13:30 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-08-31 14:46 ` [Intel-gfx] [PATCH v2 1/5] " Ville Syrjälä
2022-08-31 15:30 ` Andrzej Hajda
2022-08-31 15:41 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830093411.1511040-5-jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox