From patchwork Fri Jan 6 00:26:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhao xiao qiang X-Patchwork-Id: 9499793 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 E13A260236 for ; Fri, 6 Jan 2017 00:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1BD527DCD for ; Fri, 6 Jan 2017 00:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C543327F54; Fri, 6 Jan 2017 00:33:41 +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 67BC627DCD for ; Fri, 6 Jan 2017 00:33:41 +0000 (UTC) Received: from localhost ([::1]:49421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPITU-0003MC-09 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Jan 2017 19:33:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPINU-0007Cy-Gs for qemu-devel@nongnu.org; Thu, 05 Jan 2017 19:27:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPINR-0000sR-F2 for qemu-devel@nongnu.org; Thu, 05 Jan 2017 19:27:28 -0500 Received: from m12-14.163.com ([220.181.12.14]:47935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPINQ-0000qA-Py; Thu, 05 Jan 2017 19:27:25 -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=aKmW/cjWOLgqRlGfPTBg7PIcNyqqkt0JJF 7EQ9ve0emCecgctU24JO+eBa63TDDxR/+fBgm6HNPc55ffRtmNvKg7myUW/am++q MetTHnD0IhbEiqiN5wCLT1KNZPNxUlCE+NLpd2zqTKEwLEX/Zx/SkPHHctgcCKhe Mc0OBl30k= Received: from localhost.localdomain (unknown [223.104.3.255]) by smtp10 (Coremail) with SMTP id DsCowABHJps65G5Ymg8zGQ--.36662S5; Fri, 06 Jan 2017 08:26:45 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Fri, 6 Jan 2017 08:26:27 +0800 Message-Id: <20170106002628.10343-4-zxq_yx_007@163.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170106002628.10343-1-zxq_yx_007@163.com> References: <20170106002628.10343-1-zxq_yx_007@163.com> X-CM-TRANSID: DsCowABHJps65G5Ymg8zGQ--.36662S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw4rCry5Zw47Wr15ZryftFb_yoW8Aryrpa 47ZFn5Gr4DKF4qqFsrXF4v9F4UAws7G3yxJrn5AFn2yF4q9r9xXrs0yayfArZrtayxAFy5 Ja1rt347Ja1UJw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jtSdgUUUUU= X-Originating-IP: [223.104.3.255] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/xtbBEAVXxlUL-5+xDQAAsG X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [PATCH v2 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, };