diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index f4b9a0e2c8ccc9eb30e72a1c527e8964a436e0ea..099a7aa96f9588edb655d35272ad5bce7bcf82ba 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -931,11 +931,6 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name) return NULL; } -int qdev_prop_exists(DeviceState *dev, const char *name) -{ - return qdev_prop_find(dev, name) ? true : false; -} - void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, Property *prop, const char *value) { diff --git a/hw/qdev.c b/hw/qdev.c index 38ca58175f6cb4445ae202e40b6027fee64b2538..654cbcaccf3b4467c4ca7b60738e472dd670fca3 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -323,7 +323,7 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) if (nd->netdev) qdev_prop_set_netdev(dev, "netdev", nd->netdev); if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && - qdev_prop_exists(dev, "vectors")) { + object_property_find(OBJECT(dev), "vectors")) { qdev_prop_set_uint32(dev, "vectors", nd->nvectors); } nd->instantiated = 1; diff --git a/hw/qdev.h b/hw/qdev.h index e39f82e029c2648f1e4f85f9a2572e5a2bf485b3..ae1d2812bffb32c7b09e87c6e0b9cd28e328361c 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -306,7 +306,6 @@ extern PropertyInfo qdev_prop_blocksize; /* Set properties between creation and init. */ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop); -int qdev_prop_exists(DeviceState *dev, const char *name); int qdev_prop_parse(DeviceState *dev, const char *name, const char *value); void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value); void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value); diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index dbfccdc24ac8c998ebdee9a9af090775e59894e6..a4ae44b3443da3bd41f0c8b81be52ec4e87efd61 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -214,7 +214,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, if (bootindex >= 0) { qdev_prop_set_int32(dev, "bootindex", bootindex); } - if (qdev_prop_exists(dev, "removable")) { + if (object_property_find(OBJECT(dev), "removable")) { qdev_prop_set_bit(dev, "removable", removable); } if (qdev_prop_set_drive(dev, "drive", bdrv) < 0) { diff --git a/include/qemu/object.h b/include/qemu/object.h index b16d99be8c146d39e379193779dd9187d778b19a..8cac7da420f0ed2d8d8c0b2b5683d3e200426446 100644 --- a/include/qemu/object.h +++ b/include/qemu/object.h @@ -635,6 +635,15 @@ void object_property_add(Object *obj, const char *name, const char *type, void object_property_del(Object *obj, const char *name, struct Error **errp); +/** + * object_property_find: + * @obj: the object + * @name: the name of the property + * + * Look up a property for an object and return its #ObjectProperty if found. + */ +ObjectProperty *object_property_find(Object *obj, const char *name); + void object_unparent(Object *obj); /** diff --git a/qom/object.c b/qom/object.c index 27cc651a91c21a8cbf8002b5d3cf63c8a3371eaf..e072e895bbb9946ded038dc997dbc0d860917303 100644 --- a/qom/object.c +++ b/qom/object.c @@ -672,7 +672,7 @@ void object_property_add(Object *obj, const char *name, const char *type, QTAILQ_INSERT_TAIL(&obj->properties, prop, node); } -static ObjectProperty *object_property_find(Object *obj, const char *name) +ObjectProperty *object_property_find(Object *obj, const char *name) { ObjectProperty *prop;