Skip to content

Commit

Permalink
drm: Allow creating blob properties without copy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Stone authored and Daniel Vetter committed May 22, 2015
1 parent 934a8a8 commit 99531d9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4145,14 +4145,24 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
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)
{
struct drm_property_blob *blob;
int ret;

if (!length || !data)
if (!length)
return NULL;

blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
Expand All @@ -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);

Expand Down

0 comments on commit 99531d9

Please sign in to comment.