Patchwork [3/4] vmstate: remove ps2_kbd_load_old()

login
register
mail settings
Submitter Juan Quintela
Date Sept. 14, 2009, 8:15 p.m.
Message ID <0edf2bd1f6b19331af58712a09c528a134395338.1252959221.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/33605/
State Superseded
Headers show

Comments

Juan Quintela - Sept. 14, 2009, 8:15 p.m.
Now that we have version_id on post_load() we don't need the old load
function

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/ps2.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
Paolo Bonzini - Sept. 14, 2009, 8:45 p.m.
On 09/14/2009 10:15 PM, Juan Quintela wrote:
>     .minimum_version_id = 3,

This must become 2.

Paolo
Juan Quintela - Sept. 14, 2009, 8:48 p.m.
Paolo Bonzini <bonzini@gnu.org> wrote:
> On 09/14/2009 10:15 PM, Juan Quintela wrote:
>>     .minimum_version_id = 3,
>
> This must become 2.

you are right.

Later, Juan.

Patch

diff --git a/hw/ps2.c b/hw/ps2.c
index fff4d13..6fe4b59 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -541,19 +541,11 @@  static const VMStateDescription vmstate_ps2_common = {
     }
 };

-static int ps2_kbd_load_old(QEMUFile* f, void* opaque, int version_id)
+static int ps2_kbd_post_load(void* opaque, int version_id)
 {
     PS2KbdState *s = (PS2KbdState*)opaque;

-    if (version_id != 2 && version_id != 3)
-        return -EINVAL;
-
-    vmstate_load_state(f, &vmstate_ps2_common, &s->common, version_id);
-    s->scan_enabled=qemu_get_be32(f);
-    s->translate=qemu_get_be32(f);
-    if (version_id == 3)
-        s->scancode_set=qemu_get_be32(f);
-    else
+    if (version_id == 2)
         s->scancode_set=2;
     return 0;
 }
@@ -563,7 +555,7 @@  static const VMStateDescription vmstate_ps2_keyboard = {
     .version_id = 3,
     .minimum_version_id = 3,
     .minimum_version_id_old = 2,
-    .load_state_old = ps2_kbd_load_old,
+    .post_load = ps2_kbd_post_load,
     .fields      = (VMStateField []) {
         VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State),
         VMSTATE_INT32(scan_enabled, PS2KbdState),