diff options
author | Maxime Ripard <maxime@cerno.tech> | 2023-03-06 13:46:42 +0300 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2023-04-25 10:32:25 +0300 |
commit | 5a46e490e47e4d821c382288108f193fc88a9282 (patch) | |
tree | 301fdd26bffd35e575679430e7c1bf45abb8743b /drivers/gpu/drm/vc4/vc4_hdmi.h | |
parent | 322d716a3e8a74fb75cd0f657647be4df253fd2f (diff) | |
download | linux-5a46e490e47e4d821c382288108f193fc88a9282.tar.xz |
drm/vc4: Switch to container_of_const
container_of_const() allows to preserve the pointer constness and is
thus more flexible than inline functions.
Let's switch all our instances of container_of() to
container_of_const().
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20221207-rpi-hdmi-improvements-v3-1-bdd54f66884e@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_hdmi.h')
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_hdmi.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index e3619836ca17..b57ffbca5721 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -222,17 +222,14 @@ struct vc4_hdmi { enum vc4_hdmi_output_format output_format; }; -static inline struct vc4_hdmi * -connector_to_vc4_hdmi(struct drm_connector *connector) -{ - return container_of(connector, struct vc4_hdmi, connector); -} +#define connector_to_vc4_hdmi(_connector) \ + container_of_const(_connector, struct vc4_hdmi, connector) static inline struct vc4_hdmi * encoder_to_vc4_hdmi(struct drm_encoder *encoder) { struct vc4_encoder *_encoder = to_vc4_encoder(encoder); - return container_of(_encoder, struct vc4_hdmi, encoder); + return container_of_const(_encoder, struct vc4_hdmi, encoder); } struct vc4_hdmi_connector_state { @@ -242,11 +239,8 @@ struct vc4_hdmi_connector_state { enum vc4_hdmi_output_format output_format; }; -static inline struct vc4_hdmi_connector_state * -conn_state_to_vc4_hdmi_conn_state(struct drm_connector_state *conn_state) -{ - return container_of(conn_state, struct vc4_hdmi_connector_state, base); -} +#define conn_state_to_vc4_hdmi_conn_state(_state) \ + container_of_const(_state, struct vc4_hdmi_connector_state, base) void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, struct vc4_hdmi_connector_state *vc4_conn_state); |