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 <bske...@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vet...@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to