Patchwork [v2,2/2] ps2: preserve repeat state on migration

login
register
mail settings
Submitter Amos Kong
Date May 22, 2013, 4:10 p.m.
Message ID <1369239012-8180-3-git-send-email-akong@redhat.com>
Download mbox | patch
Permalink /patch/245653/
State New
Headers show

Comments

Amos Kong - May 22, 2013, 4:10 p.m.
Use a subsection to migrate repeat state (repate period and first
delay).

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/input/ps2.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
Anthony Liguori - May 30, 2013, 4:49 p.m.
Amos Kong <akong@redhat.com> writes:

> Use a subsection to migrate repeat state (repate period and first
> delay).
>
> Signed-off-by: Amos Kong <akong@redhat.com>

Ah,

You should fold this into 1/2.  Otherwise you break migration during
bisecting.

Regards,

Anthony Liguori

> ---
>  hw/input/ps2.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/hw/input/ps2.c b/hw/input/ps2.c
> index 8adbb4a..cdb18e6 100644
> --- a/hw/input/ps2.c
> +++ b/hw/input/ps2.c
> @@ -611,6 +611,13 @@ static const VMStateDescription vmstate_ps2_common = {
>      }
>  };
>  
> +static bool ps2_keyboard_repeatstate_needed(void *opaque)
> +{
> +    PS2KbdState *s = opaque;
> +
> +    return s->repeat_period || s->repeat_delay;
> +}
> +
>  static bool ps2_keyboard_ledstate_needed(void *opaque)
>  {
>      PS2KbdState *s = opaque;
> @@ -626,6 +633,18 @@ static int ps2_kbd_ledstate_post_load(void *opaque, int version_id)
>      return 0;
>  }
>  
> +static const VMStateDescription vmstate_ps2_keyboard_repeatstate = {
> +    .name = "ps2kbd/repeatstate",
> +    .version_id = 3,
> +    .minimum_version_id = 2,
> +    .minimum_version_id_old = 2,
> +    .fields      = (VMStateField[]) {
> +        VMSTATE_INT32(repeat_period, PS2KbdState),
> +        VMSTATE_INT32(repeat_delay, PS2KbdState),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
>  static const VMStateDescription vmstate_ps2_keyboard_ledstate = {
>      .name = "ps2kbd/ledstate",
>      .version_id = 3,
> @@ -665,6 +684,9 @@ static const VMStateDescription vmstate_ps2_keyboard = {
>              .vmsd = &vmstate_ps2_keyboard_ledstate,
>              .needed = ps2_keyboard_ledstate_needed,
>          }, {
> +            .vmsd = &vmstate_ps2_keyboard_repeatstate,
> +            .needed = ps2_keyboard_repeatstate_needed,
> +        }, {
>              /* empty */
>          }
>      }
> -- 
> 1.8.1.4

Patch

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 8adbb4a..cdb18e6 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -611,6 +611,13 @@  static const VMStateDescription vmstate_ps2_common = {
     }
 };
 
+static bool ps2_keyboard_repeatstate_needed(void *opaque)
+{
+    PS2KbdState *s = opaque;
+
+    return s->repeat_period || s->repeat_delay;
+}
+
 static bool ps2_keyboard_ledstate_needed(void *opaque)
 {
     PS2KbdState *s = opaque;
@@ -626,6 +633,18 @@  static int ps2_kbd_ledstate_post_load(void *opaque, int version_id)
     return 0;
 }
 
+static const VMStateDescription vmstate_ps2_keyboard_repeatstate = {
+    .name = "ps2kbd/repeatstate",
+    .version_id = 3,
+    .minimum_version_id = 2,
+    .minimum_version_id_old = 2,
+    .fields      = (VMStateField[]) {
+        VMSTATE_INT32(repeat_period, PS2KbdState),
+        VMSTATE_INT32(repeat_delay, PS2KbdState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_ps2_keyboard_ledstate = {
     .name = "ps2kbd/ledstate",
     .version_id = 3,
@@ -665,6 +684,9 @@  static const VMStateDescription vmstate_ps2_keyboard = {
             .vmsd = &vmstate_ps2_keyboard_ledstate,
             .needed = ps2_keyboard_ledstate_needed,
         }, {
+            .vmsd = &vmstate_ps2_keyboard_repeatstate,
+            .needed = ps2_keyboard_repeatstate_needed,
+        }, {
             /* empty */
         }
     }