From patchwork Sat Dec 31 01:17:19 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: 9492569 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 322EE62AB9 for ; Sat, 31 Dec 2016 01:18:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1582C24B44 for ; Sat, 31 Dec 2016 01:18:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0825025E13; Sat, 31 Dec 2016 01:18:16 +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 8013224B44 for ; Sat, 31 Dec 2016 01:18:14 +0000 (UTC) Received: from localhost ([::1]:42101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8JH-0000aX-T7 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 20:18:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8Is-0000ZT-M1 for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:17:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cN8Ip-0008H1-IV for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:17:46 -0500 Received: from m12-14.163.com ([220.181.12.14]:42332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8Io-0008G4-Lt for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:17:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=Gl6hmCqfsITBtwJ+O1 KNfWaq1BaAJuL18MyDD/uGXRU=; b=RDUIU7RlpL7d+R8jYBcPdxkYNnLoSeFGM/ g9f+dEhtqYu/hRc30Yoe6aXpzVuKBQvnZAP8WCO2pl0N53qcZM1ea6ZB8Q3JhH8Q GJdOYcVLqBiw5WV77NWCcgmdMzjeXikcxAmHx91XuU+SHVO+YlAygBZilTvu0ekT FPMM0mW78= Received: from localhost.localdomain (unknown [223.104.3.243]) by smtp10 (Coremail) with SMTP id DsCowABXrbYnB2dYGQKVFw--.9854S3; Sat, 31 Dec 2016 09:17:36 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sat, 31 Dec 2016 09:17:19 +0800 Message-Id: <20161231011720.3965-2-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161231011720.3965-1-zxq_yx_007@163.com> References: <20161231011720.3965-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowABXrbYnB2dYGQKVFw--.9854S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw47JFy5ury8Wr47Gw4kJFb_yoW8uFy5pr yDZF1YvFyDtrZrJ397Ww1rtFZ0qwn7GF1DKFyxWw4xGrsxKw1kJw4fCw4avF1UXrZYya1a va48Xry7ta98Kr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UuGQgUUUUU= X-Originating-IP: [223.104.3.243] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiqBBRxlc67MunzwABsM 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/audio: QOM'ify marvell_88w8618.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: kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP split the old SysBus init function into an instance_init and Device realize function Signed-off-by: xiaoqiang zhao --- hw/audio/marvell_88w8618.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index a6ca1806be..511b004287 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -241,19 +241,23 @@ static const MemoryRegionOps mv88w8618_audio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static int mv88w8618_audio_init(SysBusDevice *dev) +static void mv88w8618_audio_init(Object *obj) { + SysBusDevice *dev = SYS_BUS_DEVICE(obj); mv88w8618_audio_state *s = MV88W8618_AUDIO(dev); sysbus_init_irq(dev, &s->irq); - wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s); - - memory_region_init_io(&s->iomem, OBJECT(s), &mv88w8618_audio_ops, s, + memory_region_init_io(&s->iomem, obj, &mv88w8618_audio_ops, s, "audio", MP_AUDIO_SIZE); sysbus_init_mmio(dev, &s->iomem); +} - return 0; +static void mv88w8618_audio_realize(DeviceState *dev, Error **errp) +{ + mv88w8618_audio_state *s = MV88W8618_AUDIO(dev); + + wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s); } static const VMStateDescription mv88w8618_audio_vmsd = { @@ -282,9 +286,8 @@ static Property mv88w8618_audio_properties[] = { static void mv88w8618_audio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = mv88w8618_audio_init; + dc->realize = mv88w8618_audio_realize; dc->reset = mv88w8618_audio_reset; dc->vmsd = &mv88w8618_audio_vmsd; dc->props = mv88w8618_audio_properties; @@ -296,6 +299,7 @@ static const TypeInfo mv88w8618_audio_info = { .name = TYPE_MV88W8618_AUDIO, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(mv88w8618_audio_state), + .instance_init = mv88w8618_audio_init, .class_init = mv88w8618_audio_class_init, };