Message ID | 20181119120820.29878-21-maozhongyi@cmss.chinamobile.com |
---|---|
State | New |
Headers | show |
Series | QOM'ify SysBusDeviceClass->init | expand |
On 19 November 2018 at 12:08, Mao Zhongyi <maozhongyi@cmss.chinamobile.com> wrote: > Use DeviceClass rather than SysBusDeviceClass in > xen_sysdev_class_init(). > > Cc: sstabellini@kernel.org > Cc: anthony.perard@citrix.com > Cc: xen-devel@lists.xenproject.org > > Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> > Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> > --- > hw/xen/xen_backend.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c > index 9a8e8771ec..73b0ed0169 100644 > --- a/hw/xen/xen_backend.c > +++ b/hw/xen/xen_backend.c > @@ -809,9 +809,8 @@ static const TypeInfo xensysbus_info = { > } > }; > > -static int xen_sysdev_init(SysBusDevice *dev) > +static void xen_sysdev_realize(DeviceState *dev, Error **errp) > { > - return 0; > } > > static Property xen_sysdev_properties[] = { > @@ -821,9 +820,8 @@ static Property xen_sysdev_properties[] = { > static void xen_sysdev_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = xen_sysdev_init; > + dc->realize = xen_sysdev_realize; > dc->props = xen_sysdev_properties; > dc->bus_type = TYPE_XENSYSBUS; > } If the realize function doesn't do anything at all, can't we just omit it ? thanks -- PMM
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index 9a8e8771ec..73b0ed0169 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -809,9 +809,8 @@ static const TypeInfo xensysbus_info = { } }; -static int xen_sysdev_init(SysBusDevice *dev) +static void xen_sysdev_realize(DeviceState *dev, Error **errp) { - return 0; } static Property xen_sysdev_properties[] = { @@ -821,9 +820,8 @@ static Property xen_sysdev_properties[] = { static void xen_sysdev_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = xen_sysdev_init; + dc->realize = xen_sysdev_realize; dc->props = xen_sysdev_properties; dc->bus_type = TYPE_XENSYSBUS; }