From patchwork Fri May 6 10:59:35 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: 9032151 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BDB64BF29F for ; Fri, 6 May 2016 11:03:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F4B52037F for ; Fri, 6 May 2016 11:03:32 +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 742CB20218 for ; Fri, 6 May 2016 11:03:31 +0000 (UTC) Received: from localhost ([::1]:57596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydXb-0006Yj-Fr for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 May 2016 07:03:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydXG-0006Eh-SE for qemu-devel@nongnu.org; Fri, 06 May 2016 07:03:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aydX1-0001le-56 for qemu-devel@nongnu.org; Fri, 06 May 2016 07:03:01 -0400 Received: from m12-16.163.com ([220.181.12.16]:50794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aydWz-0001eL-D3; Fri, 06 May 2016 07:02:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=E43lye1wFxA7VmJ3Ex JTTenp5zZyC6DvFkdA7kzdnNM=; b=DpUmZFUeQblRIktQ2kYh9eN1F2nb+zpaOg siP2s7/0zeKGZCG+QPeeSaboRLwEQZ4fbQ/1njNeQ5uzyrxRy6m9obJucQYoUOLa pn0a6LvbZEY83KBxAk/34LG3ykEQQvaSSOuwZXBThmlGL2d+4nE7rM5pFod/polF F6SKHq8ac= Received: from localhost.localdomain (unknown [118.187.28.42]) by smtp12 (Coremail) with SMTP id EMCowACXRsM7eSxXsYpAAA--.18847S7; Fri, 06 May 2016 19:01:56 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Fri, 6 May 2016 18:59:35 +0800 Message-Id: <1462532375-29264-6-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--.18847S7 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFyrXFWkKFW5JFWUKF4xCrg_yoW8Cw1DpF Z3uF13ArW8XFsrGw4ftF1kGF90kws7G3y5trZFyw1fA34jkws5ta4kA3ySyrWqqay0vF1Y 9FWrtF17Jr48Z3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jxMa8UUUUU= X-Originating-IP: [118.187.28.42] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiOwRhxlXlTXqTWQAAsV X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.16 Subject: [Qemu-devel] [PATCH v2 5/5] hw/display: QOM'ify pl110.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 --- hw/display/pl110.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/display/pl110.c b/hw/display/pl110.c index d589959..73453b9 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -465,24 +465,26 @@ static const GraphicHwOps pl110_gfx_ops = { .gfx_update = pl110_update_display, }; -static int pl110_initfn(SysBusDevice *sbd) +static void pl110_init(Object *obj) { - DeviceState *dev = DEVICE(sbd); - PL110State *s = PL110(dev); + DeviceState *dev = DEVICE(obj); + PL110State *s = PL110(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110", 0x1000); + /* subclass instance_init may override this */ + s->version = PL110; + + memory_region_init_io(&s->iomem, obj, &pl110_ops, s, "pl110", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); qdev_init_gpio_in(dev, pl110_mux_ctrl_set, 1); +} + +static void pl110_realize(DeviceState *dev, Error **errp) +{ + PL110State *s = PL110(dev); + s->con = graphic_console_init(dev, 0, &pl110_gfx_ops, s); - return 0; -} - -static void pl110_init(Object *obj) -{ - PL110State *s = PL110(obj); - - s->version = PL110; } static void pl110_versatile_init(Object *obj) @@ -502,11 +504,10 @@ static void pl111_init(Object *obj) static void pl110_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = pl110_initfn; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->vmsd = &vmstate_pl110; + dc->realize = pl110_realize; } static const TypeInfo pl110_info = {