Message ID | 20200921221045.699690-23-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Series | qom: Convert some properties to class properties | expand |
On Mon, 21 Sep 2020 18:10:43 -0400 Eduardo Habkost <ehabkost@redhat.com> wrote: > Class properties make QOM introspection simpler and easier, as > they don't require an object to be instantiated. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> > Cc: qemu-devel@nongnu.org Reviewed-by: Igor Mammedov <imammedo@redhat.com> > --- > hw/pci-host/i440fx.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c > index 93c62235ca7..4454ba06621 100644 > --- a/hw/pci-host/i440fx.c > +++ b/hw/pci-host/i440fx.c > @@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj) > "pci-conf-idx", 4); > memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s, > "pci-conf-data", 4); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32", > - i440fx_pcihost_get_pci_hole_start, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32", > - i440fx_pcihost_get_pci_hole_end, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", > - i440fx_pcihost_get_pci_hole64_start, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", > - i440fx_pcihost_get_pci_hole64_end, > - NULL, NULL, NULL); > } > > static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) > @@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) > device_class_set_props(dc, i440fx_props); > /* Reason: needs to be wired up by pc_init1 */ > dc->user_creatable = false; > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32", > + i440fx_pcihost_get_pci_hole_start, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32", > + i440fx_pcihost_get_pci_hole_end, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", > + i440fx_pcihost_get_pci_hole64_start, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", > + i440fx_pcihost_get_pci_hole64_end, > + NULL, NULL, NULL); > } > > static const TypeInfo i440fx_pcihost_info = {
On Mon, Sep 21, 2020 at 06:10:43PM -0400, Eduardo Habkost wrote: > Class properties make QOM introspection simpler and easier, as > they don't require an object to be instantiated. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> > --- > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> > Cc: qemu-devel@nongnu.org > --- > hw/pci-host/i440fx.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c > index 93c62235ca7..4454ba06621 100644 > --- a/hw/pci-host/i440fx.c > +++ b/hw/pci-host/i440fx.c > @@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj) > "pci-conf-idx", 4); > memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s, > "pci-conf-data", 4); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32", > - i440fx_pcihost_get_pci_hole_start, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32", > - i440fx_pcihost_get_pci_hole_end, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", > - i440fx_pcihost_get_pci_hole64_start, > - NULL, NULL, NULL); > - > - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", > - i440fx_pcihost_get_pci_hole64_end, > - NULL, NULL, NULL); > } > > static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) > @@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) > device_class_set_props(dc, i440fx_props); > /* Reason: needs to be wired up by pc_init1 */ > dc->user_creatable = false; > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32", > + i440fx_pcihost_get_pci_hole_start, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32", > + i440fx_pcihost_get_pci_hole_end, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", > + i440fx_pcihost_get_pci_hole64_start, > + NULL, NULL, NULL); > + > + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", > + i440fx_pcihost_get_pci_hole64_end, > + NULL, NULL, NULL); > } > > static const TypeInfo i440fx_pcihost_info = { > -- > 2.26.2
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 93c62235ca7..4454ba06621 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj) "pci-conf-idx", 4); memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s, "pci-conf-data", 4); - - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32", - i440fx_pcihost_get_pci_hole_start, - NULL, NULL, NULL); - - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32", - i440fx_pcihost_get_pci_hole_end, - NULL, NULL, NULL); - - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", - i440fx_pcihost_get_pci_hole64_start, - NULL, NULL, NULL); - - object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", - i440fx_pcihost_get_pci_hole64_end, - NULL, NULL, NULL); } static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) @@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) device_class_set_props(dc, i440fx_props); /* Reason: needs to be wired up by pc_init1 */ dc->user_creatable = false; + + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32", + i440fx_pcihost_get_pci_hole_start, + NULL, NULL, NULL); + + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32", + i440fx_pcihost_get_pci_hole_end, + NULL, NULL, NULL); + + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64", + i440fx_pcihost_get_pci_hole64_start, + NULL, NULL, NULL); + + object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64", + i440fx_pcihost_get_pci_hole64_end, + NULL, NULL, NULL); } static const TypeInfo i440fx_pcihost_info = {
Class properties make QOM introspection simpler and easier, as they don't require an object to be instantiated. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Cc: qemu-devel@nongnu.org --- hw/pci-host/i440fx.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)