[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 36/37] qdev: remove QDEV_PROP_PTR
From: |
Marc-André Lureau |
Subject: |
[PATCH v4 36/37] qdev: remove QDEV_PROP_PTR |
Date: |
Wed, 20 Nov 2019 19:24:41 +0400 |
No longer used in the tree. The comment about user_creatable is still
quite relevant, but there is already a similar comment in qdev-core.h.
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/core/qdev-properties.c | 18 ------------------
include/hw/qdev-properties.h | 22 ----------------------
2 files changed, 40 deletions(-)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index be4cb01f0b..6271169d7d 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -469,13 +469,6 @@ const PropertyInfo qdev_prop_string = {
.set = set_string,
};
-/* --- pointer --- */
-
-/* Not a proper property, just for dirty hacks. TODO Remove it! */
-const PropertyInfo qdev_prop_ptr = {
- .name = "ptr",
-};
-
/* --- mac address --- */
/*
@@ -1133,17 +1126,6 @@ void qdev_prop_set_enum(DeviceState *dev, const char
*name, int value)
name, &error_abort);
}
-void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)
-{
- Property *prop;
- void **ptr;
-
- prop = qdev_prop_find(dev, name);
- assert(prop && prop->info == &qdev_prop_ptr);
- ptr = qdev_get_prop_ptr(dev, prop);
- *ptr = value;
-}
-
static GPtrArray *global_props(void)
{
static GPtrArray *gp;
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 5bba033b7b..a708c3870b 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -17,7 +17,6 @@ extern const PropertyInfo qdev_prop_size;
extern const PropertyInfo qdev_prop_string;
extern const PropertyInfo qdev_prop_chr;
extern const PropertyInfo qdev_prop_tpm;
-extern const PropertyInfo qdev_prop_ptr;
extern const PropertyInfo qdev_prop_macaddr;
extern const PropertyInfo qdev_prop_on_off_auto;
extern const PropertyInfo qdev_prop_losttickpolicy;
@@ -168,25 +167,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
DEFINE_PROP_SIGNED(_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->user_creatable = false;
- *
- * - If the property may safely remain null, document it like this:
- * |*
- * * Note: pointer property "interrupt_vector" may remain null, thus
- * * no need for dc->user_creatable = false;
- * *|
- */
-#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, CharBackend)
#define DEFINE_PROP_STRING(_n, _s, _f) \
@@ -259,8 +239,6 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name,
void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
const uint8_t *value);
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
-/* FIXME: Remove opaque pointer properties. */
-void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
void qdev_prop_register_global(GlobalProperty *prop);
int qdev_prop_check_globals(void);
--
2.24.0
- Re: [PATCH v4 28/37] qdev: use g_strcmp0() instead of open-coding it, (continued)
- [PATCH v4 29/37] RFC: mips/cps: fix setting saar property, Marc-André Lureau, 2019/11/20
- [PATCH v4 30/37] cris: improve passing PIC interrupt vector to the CPU, Marc-André Lureau, 2019/11/20
- [PATCH v4 31/37] smbus-eeprom: remove PROP_PTR, Marc-André Lureau, 2019/11/20
- [PATCH v4 32/37] omap-intc: remove PROP_PTR, Marc-André Lureau, 2019/11/20
- [PATCH v4 33/37] omap-i2c: remove PROP_PTR, Marc-André Lureau, 2019/11/20
- [PATCH v4 34/37] omap-gpio: remove PROP_PTR, Marc-André Lureau, 2019/11/20
- [PATCH v4 35/37] qdev: remove PROP_MEMORY_REGION, Marc-André Lureau, 2019/11/20
- [PATCH v4 36/37] qdev: remove QDEV_PROP_PTR,
Marc-André Lureau <=
- [PATCH v4 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone, Marc-André Lureau, 2019/11/20