summaryrefslogtreecommitdiffstats
path: root/hw/qdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index 9ccd5c3..a3bcf0b 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -112,8 +112,9 @@ struct Property {
const char *name;
PropertyInfo *info;
int offset;
- int bitnr;
- void *defval;
+ uint8_t bitnr;
+ uint8_t qtype;
+ int64_t defval;
};
enum PropertyType {
@@ -255,7 +256,8 @@ extern PropertyInfo qdev_prop_pci_devfn;
.info = &(_prop), \
.offset = offsetof(_state, _field) \
+ type_check(_type,typeof_field(_state, _field)), \
- .defval = (_type[]) { _defval }, \
+ .qtype = QTYPE_QINT, \
+ .defval = (_type)_defval, \
}
#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \
.name = (_name), \
@@ -263,7 +265,8 @@ extern PropertyInfo qdev_prop_pci_devfn;
.bitnr = (_bit), \
.offset = offsetof(_state, _field) \
+ type_check(uint32_t,typeof_field(_state, _field)), \
- .defval = (bool[]) { (_defval) }, \
+ .qtype = QTYPE_QBOOL, \
+ .defval = (bool)_defval, \
}
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
OpenPOWER on IntegriCloud