Commit 060c8778 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/i915: add locking to fixed panel edid probing

With the recent addition of locking checks in

commit 62ff94a5
Author:     Daniel Vetter <daniel.vetter@ffwll.ch>
AuthorDate: Thu Jan 23 22:18:47 2014 +0100

    drm/crtc-helper: remove LOCKING from kerneldoc

drm_add_edid_modes started to WARN about the mode_config.mutex not
being held in the lvds and dp initialization code.

Now since this is init code locking is fairly redudant if it wouldn't
be for the drm core registering sysfs files a bit early. And the
locking WARNINGs nicely enforce that indeed all access to the mode
lists are properly protected. And a full audit shows that only i915
and gma500 touch the modes lists at init time.

Hence I've opted to wrap up this entire mode detection sequence for
fixed panels with the mode_config mutex for both lvds and edp outputs.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 3ea87855
...@@ -3763,6 +3763,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, ...@@ -3763,6 +3763,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
/* We now know it's not a ghost, init power sequence regs. */ /* We now know it's not a ghost, init power sequence regs. */
intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq);
mutex_lock(&dev->mode_config.mutex);
edid = drm_get_edid(connector, &intel_dp->adapter); edid = drm_get_edid(connector, &intel_dp->adapter);
if (edid) { if (edid) {
if (drm_add_edid_modes(connector, edid)) { if (drm_add_edid_modes(connector, edid)) {
...@@ -3793,6 +3794,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, ...@@ -3793,6 +3794,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
if (fixed_mode) if (fixed_mode)
fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
} }
mutex_unlock(&dev->mode_config.mutex);
intel_panel_init(&intel_connector->panel, fixed_mode, NULL); intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
intel_panel_setup_backlight(connector); intel_panel_setup_backlight(connector);
......
...@@ -1002,6 +1002,7 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -1002,6 +1002,7 @@ void intel_lvds_init(struct drm_device *dev)
* Attempt to get the fixed panel mode from DDC. Assume that the * Attempt to get the fixed panel mode from DDC. Assume that the
* preferred mode is the right one. * preferred mode is the right one.
*/ */
mutex_lock(&dev->mode_config.mutex);
edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin)); edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
if (edid) { if (edid) {
if (drm_add_edid_modes(connector, edid)) { if (drm_add_edid_modes(connector, edid)) {
...@@ -1095,6 +1096,8 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -1095,6 +1096,8 @@ void intel_lvds_init(struct drm_device *dev)
goto failed; goto failed;
out: out:
mutex_unlock(&dev->mode_config.mutex);
lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder);
DRM_DEBUG_KMS("detected %s-link lvds configuration\n", DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
lvds_encoder->is_dual_link ? "dual" : "single"); lvds_encoder->is_dual_link ? "dual" : "single");
...@@ -1123,6 +1126,8 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -1123,6 +1126,8 @@ void intel_lvds_init(struct drm_device *dev)
return; return;
failed: failed:
mutex_unlock(&dev->mode_config.mutex);
DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
......
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