aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-21 18:22:36 -0400
committerDave Airlie <airlied@redhat.com>2014-03-23 17:54:30 -0400
commitc46145aee10d6df7484d14a23161e5b71bd2b56b (patch)
tree02664b58a67c323e06a7fb71d765622e6518e448
parent060c877848b8a0a44d7ba32ff3a53982a6e907f7 (diff)
drm/gma500: add locking to fixed panel edid probing
With the recent addition of locking checks in commit 62ff94a5492175759546f8bc61383189d6b49122 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: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_lvds.c3
-rw-r--r--drivers/gpu/drm/gma500/oaktrail_lvds.c5
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_lvds.c3
3 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 20e08e65d46c..66a41c026834 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -712,6 +712,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
712 * Attempt to get the fixed panel mode from DDC. Assume that the 712 * Attempt to get the fixed panel mode from DDC. Assume that the
713 * preferred mode is the right one. 713 * preferred mode is the right one.
714 */ 714 */
715 mutex_lock(&dev->mode_config.mutex);
715 psb_intel_ddc_get_modes(connector, 716 psb_intel_ddc_get_modes(connector,
716 &gma_encoder->ddc_bus->adapter); 717 &gma_encoder->ddc_bus->adapter);
717 list_for_each_entry(scan, &connector->probed_modes, head) { 718 list_for_each_entry(scan, &connector->probed_modes, head) {
@@ -772,10 +773,12 @@ void cdv_intel_lvds_init(struct drm_device *dev,
772 } 773 }
773 774
774out: 775out:
776 mutex_unlock(&dev->mode_config.mutex);
775 drm_sysfs_connector_add(connector); 777 drm_sysfs_connector_add(connector);
776 return; 778 return;
777 779
778failed_find: 780failed_find:
781 mutex_unlock(&dev->mode_config.mutex);
779 printk(KERN_ERR "Failed find\n"); 782 printk(KERN_ERR "Failed find\n");
780 if (gma_encoder->ddc_bus) 783 if (gma_encoder->ddc_bus)
781 psb_intel_i2c_destroy(gma_encoder->ddc_bus); 784 psb_intel_i2c_destroy(gma_encoder->ddc_bus);
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 5e0697862736..9b099468a5db 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -359,6 +359,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
359 * if closed, act like it's not there for now 359 * if closed, act like it's not there for now
360 */ 360 */
361 361
362 mutex_lock(&dev->mode_config.mutex);
362 i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus); 363 i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus);
363 if (i2c_adap == NULL) 364 if (i2c_adap == NULL)
364 dev_err(dev->dev, "No ddc adapter available!\n"); 365 dev_err(dev->dev, "No ddc adapter available!\n");
@@ -401,10 +402,14 @@ void oaktrail_lvds_init(struct drm_device *dev,
401 } 402 }
402 403
403out: 404out:
405 mutex_unlock(&dev->mode_config.mutex);
406
404 drm_sysfs_connector_add(connector); 407 drm_sysfs_connector_add(connector);
405 return; 408 return;
406 409
407failed_find: 410failed_find:
411 mutex_unlock(&dev->mode_config.mutex);
412
408 dev_dbg(dev->dev, "No LVDS modes found, disabling.\n"); 413 dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
409 if (gma_encoder->ddc_bus) 414 if (gma_encoder->ddc_bus)
410 psb_intel_i2c_destroy(gma_encoder->ddc_bus); 415 psb_intel_i2c_destroy(gma_encoder->ddc_bus);
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 32342f6990d9..891a028a0826 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -777,6 +777,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
777 * Attempt to get the fixed panel mode from DDC. Assume that the 777 * Attempt to get the fixed panel mode from DDC. Assume that the
778 * preferred mode is the right one. 778 * preferred mode is the right one.
779 */ 779 */
780 mutex_lock(&dev->mode_config.mutex);
780 psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter); 781 psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter);
781 list_for_each_entry(scan, &connector->probed_modes, head) { 782 list_for_each_entry(scan, &connector->probed_modes, head) {
782 if (scan->type & DRM_MODE_TYPE_PREFERRED) { 783 if (scan->type & DRM_MODE_TYPE_PREFERRED) {
@@ -827,10 +828,12 @@ void psb_intel_lvds_init(struct drm_device *dev,
827 * actually having one. 828 * actually having one.
828 */ 829 */
829out: 830out:
831 mutex_unlock(&dev->mode_config.mutex);
830 drm_sysfs_connector_add(connector); 832 drm_sysfs_connector_add(connector);
831 return; 833 return;
832 834
833failed_find: 835failed_find:
836 mutex_unlock(&dev->mode_config.mutex);
834 if (lvds_priv->ddc_bus) 837 if (lvds_priv->ddc_bus)
835 psb_intel_i2c_destroy(lvds_priv->ddc_bus); 838 psb_intel_i2c_destroy(lvds_priv->ddc_bus);
836failed_ddc: 839failed_ddc: