summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_overlay.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2011-06-27 16:18:20 -0700
committerKeith Packard <keithp@keithp.com>2011-06-27 17:00:35 -0700
commit1e5216e43846b7758b2a04b3612c475608a4b708 (patch)
tree266881071ef862ebc4aaaf008591354b4ebfefa9 /drivers/gpu/drm/i915/intel_overlay.c
parent8bc47de33569a111092a48465eb26cd855117e27 (diff)
downloadlinux-1e5216e43846b7758b2a04b3612c475608a4b708.tar.gz
linux-1e5216e43846b7758b2a04b3612c475608a4b708.tar.xz
linux-1e5216e43846b7758b2a04b3612c475608a4b708.zip
drm/i915: more struct_mutex locking
When auditing the locking in i915_gem.c (for a prospective change which I then abandoned), I noticed two places where struct_mutex is not held across GEM object manipulations that would usually require it. Since one is in initial setup and the other in driver unload, I'm guessing the mutex is not required for either; but post a patch in case it is. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Keith Packard <keithp@keithp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_overlay.c')
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index fcf6fcb0b482..cffd3edd9bb4 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1412,6 +1412,8 @@ void intel_setup_overlay(struct drm_device *dev)
goto out_free;
overlay->reg_bo = reg_bo;
+ mutex_lock(&dev->struct_mutex);
+
if (OVERLAY_NEEDS_PHYSICAL(dev)) {
ret = i915_gem_attach_phys_object(dev, reg_bo,
I915_GEM_PHYS_OVERLAY_REGS,
@@ -1436,6 +1438,8 @@ void intel_setup_overlay(struct drm_device *dev)
}
}
+ mutex_unlock(&dev->struct_mutex);
+
/* init all values */
overlay->color_key = 0x0101fe;
overlay->brightness = -19;
@@ -1460,6 +1464,7 @@ out_unpin_bo:
i915_gem_object_unpin(reg_bo);
out_free_bo:
drm_gem_object_unreference(&reg_bo->base);
+ mutex_unlock(&dev->struct_mutex);
out_free:
kfree(overlay);
return;