nvram: QOM cast cleanups
cover nvram: QOM cast cleanups
Hello,
This series eliminates FROM_SYSBUS() in hw/nvram/.
Regards,
Andreas
Cc Hu Tao <[email protected]>
Andreas Färber (2):
ds1225y: Drop bogus qdev field from NvRamState
ds1225y: QOM cast cleanup
hw/nvram/ds1225y.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/2 ds1225y: Drop bogus qdev field from NvRamState
It is not a device, and the field is not used from code either.
Signed-off-by Andreas Färber <[email protected]>
--- hw/nvram/ds1225y.c | 1 - 1 file changed, 1 deletion(-)
hw/nvram/ds1225y.c +0 -1
@@ -26,7 +26,6 @@#include "trace.h" typedef struct { - DeviceState qdev; MemoryRegion iomem; uint32_t chip_size; char *filename;
Signature · 1 line
1.8.1.4
PATCH 2/2 ds1225y: QOM cast cleanup
In reply to Andreas FärberSigned-off-by Andreas Färber <[email protected]>
--- hw/nvram/ds1225y.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
hw/nvram/ds1225y.c +8 -3
@@ -104,14 +104,19 @@ static const VMStateDescription vmstate_nvram = { } }; +#define TYPE_DS1225Y "ds1225y" +#define DS1225Y (obj) OBJECT_CHECK(SysBusNvRamState, (obj), TYPE_DS1225Y) +typedef struct { -SysBusDevice busdev; +SysBusDevice parent_obj; +NvRamState nvram; }SysBusNvRamState ;static int nvram_sysbus_initfn (SysBusDevice *dev) { -NvRamState *s = &FROM_SYSBUS (SysBusNvRamState, dev)->nvram; +SysBusNvRamState *sys =DS1225Y (dev); +NvRamState *s = &sys->nvram;FILE *file; s->contents =g_malloc0 (s->chip_size);
@@ -151,7 +156,7 @@ static void nvram_sysbus_class_init(ObjectClass *klass, void *data) }static const TypeInfo nvram_sysbus_info = { - .name ="ds1225y" , + .name =TYPE_DS1225Y , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (SysBusNvRamState), .class_init = nvram_sysbus_class_init,
Signature · 1 line
1.8.1.4