summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorEduardo Habkost2020-12-11 23:05:04 +0100
committerEduardo Habkost2020-12-15 16:02:07 +0100
commit40ea00b06671f888a6d7afab95335af8ced34d77 (patch)
treebeb3ae074ca882cb2c7331912aac83ca8b63fd28 /hw
parentqdev: Don't use dev->id on set_size32() error message (diff)
downloadqemu-40ea00b06671f888a6d7afab95335af8ced34d77.tar.gz
qemu-40ea00b06671f888a6d7afab95335af8ced34d77.tar.xz
qemu-40ea00b06671f888a6d7afab95335af8ced34d77.zip
qdev: Make PropertyInfo.print method get Object* argument
Make the code more generic and not specific to TYPE_DEVICE. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20201211220529.2290218-8-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/qdev-properties-system.c3
-rw-r--r--hw/core/qdev-properties.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 8912fb4e9c..77b31eb9dc 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -801,9 +801,10 @@ invalid:
g_free(str);
}
-static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
+static int print_pci_devfn(Object *obj, Property *prop, char *dest,
size_t len)
{
+ DeviceState *dev = DEVICE(obj);
int32_t *ptr = qdev_get_prop_ptr(dev, prop);
if (*ptr == -1) {
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index daf844c2d3..b6cf53e929 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -988,13 +988,12 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
char buffer[1024];
char *ptr = buffer;
- prop->info->print(dev, prop, buffer, sizeof(buffer));
+ prop->info->print(obj, prop, buffer, sizeof(buffer));
visit_type_str(v, name, &ptr, errp);
}