From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHa1k-0002x0-HV for qemu-devel@nongnu.org; Tue, 21 Jul 2015 12:04:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHa1j-00030W-JQ for qemu-devel@nongnu.org; Tue, 21 Jul 2015 12:04:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHa1j-00030S-EH for qemu-devel@nongnu.org; Tue, 21 Jul 2015 12:04:19 -0400 From: =?UTF-8?q?Marc=20Mar=C3=AD?= Date: Tue, 21 Jul 2015 18:03:42 +0200 Message-Id: <1437494626-3773-4-git-send-email-markmb@redhat.com> In-Reply-To: <1437494626-3773-1-git-send-email-markmb@redhat.com> References: <1437494626-3773-1-git-send-email-markmb@redhat.com> Subject: [Qemu-devel] [RFC 3/7] fw_cfg dma: adapt to vmstate changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , 'Kevin O'Connor' , Gerd Hoffmann , Stefan Hajnoczi From: Gerd Hoffmann --- hw/nvram/fw_cfg.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 5bcd0e0..0f35931 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -515,8 +515,16 @@ static bool is_version_1(void *opaque, int version_id) return version_id == 1; } +static bool fw_cfg_dma_enabled(void *opaque) +{ + FWCfgState *s = opaque; + + return s->dma_enabled; +} + static VMStateDescription vmstate_fw_cfg_dma = { .name = "fw_cfg/dma", + .needed = fw_cfg_dma_enabled, .fields = (VMStateField[]) { VMSTATE_UINT64(dma_addr, FWCfgState), VMSTATE_UINT32(dma_len, FWCfgState), @@ -525,13 +533,6 @@ static VMStateDescription vmstate_fw_cfg_dma = { }, }; -static bool fw_cfg_dma_enabled(void *opaque) -{ - FWCfgState *s = opaque; - - return s->dma_enabled; -} - static const VMStateDescription vmstate_fw_cfg = { .name = "fw_cfg", .version_id = 2, @@ -542,13 +543,9 @@ static const VMStateDescription vmstate_fw_cfg = { VMSTATE_UINT32_V(cur_offset, FWCfgState, 2), VMSTATE_END_OF_LIST() }, - .subsections = (VMStateSubsection[]) { - { - .vmsd = &vmstate_fw_cfg_dma, - .needed = fw_cfg_dma_enabled, - }, { - /* end of list */ - } + .subsections = (const VMStateDescription*[]) { + &vmstate_fw_cfg_dma, + NULL, } }; -- 2.4.3