From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQLLQ-0005bk-TW for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:13:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQLLL-0005Wv-J2 for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:13:23 -0400 Received: from [199.232.76.173] (port=48476 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQLLL-0005Wc-Bo for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:13:19 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53903) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MQLLK-0004iO-S8 for qemu-devel@nongnu.org; Mon, 13 Jul 2009 09:13:19 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6DDDIr7006271 for ; Mon, 13 Jul 2009 09:13:18 -0400 From: Gerd Hoffmann Date: Mon, 13 Jul 2009 15:13:10 +0200 Message-Id: <1247490790-15783-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1247490790-15783-1-git-send-email-kraxel@redhat.com> References: <1247490790-15783-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 7/7] qdev/prop: convert eccmemctl List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/eccmemctl.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hw/eccmemctl.c b/hw/eccmemctl.c index d05962b..c5d6449 100644 --- a/hw/eccmemctl.c +++ b/hw/eccmemctl.c @@ -321,7 +321,6 @@ static void ecc_init1(SysBusDevice *dev) ECCState *s = FROM_SYSBUS(ECCState, dev); sysbus_init_irq(dev, &s->irq); - s->version = qdev_get_prop_int(&dev->qdev, "version", -1); s->regs[0] = s->version; ecc_io_memory = cpu_register_io_memory(ecc_mem_read, ecc_mem_write, s); sysbus_init_mmio(dev, ECC_SIZE, ecc_io_memory); @@ -342,7 +341,7 @@ void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version) SysBusDevice *s; dev = qdev_create(NULL, "eccmemctl"); - qdev_set_prop_int(dev, "version", version); + qdev_prop_set_uint32(dev, "version", version); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, irq); @@ -352,9 +351,25 @@ void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version) } } +static SysBusDeviceInfo ecc_info = { + .init = ecc_init1, + .qdev.name = "eccmemctl", + .qdev.size = sizeof(ECCState), + .qdev.props = (Property[]) { + { + .name = "version", + .info = &qdev_prop_uint32, + .offset = offsetof(ECCState, version), + .defval = (uint32_t[]) { -1 }, + }, + {/* end of list */} + } +}; + + static void ecc_register_devices(void) { - sysbus_register_dev("eccmemctl", sizeof(ECCState), ecc_init1); + sysbus_register_withprop(&ecc_info); } device_init(ecc_register_devices) -- 1.6.2.5