Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c3cf375 authored by Haneen Mohammed's avatar Haneen Mohammed Committed by Sean Paul
Browse files

drm/armada: Replace drm_gem_object_reference/unreference() with _get/put()



This patch replace instances of drm_gem_object_reference/unreference with
*_get/put() suffixes, because get/put is shorter and consistent with the
kernel use of *_get/put() suffixes.
This was done with the following Coccinelle script:

@r1@
expression e;
@@

(
-drm_gem_object_reference(e);
+drm_gem_object_get(e);
|
-drm_gem_object_unreference(e);
+drm_gem_object_put(e);
|
-drm_gem_object_unreference_unlocked(e);
+drm_gem_object_put_unlocked(e);
)

Signed-off-by: default avatarHaneen Mohammed <hamohammed.sa@gmail.com>
[resolved small conflict with removed armada_gem_dumb_map_offset]
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/a59ef1ed109ade897bcffcb01b33214262db8942.1505932812.git.hamohammed.sa@gmail.com
parent e0ad7c0f
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,


		/* Must be a kernel-mapped object */
		/* Must be a kernel-mapped object */
		if (!obj->addr) {
		if (!obj->addr) {
			drm_gem_object_unreference_unlocked(&obj->obj);
			drm_gem_object_put_unlocked(&obj->obj);
			return -EINVAL;
			return -EINVAL;
		}
		}


		if (obj->obj.size < w * h * 4) {
		if (obj->obj.size < w * h * 4) {
			DRM_ERROR("buffer is too small\n");
			DRM_ERROR("buffer is too small\n");
			drm_gem_object_unreference_unlocked(&obj->obj);
			drm_gem_object_put_unlocked(&obj->obj);
			return -ENOMEM;
			return -ENOMEM;
		}
		}
	}
	}
@@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
	if (dcrtc->cursor_obj) {
	if (dcrtc->cursor_obj) {
		dcrtc->cursor_obj->update = NULL;
		dcrtc->cursor_obj->update = NULL;
		dcrtc->cursor_obj->update_data = NULL;
		dcrtc->cursor_obj->update_data = NULL;
		drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
		drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
	}
	}
	dcrtc->cursor_obj = obj;
	dcrtc->cursor_obj = obj;
	dcrtc->cursor_w = w;
	dcrtc->cursor_w = w;
@@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
	struct armada_private *priv = crtc->dev->dev_private;
	struct armada_private *priv = crtc->dev->dev_private;


	if (dcrtc->cursor_obj)
	if (dcrtc->cursor_obj)
		drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
		drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);


	priv->dcrtc[dcrtc->num] = NULL;
	priv->dcrtc[dcrtc->num] = NULL;
	drm_crtc_cleanup(&dcrtc->crtc);
	drm_crtc_cleanup(&dcrtc->crtc);
+4 −4
Original line number Original line Diff line number Diff line
@@ -17,7 +17,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb)
	struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb);
	struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb);


	drm_framebuffer_cleanup(&dfb->fb);
	drm_framebuffer_cleanup(&dfb->fb);
	drm_gem_object_unreference_unlocked(&dfb->obj->obj);
	drm_gem_object_put_unlocked(&dfb->obj->obj);
	kfree(dfb);
	kfree(dfb);
}
}


@@ -94,7 +94,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
	 * the above call, but the caller will drop their reference
	 * the above call, but the caller will drop their reference
	 * to it.  Hence we need to take our own reference.
	 * to it.  Hence we need to take our own reference.
	 */
	 */
	drm_gem_object_reference(&obj->obj);
	drm_gem_object_get(&obj->obj);


	return dfb;
	return dfb;
}
}
@@ -143,12 +143,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
		goto err;
		goto err;
	}
	}


	drm_gem_object_unreference_unlocked(&obj->obj);
	drm_gem_object_put_unlocked(&obj->obj);


	return &dfb->fb;
	return &dfb->fb;


 err_unref:
 err_unref:
	drm_gem_object_unreference_unlocked(&obj->obj);
	drm_gem_object_put_unlocked(&obj->obj);
 err:
 err:
	DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
	DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
	return ERR_PTR(ret);
	return ERR_PTR(ret);
+3 −3
Original line number Original line Diff line number Diff line
@@ -51,13 +51,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh,


	ret = armada_gem_linear_back(dev, obj);
	ret = armada_gem_linear_back(dev, obj);
	if (ret) {
	if (ret) {
		drm_gem_object_unreference_unlocked(&obj->obj);
		drm_gem_object_put_unlocked(&obj->obj);
		return ret;
		return ret;
	}
	}


	ptr = armada_gem_map_object(dev, obj);
	ptr = armada_gem_map_object(dev, obj);
	if (!ptr) {
	if (!ptr) {
		drm_gem_object_unreference_unlocked(&obj->obj);
		drm_gem_object_put_unlocked(&obj->obj);
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -67,7 +67,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
	 * A reference is now held by the framebuffer object if
	 * A reference is now held by the framebuffer object if
	 * successful, otherwise this drops the ref for the error path.
	 * successful, otherwise this drops the ref for the error path.
	 */
	 */
	drm_gem_object_unreference_unlocked(&obj->obj);
	drm_gem_object_put_unlocked(&obj->obj);


	if (IS_ERR(dfb))
	if (IS_ERR(dfb))
		return PTR_ERR(dfb);
		return PTR_ERR(dfb);
+6 −6
Original line number Original line Diff line number Diff line
@@ -265,7 +265,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
	/* drop reference from allocate - handle holds it now */
	/* drop reference from allocate - handle holds it now */
	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
 err:
 err:
	drm_gem_object_unreference_unlocked(&dobj->obj);
	drm_gem_object_put_unlocked(&dobj->obj);
	return ret;
	return ret;
}
}


@@ -297,7 +297,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data,
	/* drop reference from allocate - handle holds it now */
	/* drop reference from allocate - handle holds it now */
	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
 err:
 err:
	drm_gem_object_unreference_unlocked(&dobj->obj);
	drm_gem_object_put_unlocked(&dobj->obj);
	return ret;
	return ret;
}
}


@@ -314,13 +314,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data,
		return -ENOENT;
		return -ENOENT;


	if (!dobj->obj.filp) {
	if (!dobj->obj.filp) {
		drm_gem_object_unreference_unlocked(&dobj->obj);
		drm_gem_object_put_unlocked(&dobj->obj);
		return -EINVAL;
		return -EINVAL;
	}
	}


	addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE,
	addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE,
		       MAP_SHARED, args->offset);
		       MAP_SHARED, args->offset);
	drm_gem_object_unreference_unlocked(&dobj->obj);
	drm_gem_object_put_unlocked(&dobj->obj);
	if (IS_ERR_VALUE(addr))
	if (IS_ERR_VALUE(addr))
		return addr;
		return addr;


@@ -375,7 +375,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
	}
	}


 unref:
 unref:
	drm_gem_object_unreference_unlocked(&dobj->obj);
	drm_gem_object_put_unlocked(&dobj->obj);
	return ret;
	return ret;
}
}


@@ -524,7 +524,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf)
			 * Importing our own dmabuf(s) increases the
			 * Importing our own dmabuf(s) increases the
			 * refcount on the gem object itself.
			 * refcount on the gem object itself.
			 */
			 */
			drm_gem_object_reference(obj);
			drm_gem_object_get(obj);
			return obj;
			return obj;
		}
		}
	}
	}