[14/25] drm/gma500: Drop dev->struct_mutex from fbdev init/teardown code
diff mbox

Message ID 1444894601-5200-15-git-send-email-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Oct. 15, 2015, 7:36 a.m. UTC
This is init/teardown code, locking is just to appease locking checks.
And since gem create/free doesn't need this any more there's really no
reason for grabbing dev->struct_mutex.

Again important to switch obj_unref to _unlocked variants.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/gma500/framebuffer.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Patrik Jakobsson Oct. 15, 2015, 1:24 p.m. UTC | #1
On Thu, Oct 15, 2015 at 9:36 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> This is init/teardown code, locking is just to appease locking checks.
> And since gem create/free doesn't need this any more there's really no
> reason for grabbing dev->struct_mutex.
>
> Again important to switch obj_unref to _unlocked variants.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>

> ---
>  drivers/gpu/drm/gma500/framebuffer.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> index 2eaf1b31c7bd..c7904fc3d33b 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -406,8 +406,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
>
>         memset(dev_priv->vram_addr + backing->offset, 0, size);
>
> -       mutex_lock(&dev->struct_mutex);
> -
>         info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper);
>         if (IS_ERR(info)) {
>                 ret = PTR_ERR(info);
> @@ -463,17 +461,15 @@ static int psbfb_create(struct psb_fbdev *fbdev,
>         dev_dbg(dev->dev, "allocated %dx%d fb\n",
>                                         psbfb->base.width, psbfb->base.height);
>
> -       mutex_unlock(&dev->struct_mutex);
>         return 0;
>  out_unref:
>         if (backing->stolen)
>                 psb_gtt_free_range(dev, backing);
>         else
> -               drm_gem_object_unreference(&backing->gem);
> +               drm_gem_object_unreference_unlocked(&backing->gem);
>
>         drm_fb_helper_release_fbi(&fbdev->psb_fb_helper);
>  out_err1:
> -       mutex_unlock(&dev->struct_mutex);
>         psb_gtt_free_range(dev, backing);
>         return ret;
>  }
> @@ -569,7 +565,7 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
>         drm_framebuffer_cleanup(&psbfb->base);
>
>         if (psbfb->gtt)
> -               drm_gem_object_unreference(&psbfb->gtt->gem);
> +               drm_gem_object_unreference_unlocked(&psbfb->gtt->gem);
>         return 0;
>  }
>
> @@ -784,12 +780,8 @@ void psb_modeset_cleanup(struct drm_device *dev)
>  {
>         struct drm_psb_private *dev_priv = dev->dev_private;
>         if (dev_priv->modeset) {
> -               mutex_lock(&dev->struct_mutex);
> -
>                 drm_kms_helper_poll_fini(dev);
>                 psb_fbdev_fini(dev);
>                 drm_mode_config_cleanup(dev);
> -
> -               mutex_unlock(&dev->struct_mutex);
>         }
>  }
> --
> 2.5.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 2eaf1b31c7bd..c7904fc3d33b 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -406,8 +406,6 @@  static int psbfb_create(struct psb_fbdev *fbdev,
 
 	memset(dev_priv->vram_addr + backing->offset, 0, size);
 
-	mutex_lock(&dev->struct_mutex);
-
 	info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper);
 	if (IS_ERR(info)) {
 		ret = PTR_ERR(info);
@@ -463,17 +461,15 @@  static int psbfb_create(struct psb_fbdev *fbdev,
 	dev_dbg(dev->dev, "allocated %dx%d fb\n",
 					psbfb->base.width, psbfb->base.height);
 
-	mutex_unlock(&dev->struct_mutex);
 	return 0;
 out_unref:
 	if (backing->stolen)
 		psb_gtt_free_range(dev, backing);
 	else
-		drm_gem_object_unreference(&backing->gem);
+		drm_gem_object_unreference_unlocked(&backing->gem);
 
 	drm_fb_helper_release_fbi(&fbdev->psb_fb_helper);
 out_err1:
-	mutex_unlock(&dev->struct_mutex);
 	psb_gtt_free_range(dev, backing);
 	return ret;
 }
@@ -569,7 +565,7 @@  static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
 	drm_framebuffer_cleanup(&psbfb->base);
 
 	if (psbfb->gtt)
-		drm_gem_object_unreference(&psbfb->gtt->gem);
+		drm_gem_object_unreference_unlocked(&psbfb->gtt->gem);
 	return 0;
 }
 
@@ -784,12 +780,8 @@  void psb_modeset_cleanup(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	if (dev_priv->modeset) {
-		mutex_lock(&dev->struct_mutex);
-
 		drm_kms_helper_poll_fini(dev);
 		psb_fbdev_fini(dev);
 		drm_mode_config_cleanup(dev);
-
-		mutex_unlock(&dev->struct_mutex);
 	}
 }