From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/6] uhci: initialize expire_time when loading v1 vmstate
Date: Thu, 12 Jul 2012 15:08:36 +0200 [thread overview]
Message-ID: <1342098519-23261-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1342098519-23261-1-git-send-email-kraxel@redhat.com>
$subject says all: when loading old (v1) vmstate which doesn't contain
expire_time initialize it with a reasonable default (current time).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-uhci.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 8f652d2..2aac8a2 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -388,11 +388,23 @@ static const VMStateDescription vmstate_uhci_port = {
}
};
+static int uhci_post_load(void *opaque, int version_id)
+{
+ UHCIState *s = opaque;
+
+ if (version_id < 2) {
+ s->expire_time = qemu_get_clock_ns(vm_clock) +
+ (get_ticks_per_sec() / FRAME_TIMER_FREQ);
+ }
+ return 0;
+}
+
static const VMStateDescription vmstate_uhci = {
.name = "uhci",
.version_id = 2,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
+ .post_load = uhci_post_load,
.fields = (VMStateField []) {
VMSTATE_PCI_DEVICE(dev, UHCIState),
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
--
1.7.1
next prev parent reply other threads:[~2012-07-12 13:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 13:08 [Qemu-devel] [PULL 0/6] usb patch queue Gerd Hoffmann
2012-07-12 13:08 ` [Qemu-devel] [PATCH 1/6] scsi: add free_request callback Gerd Hoffmann
2012-07-12 13:08 ` [Qemu-devel] [PATCH 2/6] usb: add usb attached scsi emulation Gerd Hoffmann
2012-07-15 6:55 ` Deep Debroy
2012-07-16 11:22 ` Stefan Hajnoczi
2012-07-12 13:08 ` Gerd Hoffmann [this message]
2012-07-12 13:15 ` [Qemu-devel] [PATCH 3/6] uhci: initialize expire_time when loading v1 vmstate Michael Tokarev
2012-07-12 13:08 ` [Qemu-devel] [PATCH 4/6] ehci: raise irq in the frame timer Gerd Hoffmann
2012-07-12 13:08 ` [Qemu-devel] [PATCH 5/6] ehci: implement Interrupt Threshold Control support Gerd Hoffmann
2012-07-12 13:08 ` [Qemu-devel] [PATCH 6/6] ehci: improve expire time calculation Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1342098519-23261-4-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).