From patchwork Sat Dec 31 01:18:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhao xiao qiang X-Patchwork-Id: 9492571 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 611E762AB9 for ; Sat, 31 Dec 2016 01:18:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2DC24B44 for ; Sat, 31 Dec 2016 01:18:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EE4925E13; Sat, 31 Dec 2016 01:18:58 +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 D9FFC24B44 for ; Sat, 31 Dec 2016 01:18:57 +0000 (UTC) Received: from localhost ([::1]:42103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8K1-0000yc-0v for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 20:18:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8JU-0000wX-3s for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:18:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cN8JT-0008UB-7Y for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:18:24 -0500 Received: from m12-14.163.com ([220.181.12.14]:44145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8JS-0008TY-KW; Fri, 30 Dec 2016 20:18:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=+QiExHgp0bawUhO4UU 5ZMKPAg4gW16VdI2JGBPE33pU=; b=YEpIFce6UhrP9C+67vbWkgbMeQislI12Ze n3wjnxtAvdms0nZPpYsOMtDmaXy+WZZH7rwz3Pcw+wW1NKPUVQlwL2cPEpZZ8Pgi b+Flo62u1tEmKLq2UQ137imOSitlUjCdhmMhVppHMMhtzdJv9JNwhaefz25xMTPR 5N1PXpp+s= Received: from localhost.localdomain (unknown [223.104.3.243]) by smtp10 (Coremail) with SMTP id DsCowACnzZpQB2dYbQqVFw--.11118S3; Sat, 31 Dec 2016 09:18:15 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sat, 31 Dec 2016 09:18:07 +0800 Message-Id: <20161231011808.4037-2-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161231011808.4037-1-zxq_yx_007@163.com> References: <20161231011808.4037-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowACnzZpQB2dYbQqVFw--.11118S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw1rJr1UGr4ktr45ZrWrZrb_yoW8uFWUpr Z7uF4DJw13JrZ7JF4S9r18GFs5AFs3Crs0qrn3CrWIyryDKrW7tr1rKFWYya17trs5AFyr Aa17JF15C3W7J3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jVLvtUUUUU= X-Originating-IP: [223.104.3.243] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/xtbBEBdRxlUL-1gs+AAAs9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [PATCH 1/2] hw/char: QOM'ify exynos4210_uart.c 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: i.mitsyanko@gmail.com, pbonzini@redhat.com, qemu-arm@nongnu.org, chouteau@adacore.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Drop the old Sysbus init and use instance_init and DeviceClass::realize instead Signed-off-by: xiaoqiang zhao --- hw/char/exynos4210_uart.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 571c324004..820d1abeb9 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -629,22 +629,26 @@ DeviceState *exynos4210_uart_create(hwaddr addr, return dev; } -static int exynos4210_uart_init(SysBusDevice *dev) +static void exynos4210_uart_init(Object *obj) { + SysBusDevice *dev = SYS_BUS_DEVICE(obj); Exynos4210UartState *s = EXYNOS4210_UART(dev); /* memory mapping */ - memory_region_init_io(&s->iomem, OBJECT(s), &exynos4210_uart_ops, s, + memory_region_init_io(&s->iomem, obj, &exynos4210_uart_ops, s, "exynos4210.uart", EXYNOS4210_UART_REGS_MEM_SIZE); sysbus_init_mmio(dev, &s->iomem); sysbus_init_irq(dev, &s->irq); +} + +static void exynos4210_uart_realize(DeviceState *dev, Error **errp) +{ + Exynos4210UartState *s = EXYNOS4210_UART(dev); qemu_chr_fe_set_handlers(&s->chr, exynos4210_uart_can_receive, exynos4210_uart_receive, exynos4210_uart_event, s, NULL, true); - - return 0; } static Property exynos4210_uart_properties[] = { @@ -658,9 +662,8 @@ static Property exynos4210_uart_properties[] = { static void exynos4210_uart_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = exynos4210_uart_init; + dc->realize = exynos4210_uart_realize; dc->reset = exynos4210_uart_reset; dc->props = exynos4210_uart_properties; dc->vmsd = &vmstate_exynos4210_uart; @@ -670,6 +673,7 @@ static const TypeInfo exynos4210_uart_info = { .name = TYPE_EXYNOS4210_UART, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(Exynos4210UartState), + .instance_init = exynos4210_uart_init, .class_init = exynos4210_uart_class_init, };