diff mbox

[1/3] drm: Preserve the list head in drm_mode_copy

Message ID 1370002628-16417-1-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Ville Syrjälä May 31, 2013, 12:17 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Preserve the destination mode's list head in drm_mode_copy. Just
in case someone decides that it's a good idea to overwrite a mode which
happens to be on some list,

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_modes.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Alex Deucher May 31, 2013, 1 p.m. UTC | #1
On Fri, May 31, 2013 at 8:17 AM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Preserve the destination mode's list head in drm_mode_copy. Just
> in case someone decides that it's a good idea to overwrite a mode which
> happens to be on some list,
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_modes.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index a371ff8..ba86316 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -787,16 +787,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
>   * LOCKING:
>   * None.
>   *
> - * Copy an existing mode into another mode, preserving the object id
> - * of the destination mode.
> + * Copy an existing mode into another mode, preserving the object id and
> + * list head of the destination mode.
>   */
>  void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
>  {
>         int id = dst->base.id;
> +       struct list_head head = dst->head;
>
>         *dst = *src;
>         dst->base.id = id;
> -       INIT_LIST_HEAD(&dst->head);
> +       dst->head = head;
>  }
>  EXPORT_SYMBOL(drm_mode_copy);
>
> --
> 1.8.1.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index a371ff8..ba86316 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -787,16 +787,17 @@  EXPORT_SYMBOL(drm_mode_set_crtcinfo);
  * LOCKING:
  * None.
  *
- * Copy an existing mode into another mode, preserving the object id
- * of the destination mode.
+ * Copy an existing mode into another mode, preserving the object id and
+ * list head of the destination mode.
  */
 void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
 {
 	int id = dst->base.id;
+	struct list_head head = dst->head;
 
 	*dst = *src;
 	dst->base.id = id;
-	INIT_LIST_HEAD(&dst->head);
+	dst->head = head;
 }
 EXPORT_SYMBOL(drm_mode_copy);