aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_modes.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r--drivers/gpu/drm/drm_modes.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 7ff13bc47ca..b7adb4a967f 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -714,6 +714,27 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
714 714
715 715
716/** 716/**
717 * drm_mode_copy - copy the mode
718 * @dst: mode to overwrite
719 * @src: mode to copy
720 *
721 * LOCKING:
722 * None.
723 *
724 * Copy an existing mode into another mode, preserving the object id
725 * of the destination mode.
726 */
727void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
728{
729 int id = dst->base.id;
730
731 *dst = *src;
732 dst->base.id = id;
733 INIT_LIST_HEAD(&dst->head);
734}
735EXPORT_SYMBOL(drm_mode_copy);
736
737/**
717 * drm_mode_duplicate - allocate and duplicate an existing mode 738 * drm_mode_duplicate - allocate and duplicate an existing mode
718 * @m: mode to duplicate 739 * @m: mode to duplicate
719 * 740 *
@@ -727,16 +748,13 @@ struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
727 const struct drm_display_mode *mode) 748 const struct drm_display_mode *mode)
728{ 749{
729 struct drm_display_mode *nmode; 750 struct drm_display_mode *nmode;
730 int new_id;
731 751
732 nmode = drm_mode_create(dev); 752 nmode = drm_mode_create(dev);
733 if (!nmode) 753 if (!nmode)
734 return NULL; 754 return NULL;
735 755
736 new_id = nmode->base.id; 756 drm_mode_copy(nmode, mode);
737 *nmode = *mode; 757
738 nmode->base.id = new_id;
739 INIT_LIST_HEAD(&nmode->head);
740 return nmode; 758 return nmode;
741} 759}
742EXPORT_SYMBOL(drm_mode_duplicate); 760EXPORT_SYMBOL(drm_mode_duplicate);