From patchwork Sat Dec 31 01:18:43 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: 9492587 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 6C8CD62ABC for ; Sat, 31 Dec 2016 01:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5086C223B2 for ; Sat, 31 Dec 2016 01:32:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31DEF25F31; Sat, 31 Dec 2016 01:32:57 +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 BF52E223B2 for ; Sat, 31 Dec 2016 01:32:56 +0000 (UTC) Received: from localhost ([::1]:42182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8XX-00049A-HG for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 20:32:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8K5-0001QG-J1 for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:19:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cN8K2-0000KH-Dw for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:19:01 -0500 Received: from m12-14.163.com ([220.181.12.14]:45577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8K1-0000Jw-QN for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:18:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=FIMfC8HBzShTFnKAKI pgnJDshHU2JZ4jj416BTR4TUU=; b=O3DeQIGzUvS7/TVgZw2Ur9yvoBEo7p6CkB PHE+Cb3fMYYSMakWoiR8oOXLslyBdXVkpHvk+1P7PqznJK99vYz1tMVYZJN217KH vluTnZ/oNHYyWXmuweFsp8MzCWmO7IFDfg67sg9tn9LWZQNlaOpcSt34DOD5e4Hx WKRP3IQPE= Received: from localhost.localdomain (unknown [223.104.3.243]) by smtp10 (Coremail) with SMTP id DsCowAAn4M94B2dY4BCVFw--.1240S3; Sat, 31 Dec 2016 09:18:55 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sat, 31 Dec 2016 09:18:43 +0800 Message-Id: <20161231011847.4153-2-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161231011847.4153-1-zxq_yx_007@163.com> References: <20161231011847.4153-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowAAn4M94B2dY4BCVFw--.1240S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw47ZFyfCF1kKF4rGw4xCrg_yoW8AF43pF Z3ZFZYkrsrJr4DXrW2yrs0qF1UAw1DKryxKrn2y3s7Gwn3JFyIqFs2gay8ZFWUKFWvvF13 Xa4kGFy8Xan0vaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UEAp5UUUUU= X-Originating-IP: [223.104.3.243] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/xtbBEABRxlUL-1guwAAAsQ 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/5] hw/misc: QOM'ify milkymist-hpdmc.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: michael@walle.cc 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 function and use instance_init Signed-off-by: xiaoqiang zhao --- hw/misc/milkymist-hpdmc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c index e6140eec6b..c0fdd2cb2e 100644 --- a/hw/misc/milkymist-hpdmc.c +++ b/hw/misc/milkymist-hpdmc.c @@ -129,15 +129,14 @@ static void milkymist_hpdmc_reset(DeviceState *d) | IODELAY_PLL2_LOCKED; } -static int milkymist_hpdmc_init(SysBusDevice *dev) +static void milkymist_hpdmc_init(Object *obj) { - MilkymistHpdmcState *s = MILKYMIST_HPDMC(dev); + MilkymistHpdmcState *s = MILKYMIST_HPDMC(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); - memory_region_init_io(&s->regs_region, OBJECT(dev), &hpdmc_mmio_ops, s, + memory_region_init_io(&s->regs_region, obj, &hpdmc_mmio_ops, s, "milkymist-hpdmc", R_MAX * 4); sysbus_init_mmio(dev, &s->regs_region); - - return 0; } static const VMStateDescription vmstate_milkymist_hpdmc = { @@ -153,9 +152,7 @@ static const VMStateDescription vmstate_milkymist_hpdmc = { static void milkymist_hpdmc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = milkymist_hpdmc_init; dc->reset = milkymist_hpdmc_reset; dc->vmsd = &vmstate_milkymist_hpdmc; } @@ -164,6 +161,7 @@ static const TypeInfo milkymist_hpdmc_info = { .name = TYPE_MILKYMIST_HPDMC, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistHpdmcState), + .instance_init = milkymist_hpdmc_init, .class_init = milkymist_hpdmc_class_init, };