Patchwork [qom-next,for-1.6,02/11] etraxfs_eth: QOM cast cleanup

login
register
mail settings
Submitter Andreas Färber
Date July 27, 2013, 2:24 p.m.
Message ID <51F3D839.20305@suse.de>
Download mbox | patch
Permalink /patch/262454/
State New
Headers show

Comments

Andreas Färber - July 27, 2013, 2:24 p.m.
Am 27.07.2013 12:44, schrieb Andreas Färber:
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  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

Patch

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);