From patchwork Sun Feb 5 13:37:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhao xiao qiang X-Patchwork-Id: 9556069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBFF2602B1 for ; Sun, 5 Feb 2017 13:38:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE57B204BE for ; Sun, 5 Feb 2017 13:38:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D335A26E82; Sun, 5 Feb 2017 13:38:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F8FD204BE for ; Sun, 5 Feb 2017 13:38:55 +0000 (UTC) Received: from localhost ([::1]:43283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caN1o-0000D9-Le for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Feb 2017 08:38:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caN1B-0000Ap-2k for qemu-devel@nongnu.org; Sun, 05 Feb 2017 08:38:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1caN17-0003Hf-Vj for qemu-devel@nongnu.org; Sun, 05 Feb 2017 08:38:13 -0500 Received: from m12-14.163.com ([220.181.12.14]:60841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caN17-0003Eo-BL for qemu-devel@nongnu.org; Sun, 05 Feb 2017 08:38:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=cOBbRaG7WyLx2DEjfo InoTB9kaVFVUL6yraaLM5jwJw=; b=mT36ppf95QoSzfakAe6UxsJgOfaKNKTpyb NkymvRedvpyf/xcIrLkZ2YZTvURlQpKksRbqlXd3neBxC6XIqqA6mBXYYCwCNys5 9Z53Lw6P2VrZiPUtIzqx+wG7Uz55GsT9Lw/v6uY+3IuQd1fFSa+EzRGLmbsj+4zk ZX4cHIloE= Received: from localhost.localdomain (unknown [117.136.0.125]) by smtp10 (Coremail) with SMTP id DsCowACnVrepKpdYyVK9Ig--.30409S4; Sun, 05 Feb 2017 21:37:47 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sun, 5 Feb 2017 21:37:24 +0800 Message-Id: <20170205133727.23424-7-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170205133727.23424-1-zxq_yx_007@163.com> References: <20170205133727.23424-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowACnVrepKpdYyVK9Ig--.30409S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw4rtr1DGr4kGw1rCFykKrg_yoW8uw1UpF Z8ZF1kWrWDWFsFqw4fGryDXa98Ww1kJr12ya9rGws7C3WUtrs5tr1qyry7Jr4kGr9FvrW3 Za1xAr98Wa13Cr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bU9aPUUUUU= X-Originating-IP: [117.136.0.125] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiMwt1xlXlkEmg3gAAsc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [RESEND PATCH 6/9] hw/timer: QOM'ify m48txx_sysbus (pass 2) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP assign DeviceClass::vmsd instead of using vmstate_register function Signed-off-by: xiaoqiang zhao --- hw/timer/m48t59.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index 39e425e950..6afcce4669 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -639,6 +639,28 @@ static const VMStateDescription vmstate_m48t59 = { } }; +static const VMStateDescription vmstate_m48t59_isa = { + .name = "m48t59", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(state, M48txxISAState, 0, + vmstate_m48t59, M48t59State), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_m48t59_sys_bus = { + .name = "m48t59", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(state, M48txxSysBusState, 0, + vmstate_m48t59, M48t59State), + VMSTATE_END_OF_LIST() + } +}; + static void m48t59_reset_common(M48t59State *NVRAM) { NVRAM->addr = 0; @@ -744,8 +766,6 @@ static void m48t59_realize_common(M48t59State *s, Error **errp) s->wd_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &watchdog_cb, s); } qemu_get_timedate(&s->alarm, 0); - - vmstate_register(NULL, -1, &vmstate_m48t59, s); } static void m48t59_isa_realize(DeviceState *dev, Error **errp) @@ -824,6 +844,7 @@ static void m48txx_isa_class_init(ObjectClass *klass, void *data) dc->realize = m48t59_isa_realize; dc->reset = m48t59_reset_isa; dc->props = m48t59_isa_properties; + dc->vmsd = &vmstate_m48t59_isa; nc->read = m48txx_isa_read; nc->write = m48txx_isa_write; nc->toggle_lock = m48txx_isa_toggle_lock; @@ -868,6 +889,7 @@ static void m48txx_sysbus_class_init(ObjectClass *klass, void *data) dc->realize = m48t59_realize; dc->reset = m48t59_reset_sysbus; dc->props = m48t59_sysbus_properties; + dc->vmsd = &vmstate_m48t59_sys_bus; nc->read = m48txx_sysbus_read; nc->write = m48txx_sysbus_write; nc->toggle_lock = m48txx_sysbus_toggle_lock;