summaryrefslogtreecommitdiffstats
path: root/include/hw/qdev-properties-system.h
diff options
context:
space:
mode:
authorEduardo Habkost2020-12-11 23:05:13 +0100
committerEduardo Habkost2020-12-18 21:20:17 +0100
commit45efa07f0f0cc8b3a6514c9743d29d73693aa8b1 (patch)
tree849fd2e5ab270c922e911c9986ae2c82ab869497 /include/hw/qdev-properties-system.h
parentqdev: Move softmmu properties to qdev-properties-system.h (diff)
downloadqemu-45efa07f0f0cc8b3a6514c9743d29d73693aa8b1.tar.gz
qemu-45efa07f0f0cc8b3a6514c9743d29d73693aa8b1.tar.xz
qemu-45efa07f0f0cc8b3a6514c9743d29d73693aa8b1.zip
qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros
Instead of duplicating the code that sets name, info, offset, and does type checking, make DEFINE_PROP accept a variable number of arguments and reuse it in all DEFINE_PROP_* macros. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20201211220529.2290218-17-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/qdev-properties-system.h')
-rw-r--r--include/hw/qdev-properties-system.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h
index 29529dc999..0ac327ae60 100644
--- a/include/hw/qdev-properties-system.h
+++ b/include/hw/qdev-properties-system.h
@@ -63,22 +63,15 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \
PCIExpLinkWidth)
-#define DEFINE_PROP_UUID(_name, _state, _field) { \
- .name = (_name), \
- .info = &qdev_prop_uuid, \
- .offset = offsetof(_state, _field) \
- + type_check(QemuUUID, typeof_field(_state, _field)), \
- .set_default = true, \
- }
+#define DEFINE_PROP_UUID(_name, _state, _field) \
+ DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \
+ .set_default = true)
+
#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard)
-#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \
- .name = (_name), \
- .info = &qdev_prop_uuid, \
- .offset = offsetof(_state, _field) \
- + type_check(QemuUUID, typeof_field(_state, _field)), \
- }
+#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \
+ DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID)
#endif