[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill device_add |
Date: |
Tue, 24 Dec 2013 18:04:24 +0100 |
From: Markus Armbruster <address@hidden>
Ask users of DEFINE_PROP_PTR() to set
cannot_instantiate_with_device_add_yet, or explain why it's not
needed.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
include/hw/qdev-properties.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 692f82e..77c6f7c 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -122,8 +122,25 @@ extern PropertyInfo qdev_prop_arraylen;
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
+/*
+ * Please avoid pointer properties. If you must use them, you must
+ * cover them in their device's class init function as follows:
+ *
+ * - If the property must be set, the device cannot be used with
+ * device_add, so add code like this:
+ * |* Reason: pointer property "NAME-OF-YOUR-PROP" *|
+ * DeviceClass *dc = DEVICE_CLASS(class);
+ * dc->cannot_instantiate_with_device_add_yet = true;
+ *
+ * - If the property may safely remain null, document it like this:
+ * |*
+ * * Note: pointer property "interrupt_vector" may remain null, thus
+ * * no need for dc->cannot_instantiate_with_device_add_yet = true;
+ * *|
+ */
#define DEFINE_PROP_PTR(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
+
#define DEFINE_PROP_CHR(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharDriverState*)
#define DEFINE_PROP_STRING(_n, _s, _f) \
--
1.8.4
- [Qemu-devel] [PULL v2 05/24] pci-host: Consistently set cannot_instantiate_with_device_add_yet, (continued)
- [Qemu-devel] [PULL v2 05/24] pci-host: Consistently set cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 02/24] sysbus: Set cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 01/24] qdev: Replace no_user by cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 08/24] vt82c686: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 07/24] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 11/24] qdev-monitor: Avoid device_add crashing on non-device driver name, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 12/24] hw: cannot_instantiate_with_device_add_yet due to pointer props, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 15/24] qom: Do not register interface "types" in the type table and fix names, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 09/24] isa: Clean up use of cannot_instantiate_with_device_add_yet, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add when it cannot work, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill device_add,
Andreas Färber <=
- [Qemu-devel] [PULL v2 16/24] tests: Test QOM interface casting, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 17/24] qom: Detect bad reentrance during object_class_foreach(), Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 18/24] qdev: Drop misleading qbus_free() function, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 21/24] icc_bus: QOM'ify ICC, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 20/24] apic: QOM'ify APIC, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 19/24] apic: Cleanup for QOM'ification, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 22/24] ioapic: Cleanup for QOM'ification, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 23/24] ioapic: QOM'ify ioapic, Andreas Färber, 2013/12/24
- [Qemu-devel] [PULL v2 24/24] qdev-monitor: Improve error message for -device nonexistant, Andreas Färber, 2013/12/24