aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/core/qdev-properties.c2
-rw-r--r--hw/core/qdev.c8
-rw-r--r--include/hw/qdev-core.h7
-rw-r--r--qdev-monitor.c2
-rw-r--r--qom/qom-qmp-cmds.c2
5 files changed, 13 insertions, 8 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 6ca7697599..43a915327b 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1071,7 +1071,7 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
/* device properties */
class = object_get_class(OBJECT(dev));
do {
- prop = qdev_prop_walk(DEVICE_CLASS(class)->props, name);
+ prop = qdev_prop_walk(DEVICE_CLASS(class)->props_, name);
if (prop) {
return prop;
}
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 8047ac9c26..100e266ec5 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -751,7 +751,7 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
do {
DeviceClass *dc = DEVICE_CLASS(class);
- for (prop = dc->props; prop && prop->name; prop++) {
+ for (prop = dc->props_; prop && prop->name; prop++) {
object_property_add_alias(source, prop->name,
OBJECT(target), prop->name,
&error_abort);
@@ -954,7 +954,7 @@ static void device_initfn(Object *obj)
class = object_get_class(OBJECT(dev));
do {
- for (prop = DEVICE_CLASS(class)->props; prop && prop->name; prop++) {
+ for (prop = DEVICE_CLASS(class)->props_; prop && prop->name; prop++) {
qdev_property_add_legacy(dev, prop, &error_abort);
qdev_property_add_static(dev, prop);
}
@@ -1013,7 +1013,7 @@ static void device_class_base_init(ObjectClass *class, void *data)
/* We explicitly look up properties in the superclasses,
* so do not propagate them to the subclasses.
*/
- klass->props = NULL;
+ klass->props_ = NULL;
}
static void device_unparent(Object *obj)
@@ -1063,7 +1063,7 @@ static void device_class_init(ObjectClass *class, void *data)
void device_class_set_props(DeviceClass *dc, Property *props)
{
- dc->props = props;
+ dc->props_ = props;
}
void device_class_set_parent_reset(DeviceClass *dc,
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 4065162251..506ad359c9 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -100,7 +100,12 @@ typedef struct DeviceClass {
DECLARE_BITMAP(categories, DEVICE_CATEGORY_MAX);
const char *fw_name;
const char *desc;
- Property *props;
+
+ /*
+ * The underscore at the end ensures a compile-time error if someone
+ * assigns to dc->props instead of using device_class_set_props.
+ */
+ Property *props_;
/*
* Can this device be instantiated with -device / device_add?
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 3465a1e2d0..c92926219f 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -748,7 +748,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
}
class = object_get_class(OBJECT(dev));
do {
- qdev_print_props(mon, dev, DEVICE_CLASS(class)->props, indent);
+ qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE));
bus_print_dev(dev->parent_bus, mon, dev, indent);
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
index f4494f98ac..ccd3aaacd4 100644
--- a/qom/qom-qmp-cmds.c
+++ b/qom/qom-qmp-cmds.c
@@ -137,7 +137,7 @@ static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
Property *prop;
do {
- for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
+ for (prop = DEVICE_CLASS(klass)->props_; prop && prop->name; prop++) {
if (strcmp(name, prop->name) != 0) {
continue;
}