summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/display/intel_pmdemand.h
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2024-03-07 16:18:09 +0100
committerVille Syrjälä <ville.syrjala@linux.intel.com>2024-03-15 09:53:46 +0100
commit89164fc86eb00e7d617a4e1d251898b7aede3a32 (patch)
tree8e3a6ea759f50a66639cfb6114b29273730cf306 /drivers/gpu/drm/i915/display/intel_pmdemand.h
parentdrm/i915: Don't cast away const (diff)
downloadlinux-89164fc86eb00e7d617a4e1d251898b7aede3a32.tar.xz
linux-89164fc86eb00e7d617a4e1d251898b7aede3a32.zip
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/intel_pmdemand.h')
-rw-r--r--drivers/gpu/drm/i915/display/intel_pmdemand.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.h b/drivers/gpu/drm/i915/display/intel_pmdemand.h
index 2941a1a18b72..128fd61f8f14 100644
--- a/drivers/gpu/drm/i915/display/intel_pmdemand.h
+++ b/drivers/gpu/drm/i915/display/intel_pmdemand.h
@@ -43,9 +43,8 @@ struct intel_pmdemand_state {
struct pmdemand_params params;
};
-#define to_intel_pmdemand_state(x) container_of((x), \
- struct intel_pmdemand_state, \
- base)
+#define to_intel_pmdemand_state(global_state) \
+ container_of_const((global_state), struct intel_pmdemand_state, base)
void intel_pmdemand_init_early(struct drm_i915_private *i915);
int intel_pmdemand_init(struct drm_i915_private *i915);