[Intel-gfx] [PATCH 12/18] drm/nouveau: Don't take dev->struct_mutex in fbcon init

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 9 14:32:44 PDT 2015


It doesn't protect anything at all. fbdev helper state is all
protected by modeset locks, and nouveau bo state is taken care of by
ttm. There's also nothing else grabbing struct_mutex that might need
to coordinate with this code. Also this is driver load code, no one
can get at the device yet anyway so locking is fairly futile.
There's also no drm_gem_object_unreference that would now suddenly
need the _unlocked variant.

Cc: Ben Skeggs <bskeggs at redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 6751553abe4a..89691ee48277 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -363,12 +363,10 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 		}
 	}
 
-	mutex_lock(&dev->struct_mutex);
-
 	info = framebuffer_alloc(0, &pdev->dev);
 	if (!info) {
 		ret = -ENOMEM;
-		goto out_unlock;
+		goto out_unmap;
 	}
 	info->skip_vt_switch = 1;
 
@@ -376,7 +374,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 	if (ret) {
 		ret = -ENOMEM;
 		framebuffer_release(info);
-		goto out_unlock;
+		goto out_unmap;
 	}
 
 	info->par = fbcon;
@@ -411,8 +409,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 
 	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
 
-	mutex_unlock(&dev->struct_mutex);
-
 	if (chan)
 		nouveau_fbcon_accel_init(dev);
 	nouveau_fbcon_zfill(dev, fbcon);
@@ -425,8 +421,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 	vga_switcheroo_client_fb_set(dev->pdev, info);
 	return 0;
 
-out_unlock:
-	mutex_unlock(&dev->struct_mutex);
+out_unmap:
 	if (chan)
 		nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma);
 	nouveau_bo_unmap(nvbo);
-- 
2.1.4



More information about the Intel-gfx mailing list