ppc: QOM'ify mpc8544_guts device
cover ppc: QOM'ify mpc8544_guts device
Hi Alex,
Here's a mini-series cleaning up the mpc8544_guts device. One user of SysBusDeviceClass::init less to worry about. ;)
Regards,
Andreas
Andreas Färber (3):
mpc8544_guts: Fix MemoryRegion name
mpc8544_guts: QOM'ify
mpc8544_guts: Turn qdev initfn into instance_init
hw/ppc/mpc8544_guts.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/3 mpc8544_guts: Fix MemoryRegion name
6544 -> 8544
--- hw/ppc/mpc8544_guts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/mpc8544_guts.c +1 -1
@@ -115,7 +115,7 @@ static int mpc8544_guts_initfn(SysBusDevice *dev) s =FROM_SYSBUS (GutsState,SYS_BUS_DEVICE (dev));memory_region_init_io (&s->iomem, &mpc8544_guts_ops, s, -"mpc6544.guts" ,MPC8544_GUTS_MMIO_SIZE ); +"mpc8544.guts" ,MPC8544_GUTS_MMIO_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
Signature · 1 line
1.8.1.4
PATCH 2/3 mpc8544_guts: QOM'ify
In reply to Andreas FärberIntroduce type constant, cast macro and rename parent field.
--- hw/ppc/mpc8544_guts.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
hw/ppc/mpc8544_guts.c +9 -5
@@ -51,8 +51,14 @@#define MPC8544_GUTS_ADDR_SRDS2CR1 0xF10#define MPC8544_GUTS_ADDR_SRDS2CR3 0xF18 +#define TYPE_MPC8544_GUTS "mpc8544-guts" +#define MPC8544_GUTS (obj) OBJECT_CHECK(GutsState, (obj), TYPE_MPC8544_GUTS) +struct GutsState { -SysBusDevice busdev; +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ +MemoryRegion iomem; };
@@ -110,9 +116,7 @@ static const MemoryRegionOps mpc8544_guts_ops = {static int mpc8544_guts_initfn (SysBusDevice *dev) { -GutsState *s; - - s =FROM_SYSBUS (GutsState,SYS_BUS_DEVICE (dev)); +GutsState *s =MPC8544_GUTS (dev);memory_region_init_io (&s->iomem, &mpc8544_guts_ops, s,"mpc8544.guts" ,MPC8544_GUTS_MMIO_SIZE );
@@ -129,7 +133,7 @@ static void mpc8544_guts_class_init(ObjectClass *klass, void *data) }static const TypeInfo mpc8544_guts_info = { - .name ="mpc8544-guts" , + .name =TYPE_MPC8544_GUTS , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (GutsState), .class_init = mpc8544_guts_class_init,
Signature · 1 line
1.8.1.4
PATCH 3/3 mpc8544_guts: Turn qdev initfn into instance_init
In reply to Andreas FärberSysBus can deal with NULL SysBusDeviceClass::init since 4ce5dae.
--- hw/ppc/mpc8544_guts.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
hw/ppc/mpc8544_guts.c +5 -13
@@ -114,29 +114,21 @@ static const MemoryRegionOps mpc8544_guts_ops = { }, }; -static int mpc8544_guts_initfn (SysBusDevice *dev) +static void mpc8544_guts_initfn (Object *obj) { -GutsState *s =MPC8544_GUTS (dev); +SysBusDevice *d =SYS_BUS_DEVICE (obj); +GutsState *s =MPC8544_GUTS (obj);memory_region_init_io (&s->iomem, &mpc8544_guts_ops, s,"mpc8544.guts" ,MPC8544_GUTS_MMIO_SIZE ); -sysbus_init_mmio (dev, &s->iomem); - -return 0 ; -} - -static void mpc8544_guts_class_init (ObjectClass *klass,void *data) -{ -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - - k->init = mpc8544_guts_initfn; +sysbus_init_mmio (d, &s->iomem); }static const TypeInfo mpc8544_guts_info = { .name =TYPE_MPC8544_GUTS , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (GutsState), - .class_init = mpc8544_guts_class_init, + .instance_init = mpc8544_guts_initfn, };static void mpc8544_guts_register_types (void )
Signature · 1 line
1.8.1.4
Am 09.06.2013 22:47, schrieb Andreas Färber:
Quoted 4 lines
Hi Alex,
Here's a mini-series cleaning up the
mpc8544_gutsdevice. One user ofSysBusDeviceClass::initless to worry about. ;)
Ping!
Quoted 13 lines
Regards,
AndreasCc Alexander Graf <[email protected]>Andreas Färber (3):
mpc8544_guts: Fix MemoryRegion name
mpc8544_guts: QOM'ify
mpc8544_guts: Turn qdev initfn intoinstance_inithw/ppc/mpc8544_guts.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Alexander Graf
AppliedQuoted 4 lines · Andreas Färber
Hi Alex,
Here's a mini-series cleaning up the
mpc8544_gutsdevice. One user ofSysBusDeviceClass::initless to worry about. ;)
Thanks, applied to ppc-next.
Alex