[12/18] drm/nouveau: Don't take dev->struct_mutex in fbcon init
diff mbox

Message ID 1436477570-4936-13-git-send-email-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter July 9, 2015, 9:32 p.m. UTC
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@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Thierry Reding Aug. 10, 2015, 10:59 a.m. UTC | #1
On Thu, Jul 09, 2015 at 11:32:44PM +0200, Daniel Vetter wrote:
> 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@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_fbcon.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)


Reviewed-by: Thierry Reding <treding@nvidia.com>

Patch
diff mbox

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);