From patchwork Sat Dec 31 01:18:30 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: 9492591 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 AEEF362ABC for ; Sat, 31 Dec 2016 01:36:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C53A22A6B for ; Sat, 31 Dec 2016 01:36:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F8A725F31; Sat, 31 Dec 2016 01:36:36 +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 3AEEB22A6B for ; Sat, 31 Dec 2016 01:36:36 +0000 (UTC) Received: from localhost ([::1]:42201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8b5-0006ca-BY for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 20:36:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8KS-0001kx-NP for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cN8KQ-0000Sj-ML for qemu-devel@nongnu.org; Fri, 30 Dec 2016 20:19:24 -0500 Received: from m12-14.163.com ([220.181.12.14]:46562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cN8KO-0000RY-Gl; Fri, 30 Dec 2016 20:19:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=5EcCkLcEuRh+R2XszY TiwDAa9DDofTif5/rxxAJzFdo=; b=dnRLbNVcU/20/gWQGDRMbH0TKHrE+dziTa fcIXZzpTmsP+BlsI4X76jdrsujD5sPAimahj2uIJ56D3JoVnIJyomNniuNjYTPTZ g/z0Y2ZXWfX7nRwZ8mj2l81RgxY0YNWxNBI16AqQAm8mwgC8v9Fp2vO/axPuUsL/ lqppSU2ic= Received: from localhost.localdomain (unknown [223.104.3.243]) by smtp10 (Coremail) with SMTP id DsCowADHZLZoB2dYYQ6VFw--.5143S5; Sat, 31 Dec 2016 09:18:39 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sat, 31 Dec 2016 09:18:30 +0800 Message-Id: <20161231011831.4097-4-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161231011831.4097-1-zxq_yx_007@163.com> References: <20161231011831.4097-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowADHZLZoB2dYYQ6VFw--.5143S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw4rCry5Zw47Wr15ZryftFb_yoW8Aryrpa 47ZFn5Gr4DKF4qqFsrXF4v9F4UAws7G3yxJrn5AFn2yF4q9r9xXrs0yayfArZrtayxAFy5 Ja1rt347Ja1UJw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jmfOwUUUUU= X-Originating-IP: [223.104.3.243] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiOxBRxlXlW7mfewAAsK X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [PATCH 3/4] hw/ppc: QOM'ify ppce500_spin.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, qemu-ppc@nongnu.org, agraf@suse.de, david@gibson.dropbear.id.au 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/ppc/ppce500_spin.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index cf958a9e00..958536f6c6 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -54,9 +54,9 @@ typedef struct SpinState { SpinInfo spin[MAX_CPUS]; } SpinState; -static void spin_reset(void *opaque) +static void spin_reset(DeviceState *dev) { - SpinState *s = opaque; + SpinState *s = E500_SPIN(dev); int i; for (i = 0; i < MAX_CPUS; i++) { @@ -174,30 +174,28 @@ static const MemoryRegionOps spin_rw_ops = { .endianness = DEVICE_BIG_ENDIAN, }; -static int ppce500_spin_initfn(SysBusDevice *dev) +static void ppce500_spin_initfn(Object *obj) { + SysBusDevice *dev = SYS_BUS_DEVICE(obj); SpinState *s = E500_SPIN(dev); - memory_region_init_io(&s->iomem, OBJECT(s), &spin_rw_ops, s, + memory_region_init_io(&s->iomem, obj, &spin_rw_ops, s, "e500 spin pv device", sizeof(SpinInfo) * MAX_CPUS); sysbus_init_mmio(dev, &s->iomem); - - qemu_register_reset(spin_reset, s); - - return 0; } static void ppce500_spin_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); - k->init = ppce500_spin_initfn; + dc->reset = spin_reset; } static const TypeInfo ppce500_spin_info = { .name = TYPE_E500_SPIN, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(SpinState), + .instance_init = ppce500_spin_initfn, .class_init = ppce500_spin_class_init, };