diff mbox

[02/25] serial: use post_load version_id field and remove pre_load function

Message ID 238d3cf2aaea580ffc5042d1c2856cf92b66541c.1255976538.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Oct. 19, 2009, 6:42 p.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/serial.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/hw/serial.c b/hw/serial.c
index eb14f11..ea4154f 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -648,17 +648,13 @@  static void serial_pre_save(void *opaque)
     s->fcr_vmstate = s->fcr;
 }

-static int serial_pre_load(void *opaque)
-{
-    SerialState *s = opaque;
-    s->fcr_vmstate = 0;
-    return 0;
-}
-
 static int serial_post_load(void *opaque, int version_id)
 {
     SerialState *s = opaque;

+    if (version_id < 3) {
+        s->fcr_vmstate = 0;
+    }
     /* Initialize fcr via setter to perform essential side-effects */
     serial_ioport_write(s, 0x02, s->fcr_vmstate);
     return 0;
@@ -669,7 +665,6 @@  static const VMStateDescription vmstate_serial = {
     .version_id = 3,
     .minimum_version_id = 2,
     .pre_save = serial_pre_save,
-    .pre_load = serial_pre_load,
     .post_load = serial_post_load,
     .fields      = (VMStateField []) {
         VMSTATE_UINT16_V(divider, SerialState, 2),