From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpJ8O-0005u2-Oe for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:08:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpJ8M-0007iJ-Dv for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:08:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpJ8M-0007he-4y for qemu-devel@nongnu.org; Thu, 12 Jul 2012 09:08:42 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CD8enV022978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Jul 2012 09:08:41 -0400 From: Gerd Hoffmann Date: Thu, 12 Jul 2012 15:08:36 +0200 Message-Id: <1342098519-23261-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1342098519-23261-1-git-send-email-kraxel@redhat.com> References: <1342098519-23261-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/6] uhci: initialize expire_time when loading v1 vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann $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 --- 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