• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂296097f7dd27aca4b24e0699efb6379c0eb6ff40 (tree)
時間2018-12-13 22:48:00
作者Mao Zhongyi <maozhongyi@cmss...>
CommiterPeter Maydell

Log Message

nvram/ds1225y: Convert sysbus init function to realize function

Use DeviceClass rather than SysBusDeviceClass in
nvram_sysbus_class_init().

Cc: pbonzini@redhat.com
Cc: marcandre.lureau@redhat.com

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181130093852.20739-15-maozhongyi@cmss.chinamobile.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Change Summary

差異

--- a/hw/nvram/ds1225y.c
+++ b/hw/nvram/ds1225y.c
@@ -25,6 +25,7 @@
2525 #include "qemu/osdep.h"
2626 #include "hw/sysbus.h"
2727 #include "trace.h"
28+#include "qemu/error-report.h"
2829
2930 typedef struct {
3031 MemoryRegion iomem;
@@ -113,7 +114,7 @@ typedef struct {
113114 NvRamState nvram;
114115 } SysBusNvRamState;
115116
116-static int nvram_sysbus_initfn(SysBusDevice *dev)
117+static void nvram_sysbus_realize(DeviceState *dev, Error **errp)
117118 {
118119 SysBusNvRamState *sys = DS1225Y(dev);
119120 NvRamState *s = &sys->nvram;
@@ -123,20 +124,18 @@ static int nvram_sysbus_initfn(SysBusDevice *dev)
123124
124125 memory_region_init_io(&s->iomem, OBJECT(s), &nvram_ops, s,
125126 "nvram", s->chip_size);
126- sysbus_init_mmio(dev, &s->iomem);
127+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
127128
128129 /* Read current file */
129130 file = s->filename ? fopen(s->filename, "rb") : NULL;
130131 if (file) {
131132 /* Read nvram contents */
132133 if (fread(s->contents, s->chip_size, 1, file) != 1) {
133- printf("nvram_sysbus_initfn: short read\n");
134+ error_report("nvram_sysbus_realize: short read");
134135 }
135136 fclose(file);
136137 }
137138 nvram_post_load(s, 0);
138-
139- return 0;
140139 }
141140
142141 static Property nvram_sysbus_properties[] = {
@@ -148,9 +147,8 @@ static Property nvram_sysbus_properties[] = {
148147 static void nvram_sysbus_class_init(ObjectClass *klass, void *data)
149148 {
150149 DeviceClass *dc = DEVICE_CLASS(klass);
151- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
152150
153- k->init = nvram_sysbus_initfn;
151+ dc->realize = nvram_sysbus_realize;
154152 dc->vmsd = &vmstate_nvram;
155153 dc->props = nvram_sysbus_properties;
156154 }