From patchwork Sun Oct 23 07:06:52 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: 9391037 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 211156086B for ; Sun, 23 Oct 2016 07:23:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 087CF28E1C for ; Sun, 23 Oct 2016 07:23:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F13C628E33; Sun, 23 Oct 2016 07:23:06 +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 627F728E25 for ; Sun, 23 Oct 2016 07:23:06 +0000 (UTC) Received: from localhost ([::1]:39992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byD7Z-0001Ps-NW for patchwork-qemu-devel@patchwork.kernel.org; Sun, 23 Oct 2016 03:23:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byD7D-0001PA-8l for qemu-devel@nongnu.org; Sun, 23 Oct 2016 03:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byD7A-0006Oj-4i for qemu-devel@nongnu.org; Sun, 23 Oct 2016 03:22:43 -0400 Received: from m12-15.163.com ([220.181.12.15]:48830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byD79-0006OX-Id for qemu-devel@nongnu.org; Sun, 23 Oct 2016 03:22:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=RDIx99pkW56hKjcesg NVyaG9ORqSvmIvcZQL6myPbv0=; b=ABlJmowabQN1HWDeJi5rgq5dlT0SmL4Ap2 NuL/85UptnlK+rpv9I/k20ZFzB+K6iVM+kyWUI3eujw+Q9QfZFkMvUABvQck1p/p UO/b0Nf0ig2A5dUSBfWpc2FAl9h0ywj7k9vpZ/E6v10lVbjSMD1t9uRNVC1tfBxo IkAf8qcXM= Received: from debian.lan (unknown [114.111.167.207]) by smtp13 (Coremail) with SMTP id EcCowABHWQyHYQxYnpqrBA--.5335S3; Sun, 23 Oct 2016 15:06:55 +0800 (CST) From: xiaoqiang zhao To: qemu-devel@nongnu.org Date: Sun, 23 Oct 2016 15:06:52 +0800 Message-Id: <20161023070653.1665-2-zxq_yx_007@163.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161023070653.1665-1-zxq_yx_007@163.com> References: <20161023070653.1665-1-zxq_yx_007@163.com> X-CM-TRANSID: EcCowABHWQyHYQxYnpqrBA--.5335S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF45WF1Dur48Gr4xGF18Grg_yoW8uw4fpa 97GFsrCr4vqFs8Ars7KFn7WF95AF97CryfKw18Jw4Iy3WfAFyDXF1kJ3y7KF47JrZ5uFW3 ZrWFyry5Aa1jyr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jCFAJUUUUU= X-Originating-IP: [114.111.167.207] X-CM-SenderInfo: 520ts5t0bqili6rwjhhfrp/1tbiFg8MxlWBTQ9CEQAAsW X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.15 Subject: [Qemu-devel] [PATCH 1/2] hw/timer: QOM'ify etraxfs_timer 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: edgar.iglesias@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP assign etraxfs_timer_init to etraxfs_timer_info.instance_init and drop the SysBusDeviceClass::init Reviewed-by: Edgar E. Iglesias Signed-off-by: xiaoqiang zhao --- hw/timer/etraxfs_timer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index 8e18236..bc4bc3a 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -302,9 +302,9 @@ static const MemoryRegionOps timer_ops = { } }; -static void etraxfs_timer_reset(void *opaque) +static void etraxfs_timer_reset(DeviceState *dev) { - ETRAXTimerState *t = opaque; + ETRAXTimerState *t = ETRAX_TIMER(dev); ptimer_stop(t->ptimer_t0); ptimer_stop(t->ptimer_t1); @@ -315,9 +315,10 @@ static void etraxfs_timer_reset(void *opaque) qemu_irq_lower(t->irq); } -static int etraxfs_timer_init(SysBusDevice *dev) +static void etraxfs_timer_init(Object *obj) { - ETRAXTimerState *t = ETRAX_TIMER(dev); + ETRAXTimerState *t = ETRAX_TIMER(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); t->bh_t0 = qemu_bh_new(timer0_hit, t); t->bh_t1 = qemu_bh_new(timer1_hit, t); @@ -329,24 +330,23 @@ static int etraxfs_timer_init(SysBusDevice *dev) sysbus_init_irq(dev, &t->irq); sysbus_init_irq(dev, &t->nmi); - memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, + memory_region_init_io(&t->mmio, obj, &timer_ops, t, "etraxfs-timer", 0x5c); sysbus_init_mmio(dev, &t->mmio); - qemu_register_reset(etraxfs_timer_reset, t); - return 0; } static void etraxfs_timer_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); - sdc->init = etraxfs_timer_init; + dc->reset = etraxfs_timer_reset; } static const TypeInfo etraxfs_timer_info = { .name = TYPE_ETRAX_FS_TIMER, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ETRAXTimerState), + .instance_init = etraxfs_timer_init, .class_init = etraxfs_timer_class_init, };