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

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>

authored by

Daniel Vetter and committed by
Dave Airlie
c46145ae 060c8778

+11
+3
drivers/gpu/drm/gma500/cdv_intel_lvds.c
··· 712 712 * Attempt to get the fixed panel mode from DDC. Assume that the 713 713 * preferred mode is the right one. 714 714 */ 715 + mutex_lock(&dev->mode_config.mutex); 715 716 psb_intel_ddc_get_modes(connector, 716 717 &gma_encoder->ddc_bus->adapter); 717 718 list_for_each_entry(scan, &connector->probed_modes, head) { ··· 773 772 } 774 773 775 774 out: 775 + mutex_unlock(&dev->mode_config.mutex); 776 776 drm_sysfs_connector_add(connector); 777 777 return; 778 778 779 779 failed_find: 780 + mutex_unlock(&dev->mode_config.mutex); 780 781 printk(KERN_ERR "Failed find\n"); 781 782 if (gma_encoder->ddc_bus) 782 783 psb_intel_i2c_destroy(gma_encoder->ddc_bus);
+5
drivers/gpu/drm/gma500/oaktrail_lvds.c
··· 359 359 * if closed, act like it's not there for now 360 360 */ 361 361 362 + mutex_lock(&dev->mode_config.mutex); 362 363 i2c_adap = i2c_get_adapter(dev_priv->ops->i2c_bus); 363 364 if (i2c_adap == NULL) 364 365 dev_err(dev->dev, "No ddc adapter available!\n"); ··· 402 401 } 403 402 404 403 out: 404 + mutex_unlock(&dev->mode_config.mutex); 405 + 405 406 drm_sysfs_connector_add(connector); 406 407 return; 407 408 408 409 failed_find: 410 + mutex_unlock(&dev->mode_config.mutex); 411 + 409 412 dev_dbg(dev->dev, "No LVDS modes found, disabling.\n"); 410 413 if (gma_encoder->ddc_bus) 411 414 psb_intel_i2c_destroy(gma_encoder->ddc_bus);
+3
drivers/gpu/drm/gma500/psb_intel_lvds.c
··· 777 777 * Attempt to get the fixed panel mode from DDC. Assume that the 778 778 * preferred mode is the right one. 779 779 */ 780 + mutex_lock(&dev->mode_config.mutex); 780 781 psb_intel_ddc_get_modes(connector, &lvds_priv->ddc_bus->adapter); 781 782 list_for_each_entry(scan, &connector->probed_modes, head) { 782 783 if (scan->type & DRM_MODE_TYPE_PREFERRED) { ··· 828 827 * actually having one. 829 828 */ 830 829 out: 830 + mutex_unlock(&dev->mode_config.mutex); 831 831 drm_sysfs_connector_add(connector); 832 832 return; 833 833 834 834 failed_find: 835 + mutex_unlock(&dev->mode_config.mutex); 835 836 if (lvds_priv->ddc_bus) 836 837 psb_intel_i2c_destroy(lvds_priv->ddc_bus); 837 838 failed_ddc: