]> www.infradead.org Git - nvme.git/commit
drm/i915: Use container_of_const() for states
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 7 Mar 2024 15:18:09 +0000 (17:18 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 Mar 2024 08:53:46 +0000 (10:53 +0200)
commit89164fc86eb00e7d617a4e1d251898b7aede3a32
tree8e3a6ea759f50a66639cfb6114b29273730cf306
parent7e0c5caf944ab67f33592ecea628caefea1ebe85
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>
drivers/gpu/drm/i915/display/intel_bw.h
drivers/gpu/drm/i915/display/intel_cdclk.h
drivers/gpu/drm/i915/display/intel_display_types.h
drivers/gpu/drm/i915/display/intel_pmdemand.h
drivers/gpu/drm/i915/display/intel_sdvo.c
drivers/gpu/drm/i915/display/intel_tv.c
drivers/gpu/drm/i915/display/skl_watermark.h