From patchwork Fri May 6 10:59:34 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: 9032221 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DFC199F39D for ; Fri, 6 May 2016 11:06:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3AB1F2037F for ; Fri, 6 May 2016 11:06:29 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 8B8E020218 for ; Fri, 6 May 2016 11:06:28 +0000 (UTC) Received: from localhost ([::1]:57622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydaS-00039L-LG for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 May 2016 07:06:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydXx-0007KS-0j for qemu-devel@nongnu.org; Fri, 06 May 2016 07:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aydXj-000210-71 for qemu-devel@nongnu.org; Fri, 06 May 2016 07:03:43 -0400 Received: from m12-16.163.com ([220.181.12.16]:57233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydXh-0001sU-Ju; Fri, 06 May 2016 07:03:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=JZp7kQDC/e4W8akK/S Xnq6B9NcM5Wuw/rOUFem9R1b0=; b=P13PUGdMgchncNgBGP8Mvrte+0fdcOJOPV wm0d1LKPLUXBJqFa1DB7hiZCgHdG9y9eh0oQH38tWdZMyWVK3HB1/HmvRZ+rgMIB AeOHuV348wfxHYnfE0aECUL329Uqwvjjdsh+7lmrEB9e39zsHom5zpSy5YBnHuMw HXeATpWEk= Received: from localhost.localdomain (unknown [118.187.28.42]) by smtp12 (Coremail) with SMTP id EMCowACXRsM7eSxXsYpAAA--.18847S6; Fri, 06 May 2016 19:01:56 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Fri, 6 May 2016 18:59:34 +0800 Message-Id: <1462532375-29264-5-git-send-email-zxq_yx_007@163.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462532375-29264-1-git-send-email-zxq_yx_007@163.com> References: <1462532375-29264-1-git-send-email-zxq_yx_007@163.com> X-CM-TRANSID: EMCowACXRsM7eSxXsYpAAA--.18847S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFyrXFWkKFW3GF13tF48tFb_yoW8ur48pF Z7ZFZ09r47GFsxWrWxJF1vgF15Awn2yFyxWry0yw1xJa17Jryfu3ZrZF1rZr4DtFZFva43 XFWkt3WUKr45tw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jxR6wUUUUU= X-Originating-IP: [118.187.28.42] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiFgNhxlWBQqsnVQABs8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.16 Subject: [Qemu-devel] [PATCH v2 4/5] hw/display: QOM'ify milkymist-vgafb.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: peter.maydell@linaro.org, i.mitsyanko@gmail.com, armbru@redhat.com, michael@walle.cc, qemu-arm@nongnu.org, hirofumi@mail.parknet.co.jp Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Drop the old SysBus init function and use instance_init * Move graphic_console_init into realize stage Signed-off-by: xiaoqiang zhao Acked-by: Michael Walle Tested-by: Michael Walle --- hw/display/milkymist-vgafb.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c index 19ca256..39e16d6 100644 --- a/hw/display/milkymist-vgafb.c +++ b/hw/display/milkymist-vgafb.c @@ -292,17 +292,21 @@ static const GraphicHwOps vgafb_ops = { .gfx_update = vgafb_update_display, }; -static int milkymist_vgafb_init(SysBusDevice *dev) +static void milkymist_vgafb_init(Object *obj) { - MilkymistVgafbState *s = MILKYMIST_VGAFB(dev); + MilkymistVgafbState *s = MILKYMIST_VGAFB(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); memory_region_init_io(&s->regs_region, OBJECT(s), &vgafb_mmio_ops, s, "milkymist-vgafb", R_MAX * 4); sysbus_init_mmio(dev, &s->regs_region); +} - s->con = graphic_console_init(DEVICE(dev), 0, &vgafb_ops, s); +static void milkymist_vgafb_realize(DeviceState *dev, Error **errp) +{ + MilkymistVgafbState *s = MILKYMIST_VGAFB(dev); - return 0; + s->con = graphic_console_init(dev, 0, &vgafb_ops, s); } static int vgafb_post_load(void *opaque, int version_id) @@ -331,18 +335,18 @@ static Property milkymist_vgafb_properties[] = { static void milkymist_vgafb_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = milkymist_vgafb_init; dc->reset = milkymist_vgafb_reset; dc->vmsd = &vmstate_milkymist_vgafb; dc->props = milkymist_vgafb_properties; + dc->realize = milkymist_vgafb_realize; } static const TypeInfo milkymist_vgafb_info = { .name = TYPE_MILKYMIST_VGAFB, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistVgafbState), + .instance_init = milkymist_vgafb_init, .class_init = milkymist_vgafb_class_init, };