summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_property.c
diff options
context:
space:
mode:
authorPeter Rosin <peda@axentia.se>2017-07-13 18:25:25 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-07-14 15:53:06 +0200
commit5f057ffd6da26c939dff976a2acc76233bbe4467 (patch)
tree34c3a556a7719a4518f050558cc3f5908d4da1b1 /drivers/gpu/drm/drm_property.c
parentdrm/dp/mst: Use memchr_inv() instead of memcmp() against a zeroed array (diff)
downloadlinux-5f057ffd6da26c939dff976a2acc76233bbe4467.tar.xz
linux-5f057ffd6da26c939dff976a2acc76233bbe4467.zip
drm: rename, adjust and export drm_atomic_replace_property_blob
The function has little to do with atomic, it's just where it has so far been needed. So, rename it to drm_property_replace_blob, move it to drm_property.c and export it. Change the semantics to return whether the blob was replaced instead of using an extra argument for that. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170713162538.22788-2-peda@axentia.se
Diffstat (limited to 'drivers/gpu/drm/drm_property.c')
-rw-r--r--drivers/gpu/drm/drm_property.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 3e88fa24eab3..bc5128203056 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -709,6 +709,29 @@ err_created:
}
EXPORT_SYMBOL(drm_property_replace_global_blob);
+/**
+ * drm_property_replace_blob - replace a blob property
+ * @blob: a pointer to the member blob to be replaced
+ * @new_blob: the new blob to replace with
+ *
+ * Return: true if the blob was in fact replaced.
+ */
+bool drm_property_replace_blob(struct drm_property_blob **blob,
+ struct drm_property_blob *new_blob)
+{
+ struct drm_property_blob *old_blob = *blob;
+
+ if (old_blob == new_blob)
+ return false;
+
+ drm_property_blob_put(old_blob);
+ if (new_blob)
+ drm_property_blob_get(new_blob);
+ *blob = new_blob;
+ return true;
+}
+EXPORT_SYMBOL(drm_property_replace_blob);
+
int drm_mode_getblob_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{