Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/vc4: hdmi: Simplify the connector state retrieval

When we have the entire DRM state, retrieving the connector state only
requires the drm_connector pointer. Fortunately for us, we have
allocated it as a part of the vc4_hdmi structure, so we can retrieve get
a pointer by simply accessing our field in that structure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220127111404.221882-1-maxime@cerno.tech

+3 -18
+3 -18
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 1018 1018 "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); 1019 1019 } 1020 1020 1021 - static struct drm_connector_state * 1022 - vc4_hdmi_encoder_get_connector_state(struct drm_encoder *encoder, 1023 - struct drm_atomic_state *state) 1024 - { 1025 - struct drm_connector_state *conn_state; 1026 - struct drm_connector *connector; 1027 - unsigned int i; 1028 - 1029 - for_each_new_connector_in_state(state, connector, conn_state, i) { 1030 - if (conn_state->best_encoder == encoder) 1031 - return conn_state; 1032 - } 1033 - 1034 - return NULL; 1035 - } 1036 - 1037 1021 static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, 1038 1022 struct drm_atomic_state *state) 1039 1023 { 1024 + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 1025 + struct drm_connector *connector = &vc4_hdmi->connector; 1040 1026 struct drm_connector_state *conn_state = 1041 - vc4_hdmi_encoder_get_connector_state(encoder, state); 1027 + drm_atomic_get_new_connector_state(state, connector); 1042 1028 struct vc4_hdmi_connector_state *vc4_conn_state = 1043 1029 conn_state_to_vc4_hdmi_conn_state(conn_state); 1044 - struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 1045 1030 struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; 1046 1031 unsigned long pixel_rate = vc4_conn_state->pixel_rate; 1047 1032 unsigned long bvb_rate, hsm_rate;