Skip to content

Commit 5f057ff

Browse files
peda-rdanvet
authored andcommitted
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
1 parent e38e128 commit 5f057ff

3 files changed

Lines changed: 26 additions & 29 deletions

File tree

‎drivers/gpu/drm/drm_atomic.c‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -411,34 +411,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
411411
}
412412
EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
413413

414-
/**
415-
* drm_atomic_replace_property_blob - replace a blob property
416-
* @blob: a pointer to the member blob to be replaced
417-
* @new_blob: the new blob to replace with
418-
* @replaced: whether the blob has been replaced
419-
*
420-
* RETURNS:
421-
* Zero on success, error code on failure
422-
*/
423-
static void
424-
drm_atomic_replace_property_blob(struct drm_property_blob **blob,
425-
struct drm_property_blob *new_blob,
426-
bool *replaced)
427-
{
428-
struct drm_property_blob *old_blob = *blob;
429-
430-
if (old_blob == new_blob)
431-
return;
432-
433-
drm_property_blob_put(old_blob);
434-
if (new_blob)
435-
drm_property_blob_get(new_blob);
436-
*blob = new_blob;
437-
*replaced = true;
438-
439-
return;
440-
}
441-
442414
static int
443415
drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
444416
struct drm_property_blob **blob,
@@ -459,7 +431,7 @@ drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
459431
}
460432
}
461433

462-
drm_atomic_replace_property_blob(blob, new_blob, replaced);
434+
*replaced |= drm_property_replace_blob(blob, new_blob);
463435
drm_property_blob_put(new_blob);
464436

465437
return 0;

‎drivers/gpu/drm/drm_property.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,29 @@ int drm_property_replace_global_blob(struct drm_device *dev,
709709
}
710710
EXPORT_SYMBOL(drm_property_replace_global_blob);
711711

712+
/**
713+
* drm_property_replace_blob - replace a blob property
714+
* @blob: a pointer to the member blob to be replaced
715+
* @new_blob: the new blob to replace with
716+
*
717+
* Return: true if the blob was in fact replaced.
718+
*/
719+
bool drm_property_replace_blob(struct drm_property_blob **blob,
720+
struct drm_property_blob *new_blob)
721+
{
722+
struct drm_property_blob *old_blob = *blob;
723+
724+
if (old_blob == new_blob)
725+
return false;
726+
727+
drm_property_blob_put(old_blob);
728+
if (new_blob)
729+
drm_property_blob_get(new_blob);
730+
*blob = new_blob;
731+
return true;
732+
}
733+
EXPORT_SYMBOL(drm_property_replace_blob);
734+
712735
int drm_mode_getblob_ioctl(struct drm_device *dev,
713736
void *data, struct drm_file *file_priv)
714737
{

‎include/drm/drm_property.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ int drm_property_replace_global_blob(struct drm_device *dev,
273273
const void *data,
274274
struct drm_mode_object *obj_holds_id,
275275
struct drm_property *prop_holds_id);
276+
bool drm_property_replace_blob(struct drm_property_blob **blob,
277+
struct drm_property_blob *new_blob);
276278
struct drm_property_blob *drm_property_blob_get(struct drm_property_blob *blob);
277279
void drm_property_blob_put(struct drm_property_blob *blob);
278280

0 commit comments

Comments
 (0)