Commit c46145ae authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/gma500: 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.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 060c8778
...@@ -712,6 +712,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -712,6 +712,7 @@ void cdv_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);
psb_intel_ddc_get_modes(connector, psb_intel_ddc_get_modes(connector,
&gma_encoder->ddc_bus->adapter); &gma_encoder->ddc_bus->adapter);
list_for_each_entry(scan, &connector->probed_modes, head) { list_for_each_entry(scan, &connector->probed_modes, head) {
...@@ -772,10 +773,12 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -772,10 +773,12 @@ void cdv_intel_lvds_init(struct drm_device *dev,
} }
out: out:
mutex_unlock(&dev->mode_config.mutex);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return; return;
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex);
printk(KERN_ERR "Failed find\n"); printk(KERN_ERR "Failed find\n");
if (gma_encoder->ddc_bus) if (gma_encoder->ddc_bus)
psb_intel_i2c_destroy(gma_encoder->ddc_bus); psb_intel_i2c_destroy(gma_encoder->ddc_bus);
......
...@@ -359,6 +359,7 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -359,6 +359,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
* if closed, act like it's not there for now * if closed, act like it's not there for now
*/ */
mutex_lock(&dev->mode_config.mutex);
i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus); i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus);
if (i2c_adap == NULL) if (i2c_adap == NULL)
dev_err(dev->dev, "No ddc adapter available!\n"); dev_err(dev->dev, "No ddc adapter available!\n");
...@@ -401,10 +402,14 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -401,10 +402,14 @@ void oaktrail_lvds_init(struct drm_device *dev,
} }
out: out:
mutex_unlock(&dev->mode_config.mutex);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return; return;
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex);
dev_dbg(dev->dev, "No LVDS modes found, disabling.\n"); dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
if (gma_encoder->ddc_bus) if (gma_encoder->ddc_bus)
psb_intel_i2c_destroy(gma_encoder->ddc_bus); psb_intel_i2c_destroy(gma_encoder->ddc_bus);
......
...@@ -777,6 +777,7 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -777,6 +777,7 @@ void psb_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);
psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter); psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter);
list_for_each_entry(scan, &connector->probed_modes, head) { list_for_each_entry(scan, &connector->probed_modes, head) {
if (scan->type & DRM_MODE_TYPE_PREFERRED) { if (scan->type & DRM_MODE_TYPE_PREFERRED) {
...@@ -827,10 +828,12 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -827,10 +828,12 @@ void psb_intel_lvds_init(struct drm_device *dev,
* actually having one. * actually having one.
*/ */
out: out:
mutex_unlock(&dev->mode_config.mutex);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return; return;
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex);
if (lvds_priv->ddc_bus) if (lvds_priv->ddc_bus)
psb_intel_i2c_destroy(lvds_priv->ddc_bus); psb_intel_i2c_destroy(lvds_priv->ddc_bus);
failed_ddc: failed_ddc:
......
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