[Intel-gfx] [PATCH] drm/i915: Assert intel_wait and its rb_node are complimentary

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 12 15:15:52 UTC 2018


For convenience, we want to interchange intel_wait/rb_node and treat a
NULL rb_node as a NULL intel_wait and vice versa. Assert that the
rb_node is at offset 0 in the intel_wait to ensure this.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/intel_breadcrumbs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index 84bf8d827136..44f117612193 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -342,6 +342,7 @@ static bool __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
 
 static inline struct intel_wait *to_wait(struct rb_node *node)
 {
+	BUILD_BUG_ON(offsetof(struct intel_wait, node));
 	return rb_entry(node, struct intel_wait, node);
 }
 
-- 
2.19.1



More information about the Intel-gfx mailing list