summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorEduardo Habkost2020-12-11 23:05:06 +0100
committerEduardo Habkost2020-12-15 16:02:07 +0100
commit828ade86ee925c132496113e7f88b22162d92ec5 (patch)
tree47bc5ecbf809d27330a09555c21bea5d605ddf46 /hw
parentqdev: Make bit_prop_set() get Object* argument (diff)
downloadqemu-828ade86ee925c132496113e7f88b22162d92ec5.tar.gz
qemu-828ade86ee925c132496113e7f88b22162d92ec5.tar.xz
qemu-828ade86ee925c132496113e7f88b22162d92ec5.zip
qdev: Make qdev_get_prop_ptr() get Object* arg
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> Reviewed-by: Cornelia Huck <cohuck@redhat.com> #s390 parts Acked-by: Paul Durrant <paul@xen.org> Message-Id: <20201211220529.2290218-10-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/xen-block.c5
-rw-r--r--hw/core/qdev-properties-system.c57
-rw-r--r--hw/core/qdev-properties.c82
-rw-r--r--hw/s390x/css.c5
-rw-r--r--hw/s390x/s390-pci-bus.c4
-rw-r--r--hw/vfio/pci-quirks.c5
6 files changed, 64 insertions, 94 deletions
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 8a7a3f5452..905e4acd97 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -335,9 +335,8 @@ static char *disk_to_vbd_name(unsigned int disk)
static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop);
+ XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
char *str;
switch (vdev->type) {
@@ -398,7 +397,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop);
+ XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
char *str, *p;
const char *end;
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 77b31eb9dc..9ac9b95852 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -59,9 +59,8 @@ static bool check_prop_still_unset(DeviceState *dev, const char *name,
static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- void **ptr = qdev_get_prop_ptr(dev, prop);
+ void **ptr = qdev_get_prop_ptr(obj, prop);
const char *value;
char *p;
@@ -87,7 +86,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- void **ptr = qdev_get_prop_ptr(dev, prop);
+ void **ptr = qdev_get_prop_ptr(obj, prop);
char *str;
BlockBackend *blk;
bool blk_created = false;
@@ -185,7 +184,7 @@ static void release_drive(Object *obj, const char *name, void *opaque)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- BlockBackend **ptr = qdev_get_prop_ptr(dev, prop);
+ BlockBackend **ptr = qdev_get_prop_ptr(obj, prop);
if (*ptr) {
AioContext *ctx = blk_get_aio_context(*ptr);
@@ -218,8 +217,7 @@ const PropertyInfo qdev_prop_drive_iothread = {
static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
- CharBackend *be = qdev_get_prop_ptr(dev, opaque);
+ CharBackend *be = qdev_get_prop_ptr(obj, opaque);
char *p;
p = g_strdup(be->chr && be->chr->label ? be->chr->label : "");
@@ -232,7 +230,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- CharBackend *be = qdev_get_prop_ptr(dev, prop);
+ CharBackend *be = qdev_get_prop_ptr(obj, prop);
Chardev *s;
char *str;
@@ -272,9 +270,8 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
static void release_chr(Object *obj, const char *name, void *opaque)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- CharBackend *be = qdev_get_prop_ptr(dev, prop);
+ CharBackend *be = qdev_get_prop_ptr(obj, prop);
qemu_chr_fe_deinit(be, false);
}
@@ -297,9 +294,8 @@ const PropertyInfo qdev_prop_chr = {
static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- MACAddr *mac = qdev_get_prop_ptr(dev, prop);
+ MACAddr *mac = qdev_get_prop_ptr(obj, prop);
char buffer[2 * 6 + 5 + 1];
char *p = buffer;
@@ -315,7 +311,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- MACAddr *mac = qdev_get_prop_ptr(dev, prop);
+ MACAddr *mac = qdev_get_prop_ptr(obj, prop);
int i, pos;
char *str;
const char *p;
@@ -381,9 +377,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
static void get_netdev(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
+ NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : "");
visit_type_str(v, name, &p, errp);
@@ -395,7 +390,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
+ NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
NetClientState **ncs = peers_ptr->ncs;
NetClientState *peers[MAX_QUEUE_NUM];
int queues, err = 0, i = 0;
@@ -461,9 +456,8 @@ const PropertyInfo qdev_prop_netdev = {
static void get_audiodev(Object *obj, Visitor *v, const char* name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop);
+ QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
char *p = g_strdup(audio_get_id(card));
visit_type_str(v, name, &p, errp);
@@ -475,7 +469,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop);
+ QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
AudioState *state;
int err = 0;
char *str;
@@ -582,7 +576,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
uint64_t value;
Error *local_err = NULL;
@@ -674,9 +668,8 @@ const PropertyInfo qdev_prop_multifd_compression = {
static void get_reserved_region(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
+ ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
char buffer[64];
char *p = buffer;
int rc;
@@ -693,7 +686,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
+ ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
Error *local_err = NULL;
const char *endptr;
char *str;
@@ -761,7 +754,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int32_t value, *ptr = qdev_get_prop_ptr(dev, prop);
+ int32_t value, *ptr = qdev_get_prop_ptr(obj, prop);
unsigned int slot, fn, n;
char *str;
@@ -804,8 +797,7 @@ invalid:
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);
+ int32_t *ptr = qdev_get_prop_ptr(obj, prop);
if (*ptr == -1) {
return snprintf(dest, len, "<unset>");
@@ -828,9 +820,8 @@ const PropertyInfo qdev_prop_pci_devfn = {
static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
+ PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
char buffer[] = "ffff:ff:ff.f";
char *p = buffer;
int rc = 0;
@@ -857,7 +848,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
+ PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
char *str, *p;
char *e;
unsigned long val;
@@ -951,9 +942,8 @@ const PropertyInfo qdev_prop_off_auto_pcibar = {
static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
+ PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
int speed;
switch (*p) {
@@ -982,7 +972,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
+ PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
int speed;
if (dev->realized) {
@@ -1028,9 +1018,8 @@ const PropertyInfo qdev_prop_pcie_link_speed = {
static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
+ PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
int width;
switch (*p) {
@@ -1068,7 +1057,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
+ PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
int width;
if (dev->realized) {
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 3a4638f4de..0a54a922c8 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -38,9 +38,9 @@ void qdev_prop_allow_set_link_before_realize(const Object *obj,
}
}
-void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
+void *qdev_get_prop_ptr(Object *obj, Property *prop)
{
- void *ptr = dev;
+ void *ptr = obj;
ptr += prop->offset;
return ptr;
}
@@ -48,9 +48,8 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int *ptr = qdev_get_prop_ptr(dev, prop);
+ int *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
}
@@ -60,7 +59,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int *ptr = qdev_get_prop_ptr(dev, prop);
+ int *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -94,8 +93,7 @@ static uint32_t qdev_get_prop_mask(Property *prop)
static void bit_prop_set(Object *obj, Property *props, bool val)
{
- DeviceState *dev = DEVICE(obj);
- uint32_t *p = qdev_get_prop_ptr(dev, props);
+ uint32_t *p = qdev_get_prop_ptr(obj, props);
uint32_t mask = qdev_get_prop_mask(props);
if (val) {
*p |= mask;
@@ -107,9 +105,8 @@ static void bit_prop_set(Object *obj, Property *props, bool val)
static void prop_get_bit(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *p = qdev_get_prop_ptr(dev, prop);
+ uint32_t *p = qdev_get_prop_ptr(obj, prop);
bool value = (*p & qdev_get_prop_mask(prop)) != 0;
visit_type_bool(v, name, &value, errp);
@@ -156,8 +153,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop)
static void bit64_prop_set(Object *obj, Property *props, bool val)
{
- DeviceState *dev = DEVICE(obj);
- uint64_t *p = qdev_get_prop_ptr(dev, props);
+ uint64_t *p = qdev_get_prop_ptr(obj, props);
uint64_t mask = qdev_get_prop_mask64(props);
if (val) {
*p |= mask;
@@ -169,9 +165,8 @@ static void bit64_prop_set(Object *obj, Property *props, bool val)
static void prop_get_bit64(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint64_t *p = qdev_get_prop_ptr(dev, prop);
+ uint64_t *p = qdev_get_prop_ptr(obj, prop);
bool value = (*p & qdev_get_prop_mask64(prop)) != 0;
visit_type_bool(v, name, &value, errp);
@@ -208,9 +203,8 @@ const PropertyInfo qdev_prop_bit64 = {
static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- bool *ptr = qdev_get_prop_ptr(dev, prop);
+ bool *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_bool(v, name, ptr, errp);
}
@@ -220,7 +214,7 @@ static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- bool *ptr = qdev_get_prop_ptr(dev, prop);
+ bool *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -242,9 +236,8 @@ const PropertyInfo qdev_prop_bool = {
static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint8(v, name, ptr, errp);
}
@@ -254,7 +247,7 @@ static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -288,9 +281,8 @@ const PropertyInfo qdev_prop_uint8 = {
void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint16_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint16(v, name, ptr, errp);
}
@@ -300,7 +292,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint16_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -322,9 +314,8 @@ const PropertyInfo qdev_prop_uint16 = {
static void get_uint32(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint32(v, name, ptr, errp);
}
@@ -334,7 +325,7 @@ static void set_uint32(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -347,9 +338,8 @@ static void set_uint32(Object *obj, Visitor *v, const char *name,
void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ int32_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_int32(v, name, ptr, errp);
}
@@ -359,7 +349,7 @@ static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ int32_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -388,9 +378,8 @@ const PropertyInfo qdev_prop_int32 = {
static void get_uint64(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint64(v, name, ptr, errp);
}
@@ -400,7 +389,7 @@ static void set_uint64(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -413,9 +402,8 @@ static void set_uint64(Object *obj, Visitor *v, const char *name,
static void get_int64(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ int64_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_int64(v, name, ptr, errp);
}
@@ -425,7 +413,7 @@ static void set_int64(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- int64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ int64_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@@ -454,15 +442,14 @@ const PropertyInfo qdev_prop_int64 = {
static void release_string(Object *obj, const char *name, void *opaque)
{
Property *prop = opaque;
- g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop));
+ g_free(*(char **)qdev_get_prop_ptr(obj, prop));
}
static void get_string(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- char **ptr = qdev_get_prop_ptr(dev, prop);
+ char **ptr = qdev_get_prop_ptr(obj, prop);
if (!*ptr) {
char *str = (char *)"";
@@ -477,7 +464,7 @@ static void set_string(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- char **ptr = qdev_get_prop_ptr(dev, prop);
+ char **ptr = qdev_get_prop_ptr(obj, prop);
char *str;
if (dev->realized) {
@@ -515,9 +502,8 @@ const PropertyInfo qdev_prop_on_off_auto = {
void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
uint64_t value = *ptr;
visit_type_size(v, name, &value, errp);
@@ -528,7 +514,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
uint64_t value;
if (dev->realized) {
@@ -563,9 +549,8 @@ const PropertyInfo qdev_prop_size32 = {
static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- QemuUUID *uuid = qdev_get_prop_ptr(dev, prop);
+ QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
char buffer[UUID_FMT_LEN + 1];
char *p = buffer;
@@ -581,7 +566,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- QemuUUID *uuid = qdev_get_prop_ptr(dev, prop);
+ QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
char *str;
if (dev->realized) {
@@ -653,7 +638,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
*/
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint32_t *alenptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *alenptr = qdev_get_prop_ptr(obj, prop);
void **arrayptr = (void *)dev + prop->arrayoffset;
void *eltptr;
const char *arrayname;
@@ -699,7 +684,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
* being inside the device struct.
*/
arrayprop->prop.offset = eltptr - (void *)dev;
- assert(qdev_get_prop_ptr(dev, &arrayprop->prop) == eltptr);
+ assert(qdev_get_prop_ptr(obj, &arrayprop->prop) == eltptr);
object_property_add(obj, propname,
arrayprop->prop.info->name,
arrayprop->prop.info->get,
@@ -893,9 +878,8 @@ void qdev_prop_set_globals(DeviceState *dev)
static void get_size(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_size(v, name, ptr, errp);
}
@@ -905,7 +889,7 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 9961cfe7bf..2b8f33fec2 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -2343,9 +2343,8 @@ void css_reset(void)
static void get_css_devid(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- CssDevId *dev_id = qdev_get_prop_ptr(dev, prop);
+ CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
char buffer[] = "xx.x.xxxx";
char *p = buffer;
int r;
@@ -2375,7 +2374,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- CssDevId *dev_id = qdev_get_prop_ptr(dev, prop);
+ CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
char *str;
int num, n1, n2;
unsigned int cssid, ssid, devid;
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 05f7460aec..8b6be1197b 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint32(v, name, ptr, errp);
}
@@ -1341,7 +1341,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
DeviceState *dev = DEVICE(obj);
S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
Property *prop = opaque;
- uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 57150913b7..53569925a2 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1488,9 +1488,8 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
- DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
+ uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
visit_type_uint8(v, name, ptr, errp);
}
@@ -1501,7 +1500,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v,
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
- uint8_t value, *ptr = qdev_get_prop_ptr(dev, prop);
+ uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop);
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);