Skip to content

Commit

Permalink
drm: rename, adjust and export drm_atomic_replace_property_blob
Browse files Browse the repository at this point in the history
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
  • Loading branch information
peda-r authored and danvet committed Jul 14, 2017
1 parent e38e128 commit 5f057ff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
30 changes: 1 addition & 29 deletions drivers/gpu/drm/drm_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,34 +411,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
}
EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);

/**
* drm_atomic_replace_property_blob - replace a blob property
* @blob: a pointer to the member blob to be replaced
* @new_blob: the new blob to replace with
* @replaced: whether the blob has been replaced
*
* RETURNS:
* Zero on success, error code on failure
*/
static void
drm_atomic_replace_property_blob(struct drm_property_blob **blob,
struct drm_property_blob *new_blob,
bool *replaced)
{
struct drm_property_blob *old_blob = *blob;

if (old_blob == new_blob)
return;

drm_property_blob_put(old_blob);
if (new_blob)
drm_property_blob_get(new_blob);
*blob = new_blob;
*replaced = true;

return;
}

static int
drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
struct drm_property_blob **blob,
Expand All @@ -459,7 +431,7 @@ drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
}
}

drm_atomic_replace_property_blob(blob, new_blob, replaced);
*replaced |= drm_property_replace_blob(blob, new_blob);
drm_property_blob_put(new_blob);

return 0;
Expand Down
23 changes: 23 additions & 0 deletions drivers/gpu/drm/drm_property.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,29 @@ int drm_property_replace_global_blob(struct drm_device *dev,
}
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)
{
Expand Down
2 changes: 2 additions & 0 deletions include/drm/drm_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ int drm_property_replace_global_blob(struct drm_device *dev,
const void *data,
struct drm_mode_object *obj_holds_id,
struct drm_property *prop_holds_id);
bool drm_property_replace_blob(struct drm_property_blob **blob,
struct drm_property_blob *new_blob);
struct drm_property_blob *drm_property_blob_get(struct drm_property_blob *blob);
void drm_property_blob_put(struct drm_property_blob *blob);

Expand Down

0 comments on commit 5f057ff

Please sign in to comment.