In preparation for making struct intel_pmdemand_state an opaque type, convert to_intel_pmdemand_state() to a function. Cc: Gustavo Sousa <gustavo.sousa@xxxxxxxxx> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- This is the simplest change. There could be other alternatives. Outside of intel_pmdemand.c, this is only used to convert display.pmdemand.obj.state to struct intel_pmdemand_state *. Maybe we could just pass the global object or state pointer instead? Or we could have a function to get the current state from, say, struct intel_display? What we currently have is a bit cumbersome. --- drivers/gpu/drm/i915/display/intel_pmdemand.c | 5 +++++ drivers/gpu/drm/i915/display/intel_pmdemand.h | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.c b/drivers/gpu/drm/i915/display/intel_pmdemand.c index cdd314956a31..69b40b3735b3 100644 --- a/drivers/gpu/drm/i915/display/intel_pmdemand.c +++ b/drivers/gpu/drm/i915/display/intel_pmdemand.c @@ -15,6 +15,11 @@ #include "intel_pmdemand.h" #include "skl_watermark.h" +struct intel_pmdemand_state *to_intel_pmdemand_state(struct intel_global_state *obj_state) +{ + return container_of(obj_state, struct intel_pmdemand_state, base); +} + static struct intel_global_state * intel_pmdemand_duplicate_state(struct intel_global_obj *obj) { diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.h b/drivers/gpu/drm/i915/display/intel_pmdemand.h index a1c49efdc493..89296364ec3b 100644 --- a/drivers/gpu/drm/i915/display/intel_pmdemand.h +++ b/drivers/gpu/drm/i915/display/intel_pmdemand.h @@ -43,8 +43,7 @@ struct intel_pmdemand_state { struct pmdemand_params params; }; -#define to_intel_pmdemand_state(global_state) \ - container_of_const((global_state), struct intel_pmdemand_state, base) +struct intel_pmdemand_state *to_intel_pmdemand_state(struct intel_global_state *obj_state); void intel_pmdemand_init_early(struct drm_i915_private *i915); int intel_pmdemand_init(struct drm_i915_private *i915); -- 2.39.5