summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-05-22 15:34:49 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-22 17:18:21 +0300
commit99531d9bb76c649df15311c717deefdff7cc5b7b (patch)
treec9d5451cf8038c831fee928eb92af8e280b3420d /drivers/gpu/drm/drm_crtc.c
parent934a8a899a7275ed187810fe9a15a93397e88c6b (diff)
downloadlinux-99531d9bb76c649df15311c717deefdff7cc5b7b.tar.xz
drm: Allow creating blob properties without copy
Make the data parameter to drm_property_create_blob optional; if omitted, the copy will be skipped and the data will be empty. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com> Tested-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f6b0332aad7f..0844108e19e0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4145,6 +4145,16 @@ done:
return ret;
}
+/**
+ * drm_property_create_blob - Create new blob property
+ *
+ * Creates a new blob property for a specified DRM device, optionally
+ * copying data.
+ *
+ * @dev: DRM device to create property for
+ * @length: Length to allocate for blob data
+ * @data: If specified, copies data into blob
+ */
struct drm_property_blob *
drm_property_create_blob(struct drm_device *dev, size_t length,
const void *data)
@@ -4152,7 +4162,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
struct drm_property_blob *blob;
int ret;
- if (!length || !data)
+ if (!length)
return NULL;
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
@@ -4162,7 +4172,8 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
blob->length = length;
blob->dev = dev;
- memcpy(blob->data, data, length);
+ if (data)
+ memcpy(blob->data, data, length);
mutex_lock(&dev->mode_config.blob_lock);