From patchwork Fri Sep 28 13:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 10619999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECEB53CF1 for ; Fri, 28 Sep 2018 13:57:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCF942B4AF for ; Fri, 28 Sep 2018 13:57:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D15992B55B; Fri, 28 Sep 2018 13:57:29 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 7CB152B4AF for ; Fri, 28 Sep 2018 13:57:29 +0000 (UTC) Received: from localhost ([::1]:43541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5tGq-0002oD-R6 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Sep 2018 09:57:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5tA9-0004Uo-1d for qemu-devel@nongnu.org; Fri, 28 Sep 2018 09:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5tA4-0006vh-Te for qemu-devel@nongnu.org; Fri, 28 Sep 2018 09:50:32 -0400 Received: from 1.mo177.mail-out.ovh.net ([178.33.107.143]:46000) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g5tA4-0006uV-Kn for qemu-devel@nongnu.org; Fri, 28 Sep 2018 09:50:28 -0400 Received: from player691.ha.ovh.net (unknown [10.109.146.132]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id EE4A4C6991 for ; Fri, 28 Sep 2018 15:50:26 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-10605-110.w90-89.abo.wanadoo.fr [90.89.196.110]) (Authenticated sender: clg@kaod.org) by player691.ha.ovh.net (Postfix) with ESMTPSA id 88CEC2600A3; Fri, 28 Sep 2018 15:50:22 +0200 (CEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Jason Wang , qemu-devel@nongnu.org Date: Fri, 28 Sep 2018 15:49:55 +0200 Message-Id: <20180928135003.8650-4-clg@kaod.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180928135003.8650-1-clg@kaod.org> References: <20180928135003.8650-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 3576421057817316351 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtjedruddtledgjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 178.33.107.143 Subject: [Qemu-devel] [PATCH 03/11] net: lan9118: convert SysBus init method to a realize method 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 , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Cédric Le Goater --- hw/net/lan9118.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index b9032dac595f..d99c6127b938 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -1320,9 +1320,9 @@ static NetClientInfo net_lan9118_info = { .link_status_changed = lan9118_set_link, }; -static int lan9118_init1(SysBusDevice *sbd) +static void lan9118_realize(DeviceState *dev, Error **errp) { - DeviceState *dev = DEVICE(sbd); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); lan9118_state *s = LAN9118(dev); QEMUBH *bh; int i; @@ -1349,8 +1349,6 @@ static int lan9118_init1(SysBusDevice *sbd) s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT); ptimer_set_freq(s->timer, 10000); ptimer_set_limit(s->timer, 0xffff, 1); - - return 0; } static Property lan9118_properties[] = { @@ -1362,12 +1360,11 @@ static Property lan9118_properties[] = { static void lan9118_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = lan9118_init1; dc->reset = lan9118_reset; dc->props = lan9118_properties; dc->vmsd = &vmstate_lan9118; + dc->realize = lan9118_realize; } static const TypeInfo lan9118_info = { @@ -1386,16 +1383,15 @@ static void lan9118_register_types(void) implemented. */ void lan9118_init(NICInfo *nd, uint32_t base, qemu_irq irq) { - DeviceState *dev; - SysBusDevice *s; + Object *obj; qemu_check_nic_model(nd, "lan9118"); - dev = qdev_create(NULL, TYPE_LAN9118); - qdev_set_nic_properties(dev, nd); - qdev_init_nofail(dev); - s = SYS_BUS_DEVICE(dev); - sysbus_mmio_map(s, 0, base); - sysbus_connect_irq(s, 0, irq); + + obj = object_new(TYPE_LAN9118); + qdev_set_nic_properties(DEVICE(obj), nd); + qdev_init_nofail(DEVICE(obj)); + sysbus_mmio_map(SYS_BUS_DEVICE(obj), 0, base); + sysbus_connect_irq(SYS_BUS_DEVICE(obj), 0, irq); } type_init(lan9118_register_types)