From c7089ecf3227064183404d2941af20d5981d5635 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Wed, 15 Feb 2012 15:02:52 +0200 Subject: [PATCH] gfx: drv: Warn if mode_config.mutex is not locked in GTT code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The GTT ref counting relies on mode_config.mutex for protection. Print a warning if the code is called without holding the mutex. Signed-off-by: Ville Syrjälä Reviewed-by: Imre Deak Signed-off-by: Kirill A. Shutemov --- drivers/staging/mrst/drv/psb_gtt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/mrst/drv/psb_gtt.c b/drivers/staging/mrst/drv/psb_gtt.c index 9610f7a..2025c9e 100644 --- a/drivers/staging/mrst/drv/psb_gtt.c +++ b/drivers/staging/mrst/drv/psb_gtt.c @@ -897,6 +897,8 @@ int psb_gtt_map_meminfo(struct drm_device *dev, { struct psb_gtt_mem_mapping *mapping; + WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); + /* check if memory is already mapped */ mapping = psb_gtt_find_mapping_for_key(dev, psb_get_tgid(), (u32) psKernelMemInfo); @@ -940,6 +942,8 @@ int psb_gtt_unmap_meminfo(struct drm_device *dev, { struct psb_gtt_mem_mapping *mapping; + WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); + mapping = psb_gtt_find_mapping_for_key(dev, tgid, (u32) psKernelMemInfo); if (IS_ERR(mapping)) { -- 2.7.4