summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/display/skl_watermark.h
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2024-03-07 17:18:09 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2024-03-15 10:53:46 +0200
commit89164fc86eb00e7d617a4e1d251898b7aede3a32 (patch)
tree8e3a6ea759f50a66639cfb6114b29273730cf306 /drivers/gpu/drm/i915/display/skl_watermark.h
parent7e0c5caf944ab67f33592ecea628caefea1ebe85 (diff)
drm/i915: Use container_of_const() for states
commit 64f6a5d1922b ("container_of: add container_of_const() that preserves const-ness of the pointer") is nice. Let's use it so that we don't accidentally cast away the const from our state pointers. The only thing I don't particularly like about container_of_const() is that it still accepts void* in addition to the proper pointer types, but that's how most other things in C work anyway so I guess we can live with it. And while at it rename the macro arguments to be a bit more descriptive than just 'x'. TODO: maybe convert *all* container_of() uses to container_of_const()? Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240307151810.24208-4-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/display/skl_watermark.h')
-rw-r--r--drivers/gpu/drm/i915/display/skl_watermark.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/display/skl_watermark.h b/drivers/gpu/drm/i915/display/skl_watermark.h
index 3a90741cab06..bf7516620ab6 100644
--- a/drivers/gpu/drm/i915/display/skl_watermark.h
+++ b/drivers/gpu/drm/i915/display/skl_watermark.h
@@ -65,7 +65,9 @@ struct intel_dbuf_state {
struct intel_dbuf_state *
intel_atomic_get_dbuf_state(struct intel_atomic_state *state);
-#define to_intel_dbuf_state(x) container_of((x), struct intel_dbuf_state, base)
+#define to_intel_dbuf_state(global_state) \
+ container_of_const((global_state), struct intel_dbuf_state, base)
+
#define intel_atomic_get_old_dbuf_state(state) \
to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->display.dbuf.obj))
#define intel_atomic_get_new_dbuf_state(state) \