Change intel_connector iterators as with writeback introduction not all drm_connector will be embedded within intel_connector. Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx> Reviewed-by: Arun R Murthy <arun.r.murthy@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_acpi.c | 7 +++++- drivers/gpu/drm/i915/display/intel_display.h | 3 ++- .../drm/i915/display/intel_display_types.h | 24 ++++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index 9df78e7caa2b..912fe5c2ffe5 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -349,8 +349,13 @@ void intel_acpi_video_register(struct drm_i915_private *i915) */ drm_connector_list_iter_begin(&i915->drm, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) { - struct intel_panel *panel = &to_intel_connector(connector)->panel; + struct intel_panel *panel; + struct intel_connector *intel_connector = + to_intel_connector(connector); + if (!intel_connector) + continue; + panel = &intel_connector->panel; if (panel->backlight.funcs && !panel->backlight.device) { acpi_video_register_backlight(); break; diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 7210d678bc74..e0c31a3b20fd 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -52,6 +52,7 @@ struct intel_crtc_state; struct intel_digital_port; struct intel_dp; struct intel_encoder; +struct intel_connector; struct intel_initial_plane_config; struct intel_link_m_n; struct intel_load_detect_pipe; @@ -432,7 +433,7 @@ enum hpd_pin { for_each_if(intel_encoder_can_psr(intel_encoder)) #define for_each_intel_connector_iter(intel_connector, iter) \ - while ((intel_connector = to_intel_connector(drm_connector_list_iter_next(iter)))) + while ((intel_connector = intel_connector_list_iter_next(iter))) #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \ list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 8b34ba423817..83fef7f41458 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1509,9 +1509,10 @@ struct cxsr_latency { }; #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base) +#define to_intel_connector(x) ((((x)->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)) ?\ + NULL : container_of(x, struct intel_connector, base)) #define to_intel_crtc(x) container_of(x, struct intel_crtc, base) #define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, uapi) -#define to_intel_connector(x) container_of(x, struct intel_connector, base) #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) #define to_intel_plane(x) container_of(x, struct intel_plane, base) @@ -2052,4 +2053,25 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; } +static inline struct intel_connector * +intel_connector_list_iter_next(struct drm_connector_list_iter *iter) +{ + struct drm_connector *connector; + bool flag = true; + /* + * Skipping connector that are Writeback connector as they will + * not be embedded in intel connector + */ + while (flag) { + connector = drm_connector_list_iter_next(iter); + if (connector && !to_intel_connector(connector)) + continue; + + flag = false; + + if (connector) + return to_intel_connector(connector); + } + return NULL; +} #endif /* __INTEL_DISPLAY_TYPES_H__ */ -- 2.25.1