diff mbox

[13/25] drm/gma500: Drop dev->struct_mutex from modeset code

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

Commit Message

Daniel Vetter Oct. 15, 2015, 7:36 a.m. UTC
It's either init code or already protected by other means. Note
that psb_gtt_pin/unpin has it's own lock, and that's really the
only piece of driver private state - all the modeset state is
protected with modeset locks already.

The only important bit is to switch all gem_obj_unref calls to the
_unlocked variant.

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

Comments

Patrik Jakobsson Oct. 15, 2015, 1:07 p.m. UTC | #1
On Thu, Oct 15, 2015 at 9:36 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> It's either init code or already protected by other means. Note
> that psb_gtt_pin/unpin has it's own lock, and that's really the
> only piece of driver private state - all the modeset state is
> protected with modeset locks already.
>
> The only important bit is to switch all gem_obj_unref calls to the
> _unlocked variant.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

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

> ---
>  drivers/gpu/drm/gma500/gma_display.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
> index 001b450b27b3..ff17af4cfc64 100644
> --- a/drivers/gpu/drm/gma500/gma_display.c
> +++ b/drivers/gpu/drm/gma500/gma_display.c
> @@ -349,8 +349,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
>         /* If we didn't get a handle then turn the cursor off */
>         if (!handle) {
>                 temp = CURSOR_MODE_DISABLE;
> -               mutex_lock(&dev->struct_mutex);
> -
>                 if (gma_power_begin(dev, false)) {
>                         REG_WRITE(control, temp);
>                         REG_WRITE(base, 0);
> @@ -362,11 +360,9 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
>                         gt = container_of(gma_crtc->cursor_obj,
>                                           struct gtt_range, gem);
>                         psb_gtt_unpin(gt);
> -                       drm_gem_object_unreference(gma_crtc->cursor_obj);
> +                       drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
>                         gma_crtc->cursor_obj = NULL;
>                 }
> -
> -               mutex_unlock(&dev->struct_mutex);
>                 return 0;
>         }
>
> @@ -376,7 +372,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
>                 return -EINVAL;
>         }
>
> -       mutex_lock(&dev->struct_mutex);
>         obj = drm_gem_object_lookup(dev, file_priv, handle);
>         if (!obj) {
>                 ret = -ENOENT;
> @@ -441,17 +436,15 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
>         if (gma_crtc->cursor_obj) {
>                 gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
>                 psb_gtt_unpin(gt);
> -               drm_gem_object_unreference(gma_crtc->cursor_obj);
> +               drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
>         }
>
>         gma_crtc->cursor_obj = obj;
>  unlock:
> -       mutex_unlock(&dev->struct_mutex);
>         return ret;
>
>  unref_cursor:
> -       drm_gem_object_unreference(obj);
> -       mutex_unlock(&dev->struct_mutex);
> +       drm_gem_object_unreference_unlocked(obj);
>         return ret;
>  }
>
> --
> 2.5.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index 001b450b27b3..ff17af4cfc64 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -349,8 +349,6 @@  int gma_crtc_cursor_set(struct drm_crtc *crtc,
 	/* If we didn't get a handle then turn the cursor off */
 	if (!handle) {
 		temp = CURSOR_MODE_DISABLE;
-		mutex_lock(&dev->struct_mutex);
-
 		if (gma_power_begin(dev, false)) {
 			REG_WRITE(control, temp);
 			REG_WRITE(base, 0);
@@ -362,11 +360,9 @@  int gma_crtc_cursor_set(struct drm_crtc *crtc,
 			gt = container_of(gma_crtc->cursor_obj,
 					  struct gtt_range, gem);
 			psb_gtt_unpin(gt);
-			drm_gem_object_unreference(gma_crtc->cursor_obj);
+			drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
 			gma_crtc->cursor_obj = NULL;
 		}
-
-		mutex_unlock(&dev->struct_mutex);
 		return 0;
 	}
 
@@ -376,7 +372,6 @@  int gma_crtc_cursor_set(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
-	mutex_lock(&dev->struct_mutex);
 	obj = drm_gem_object_lookup(dev, file_priv, handle);
 	if (!obj) {
 		ret = -ENOENT;
@@ -441,17 +436,15 @@  int gma_crtc_cursor_set(struct drm_crtc *crtc,
 	if (gma_crtc->cursor_obj) {
 		gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
 		psb_gtt_unpin(gt);
-		drm_gem_object_unreference(gma_crtc->cursor_obj);
+		drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
 	}
 
 	gma_crtc->cursor_obj = obj;
 unlock:
-	mutex_unlock(&dev->struct_mutex);
 	return ret;
 
 unref_cursor:
-	drm_gem_object_unreference(obj);
-	mutex_unlock(&dev->struct_mutex);
+	drm_gem_object_unreference_unlocked(obj);
 	return ret;
 }