qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qom-next for-1.6 02/11] etraxfs_eth: QOM cast cl


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH qom-next for-1.6 02/11] etraxfs_eth: QOM cast cleanup
Date: Sat, 27 Jul 2013 16:24:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Am 27.07.2013 12:44, schrieb Andreas Färber:
> Signed-off-by: Andreas Färber <address@hidden>
> ---
>  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), &eth_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);




-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]