diff mbox

[RESEND,15/20] drm/exynos: drop struct_mutex from exynos_drm_gem_get_ioctl

Message ID 1447951610-12622-16-git-send-email-daniel.vetter@ffwll.ch
State New, archived
Headers show

Commit Message

Daniel Vetter Nov. 19, 2015, 4:46 p.m. UTC
The only things this protects is reading ->flags and ->size, both of
which are invariant over the lifetime of an exynos gem bo. So no
locking needed at all (besides that, nothing protects the writers
anyway).

Aside: exynos_gem_obj->size is redundant with
exynos_gem_obj->base.size and probably should be removed.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Daniel Stone Nov. 19, 2015, 4:50 p.m. UTC | #1
Hi,

On 19 November 2015 at 16:46, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> @@ -367,7 +364,6 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
>         args->size = exynos_gem->size;
>
>         drm_gem_object_unreference(obj);
> -       mutex_unlock(&dev->struct_mutex);

drm_gem_object_unreference_unlocked, surely ...

Cheers,
Daniel
Daniel Vetter Nov. 19, 2015, 4:59 p.m. UTC | #2
On Thu, Nov 19, 2015 at 04:50:11PM +0000, Daniel Stone wrote:
> Hi,
> 
> On 19 November 2015 at 16:46, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > @@ -367,7 +364,6 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
> >         args->size = exynos_gem->size;
> >
> >         drm_gem_object_unreference(obj);
> > -       mutex_unlock(&dev->struct_mutex);
> 
> drm_gem_object_unreference_unlocked, surely ...

Yeah, and then I go and do a grep for this and spot piles more offenders.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index a3286a1ec2b1..dfb3bfee1b63 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -352,12 +352,9 @@  int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
 	struct drm_exynos_gem_info *args = data;
 	struct drm_gem_object *obj;
 
-	mutex_lock(&dev->struct_mutex);
-
 	obj = drm_gem_object_lookup(dev, file_priv, args->handle);
 	if (!obj) {
 		DRM_ERROR("failed to lookup gem object.\n");
-		mutex_unlock(&dev->struct_mutex);
 		return -EINVAL;
 	}
 
@@ -367,7 +364,6 @@  int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
 	args->size = exynos_gem->size;
 
 	drm_gem_object_unreference(obj);
-	mutex_unlock(&dev->struct_mutex);
 
 	return 0;
 }