From patchwork Sun Dec 25 08:25:59 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: 9488187 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 7D58F60839 for ; Sun, 25 Dec 2016 08:27:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FED221050 for ; Sun, 25 Dec 2016 08:27:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6252A26530; Sun, 25 Dec 2016 08:27:06 +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 F13D621050 for ; Sun, 25 Dec 2016 08:27:04 +0000 (UTC) Received: from localhost ([::1]:46082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cL491-0000os-2J for patchwork-qemu-devel@patchwork.kernel.org; Sun, 25 Dec 2016 03:27:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cL48g-0000oc-3c for qemu-devel@nongnu.org; Sun, 25 Dec 2016 03:26:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cL48d-0001Ay-0a for qemu-devel@nongnu.org; Sun, 25 Dec 2016 03:26:42 -0500 Received: from m12-11.163.com ([220.181.12.11]:45836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cL48c-0001A9-5o for qemu-devel@nongnu.org; Sun, 25 Dec 2016 03:26:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=6srbgwSiB1+iYkBMk9 4XIne/o6CsTpwQ2tdpGxqPGm0=; b=hNSOYjw6uzP+XE19nhkTjsxegUewHPEW63 RBkPhZ4h2qQQfMGann8pB5ROR4c+bZqCiAOxWEzcxgMKz5J/0exaJCfNEzmWN94r YUAOwShyd79Qe1JcaKyrubp2Qlf30HQBmVemFKovfnmTQTXSujPM8EUusSF+kfE6 h7QPrcbzU= Received: from debian.lan (unknown [1.180.212.149]) by smtp7 (Coremail) with SMTP id C8CowADHrdqRgl9YAOxPGg--.38408S2; Sun, 25 Dec 2016 16:26:00 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sun, 25 Dec 2016 16:25:59 +0800 Message-Id: <20161225082559.2095-1-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 X-CM-TRANSID: C8CowADHrdqRgl9YAOxPGg--.38408S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw1rJr17JF15XFy3Cr48WFg_yoW8Cr1kpF WxCFyYkFW8GFsrGrZ3tF4kKa45t34kGr10vr17tw4fK3Wjyr1UWFykAws5trWqya97ua15 GFWrX3Wxtw48G3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bh9N3UUUUU= X-Originating-IP: [1.180.212.149] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiTBhLxlSISbpmawAAs7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.11 Subject: [Qemu-devel] [PATCH] hw/display: QOM'ify g364fb.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 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/display/g364fb.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 70ef2c7453..7a0fe48dd5 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -504,18 +504,24 @@ typedef struct { G364State g364; } G364SysBusState; -static int g364fb_sysbus_init(SysBusDevice *sbd) +static void g364fb_sysbus_init(Object *obj) { + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); DeviceState *dev = DEVICE(sbd); G364SysBusState *sbs = G364(dev); G364State *s = &sbs->g364; - g364fb_init(dev, s); sysbus_init_irq(sbd, &s->irq); sysbus_init_mmio(sbd, &s->mem_ctrl); sysbus_init_mmio(sbd, &s->mem_vram); +} - return 0; +static void g364fb_sysbus_realize(DeviceState *dev, Error **errp) +{ + G364SysBusState *sbs = G364(dev); + G364State *s = &sbs->g364; + + g364fb_init(dev, s); } static void g364fb_sysbus_reset(DeviceState *d) @@ -534,9 +540,8 @@ static Property g364fb_sysbus_properties[] = { static void g364fb_sysbus_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = g364fb_sysbus_init; + dc->realize = g364fb_sysbus_realize; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = "G364 framebuffer"; dc->reset = g364fb_sysbus_reset; @@ -548,6 +553,7 @@ static const TypeInfo g364fb_sysbus_info = { .name = TYPE_G364, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(G364SysBusState), + .instance_init = g364fb_sysbus_init, .class_init = g364fb_sysbus_class_init, };