From patchwork Sat Jul 27 14:24:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 262454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 457422C010F for ; Sun, 28 Jul 2013 00:29:37 +1000 (EST) Received: from localhost ([::1]:51333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V35V1-0005Y0-7w for incoming@patchwork.ozlabs.org; Sat, 27 Jul 2013 10:29:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V35Uk-0005X1-PG for qemu-devel@nongnu.org; Sat, 27 Jul 2013 10:29:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V35Ui-0004dd-T2 for qemu-devel@nongnu.org; Sat, 27 Jul 2013 10:29:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37248 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V35Qf-0003xF-58 for qemu-devel@nongnu.org; Sat, 27 Jul 2013 10:25:05 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7BE9DA51B7; Sat, 27 Jul 2013 16:25:01 +0200 (CEST) Message-ID: <51F3D839.20305@suse.de> Date: Sat, 27 Jul 2013 16:24:57 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Organization: SUSE LINUX Products GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: qemu-devel@nongnu.org References: <1374921903-13114-1-git-send-email-afaerber@suse.de> <1374921903-13114-3-git-send-email-afaerber@suse.de> In-Reply-To: <1374921903-13114-3-git-send-email-afaerber@suse.de> X-Enigmail-Version: 1.6a1pre X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH qom-next for-1.6 02/11] etraxfs_eth: QOM cast cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 27.07.2013 12:44, schrieb Andreas Färber: > Signed-off-by: Andreas Färber > --- > hw/net/etraxfs_eth.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c > index ab9a215..71b4fb8 100644 > --- a/hw/net/etraxfs_eth.c > +++ b/hw/net/etraxfs_eth.c > @@ -322,9 +322,14 @@ static void mdio_cycle(struct qemu_mdio *bus) > #define R_STAT 0x0b > #define FS_ETH_MAX_REGS 0x17 > > +#define TYPE_ETRAX_FS_ETH "etraxfs-eth" > +#define ETRAX_FS_ETH(obj) \ > + OBJECT_CHECK(struct fs_eth, (obj), TYPE_ETRAX_FS_ETH) > + > struct fs_eth > { > - SysBusDevice busdev; > + SysBusDevice parent_obj; > + > MemoryRegion mmio; > NICState *nic; > NICConf conf; > @@ -599,7 +604,7 @@ static NetClientInfo net_etraxfs_info = { > > static int fs_eth_init(SysBusDevice *dev) > { > - struct fs_eth *s = FROM_SYSBUS(typeof(*s), dev); > + struct fs_eth *s = ETRAX_FS_ETH(dev); > > if (!s->dma_out || !s->dma_in) { > hw_error("Unconnected ETRAX-FS Ethernet MAC.\n"); [snip] Needs the following addition. Andreas diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index b1febec..78ebbbc 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -602,8 +602,9 @@ static NetClientInfo net_etraxfs_info = { .link_status_changed = eth_set_link, }; -static int fs_eth_init(SysBusDevice *dev) +static int fs_eth_init(SysBusDevice *sbd) { + DeviceState *dev = DEVICE(sbd); ETRAXFSEthState *s = ETRAX_FS_ETH(dev); if (!s->dma_out || !s->dma_in) { @@ -617,11 +618,11 @@ static int fs_eth_init(SysBusDevice *dev) memory_region_init_io(&s->mmio, OBJECT(dev), ð_ops, s, "etraxfs-eth", 0x5c); - sysbus_init_mmio(dev, &s->mmio); + sysbus_init_mmio(sbd, &s->mmio); qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf, - object_get_typename(OBJECT(s)), dev->qdev.id, s); + object_get_typename(OBJECT(s)), dev->id, s); qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);