diff options
author | Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 2013-04-16 10:19:27 +1000 |
---|---|---|
committer | Edgar E. Iglesias <edgar.iglesias@gmail.com> | 2013-04-16 10:04:22 +0200 |
commit | f0e7a81c0ca122126e92a9f06b9599f04a0eaebb (patch) | |
tree | 54663ae11f983a9e1efab5d5a7ad5956298a9bb5 /hw/net | |
parent | 545129e58965dcedf229dac3ed7ea1235a9838f2 (diff) |
xilinx_axienet: Defined and use type cast macro
Standard QOM cast macro. Replaces usages of FROM_SYSBUS
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/xilinx_axienet.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 4cd048f974..6cb9a9b010 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -32,6 +32,11 @@ #define DPHY(x) +#define TYPE_XILINX_AXI_ENET "xlnx.axi-ethernet" + +#define XILINX_AXI_ENET(obj) \ + OBJECT_CHECK(XilinxAXIEnet, (obj), TYPE_XILINX_AXI_ENET) + /* Advertisement control register. */ #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ @@ -848,7 +853,7 @@ static NetClientInfo net_xilinx_enet_info = { static int xilinx_enet_init(SysBusDevice *dev) { - XilinxAXIEnet *s = FROM_SYSBUS(typeof(*s), dev); + XilinxAXIEnet *s = XILINX_AXI_ENET(dev); sysbus_init_irq(dev, &s->irq); @@ -873,7 +878,7 @@ static int xilinx_enet_init(SysBusDevice *dev) static void xilinx_enet_initfn(Object *obj) { - XilinxAXIEnet *s = FROM_SYSBUS(typeof(*s), SYS_BUS_DEVICE(obj)); + XilinxAXIEnet *s = XILINX_AXI_ENET(obj); Error *errp = NULL; object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE, @@ -901,7 +906,7 @@ static void xilinx_enet_class_init(ObjectClass *klass, void *data) } static const TypeInfo xilinx_enet_info = { - .name = "xlnx.axi-ethernet", + .name = TYPE_XILINX_AXI_ENET, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(XilinxAXIEnet), .class_init = xilinx_enet_class_init, |