Commit c6686f27 authored by Maxime Ripard's avatar Maxime Ripard

drm/sun4i: hdmi: 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: default avatarSui Jingfeng <sui.jingfeng@linux.dev>
Reviewed-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240222-kms-hdmi-connector-state-v7-34-8f4af575fce2@kernel.org
parent 9ca6bc24
...@@ -30,19 +30,11 @@ ...@@ -30,19 +30,11 @@
#include "sun4i_drv.h" #include "sun4i_drv.h"
#include "sun4i_hdmi.h" #include "sun4i_hdmi.h"
static inline struct sun4i_hdmi * #define drm_encoder_to_sun4i_hdmi(e) \
drm_encoder_to_sun4i_hdmi(struct drm_encoder *encoder) container_of_const(e, struct sun4i_hdmi, encoder)
{
return container_of(encoder, struct sun4i_hdmi,
encoder);
}
static inline struct sun4i_hdmi * #define drm_connector_to_sun4i_hdmi(c) \
drm_connector_to_sun4i_hdmi(struct drm_connector *connector) container_of_const(c, struct sun4i_hdmi, connector)
{
return container_of(connector, struct sun4i_hdmi,
connector);
}
static int sun4i_hdmi_setup_avi_infoframes(struct sun4i_hdmi *hdmi, static int sun4i_hdmi_setup_avi_infoframes(struct sun4i_hdmi *hdmi,
struct drm_display_mode *mode) struct drm_display_mode *mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment