[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH target-arm v4 01/12] qom: Make uintXX added properti
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH target-arm v4 01/12] qom: Make uintXX added properties writable |
Date: |
Tue, 10 Dec 2013 18:53:31 -0800 |
Currently the uintXX property adders make a read only property. This
is not useful for devices that want to create board (or container)
configurable dynamic device properties. Fix by trivially adding property
setters to object_property_add_uintXX.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
changed since v3:
Dropped "/object" in subject (AF review)
changed since v2:
msg typo: "trivially"
qom/object.c | 44 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index fc19cf6..07b454b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1353,6 +1353,15 @@ static void property_get_uint8_ptr(Object *obj, Visitor
*v,
visit_type_uint8(v, &value, name, errp);
}
+static void property_set_uint8_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint8_t value;
+ visit_type_uint8(v, &value, name, errp);
+ *(uint8_t *)opaque = value;
+}
+
static void property_get_uint16_ptr(Object *obj, Visitor *v,
void *opaque, const char *name,
Error **errp)
@@ -1361,6 +1370,15 @@ static void property_get_uint16_ptr(Object *obj, Visitor
*v,
visit_type_uint16(v, &value, name, errp);
}
+static void property_set_uint16_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint16_t value;
+ visit_type_uint16(v, &value, name, errp);
+ *(uint16_t *)opaque = value;
+}
+
static void property_get_uint32_ptr(Object *obj, Visitor *v,
void *opaque, const char *name,
Error **errp)
@@ -1369,6 +1387,15 @@ static void property_get_uint32_ptr(Object *obj, Visitor
*v,
visit_type_uint32(v, &value, name, errp);
}
+static void property_set_uint32_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint32_t value;
+ visit_type_uint32(v, &value, name, errp);
+ *(uint32_t *)opaque = value;
+}
+
static void property_get_uint64_ptr(Object *obj, Visitor *v,
void *opaque, const char *name,
Error **errp)
@@ -1377,32 +1404,41 @@ static void property_get_uint64_ptr(Object *obj,
Visitor *v,
visit_type_uint64(v, &value, name, errp);
}
+static void property_set_uint64_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint64_t value;
+ visit_type_uint64(v, &value, name, errp);
+ *(uint64_t *)opaque = value;
+}
+
void object_property_add_uint8_ptr(Object *obj, const char *name,
const uint8_t *v, Error **errp)
{
object_property_add(obj, name, "uint8", property_get_uint8_ptr,
- NULL, NULL, (void *)v, errp);
+ property_set_uint8_ptr, NULL, (void *)v, errp);
}
void object_property_add_uint16_ptr(Object *obj, const char *name,
const uint16_t *v, Error **errp)
{
object_property_add(obj, name, "uint16", property_get_uint16_ptr,
- NULL, NULL, (void *)v, errp);
+ property_set_uint16_ptr, NULL, (void *)v, errp);
}
void object_property_add_uint32_ptr(Object *obj, const char *name,
const uint32_t *v, Error **errp)
{
object_property_add(obj, name, "uint32", property_get_uint32_ptr,
- NULL, NULL, (void *)v, errp);
+ property_set_uint32_ptr, NULL, (void *)v, errp);
}
void object_property_add_uint64_ptr(Object *obj, const char *name,
const uint64_t *v, Error **errp)
{
object_property_add(obj, name, "uint64", property_get_uint64_ptr,
- NULL, NULL, (void *)v, errp);
+ property_set_uint64_ptr, NULL, (void *)v, errp);
}
static void object_instance_init(Object *obj)
--
1.8.5.1
- [Qemu-devel] [PATCH target-arm v4 00/12] Fix Support for ARM CBAR and reset-hivecs, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 01/12] qom: Make uintXX added properties writable,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH target-arm v4 02/12] qom: Add object_property_add_bool_ptr(), Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 03/12] target-arm/helper.c: Allow cp15.c15 dummy override, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 04/12] target-arm: Define and use ARM_FEATURE_CBAR, Peter Crosthwaite, 2013/12/10
- Re: [Qemu-devel] [PATCH target-arm v4 00/12] Fix Support for ARM CBAR and reset-hivecs, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 05/12] target-arm/cpu: Convert reset CBAR to a property, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 06/12] arm/highbank: Use object_new() rather than cpu_arm_init(), Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 07/12] arm/highbank: Fix CBAR initialisation, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 08/12] arm/xilinx_zynq: Use object_new() rather than cpu_arm_init(), Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 09/12] arm/xilinx_zynq: Implement CBAR initialisation, Peter Crosthwaite, 2013/12/10
- [Qemu-devel] [PATCH target-arm v4 10/12] arm/highbank.c: Fix MPCore periphbase name, Peter Crosthwaite, 2013/12/10