From patchwork Fri May 13 10:44:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Alrae X-Patchwork-Id: 9090271 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 43B5BBF29F for ; Fri, 13 May 2016 10:45:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A596C20219 for ; Fri, 13 May 2016 10:45:12 +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 E4821201FE for ; Fri, 13 May 2016 10:45:11 +0000 (UTC) Received: from localhost ([::1]:33840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1Aal-0005cK-45 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 13 May 2016 06:45:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1AaR-0005DV-PT for qemu-devel@nongnu.org; Fri, 13 May 2016 06:44:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1AaQ-0000Id-H0 for qemu-devel@nongnu.org; Fri, 13 May 2016 06:44:51 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:6883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1AaQ-0000IX-AV for qemu-devel@nongnu.org; Fri, 13 May 2016 06:44:50 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email with ESMTPS id 2665D72D22F03; Fri, 13 May 2016 11:44:46 +0100 (IST) Received: from localhost.localdomain (192.168.161.74) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 13 May 2016 11:44:48 +0100 From: Leon Alrae To: Date: Fri, 13 May 2016 11:44:17 +0100 Message-ID: <1463136257-46914-3-git-send-email-leon.alrae@imgtec.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1463136257-46914-1-git-send-email-leon.alrae@imgtec.com> References: <1463136257-46914-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.161.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Subject: [Qemu-devel] [PULL 2/2] hw/display: QOM'ify jazz_led.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: "xiaoqiang.zhao" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable 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 From: "xiaoqiang.zhao" * Drop the old SysBus init function and use instance_init * Move graphic_console_init into realize stage Signed-off-by: xiaoqiang zhao Reviewed-by: Peter Maydell Signed-off-by: Leon Alrae --- hw/display/jazz_led.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 09dcdb4..b72fdb1 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -267,16 +267,20 @@ static const GraphicHwOps jazz_led_ops = { .text_update = jazz_led_text_update, }; -static int jazz_led_init(SysBusDevice *dev) +static void jazz_led_init(Object *obj) { - LedState *s = JAZZ_LED(dev); + LedState *s = JAZZ_LED(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); - memory_region_init_io(&s->iomem, OBJECT(s), &led_ops, s, "led", 1); + memory_region_init_io(&s->iomem, obj, &led_ops, s, "led", 1); sysbus_init_mmio(dev, &s->iomem); +} - s->con = graphic_console_init(DEVICE(dev), 0, &jazz_led_ops, s); +static void jazz_led_realize(DeviceState *dev, Error **errp) +{ + LedState *s = JAZZ_LED(dev); - return 0; + s->con = graphic_console_init(dev, 0, &jazz_led_ops, s); } static void jazz_led_reset(DeviceState *d) @@ -291,18 +295,18 @@ static void jazz_led_reset(DeviceState *d) static void jazz_led_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = jazz_led_init; dc->desc = "Jazz LED display", dc->vmsd = &vmstate_jazz_led; dc->reset = jazz_led_reset; + dc->realize = jazz_led_realize; } static const TypeInfo jazz_led_info = { .name = TYPE_JAZZ_LED, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LedState), + .instance_init = jazz_led_init, .class_init = jazz_led_class_init, };