qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PULL 19/31] aux-to-i2c-bridge: don't allow user to creat


From: Michael Tokarev
Subject: [Qemu-trivial] [PULL 19/31] aux-to-i2c-bridge: don't allow user to create one
Date: Mon, 25 Sep 2017 00:22:37 +0300

From: KONRAD Frederic <address@hidden>

This device is private and is created once per aux-bus.
So don't allow the user to create one from command-line.

Reported-by: Thomas Huth <address@hidden>
Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
 hw/misc/auxbus.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c
index 8a90ddda84..1182745044 100644
--- a/hw/misc/auxbus.c
+++ b/hw/misc/auxbus.c
@@ -210,6 +210,16 @@ struct AUXTOI2CState {
     I2CBus *i2c_bus;
 };
 
+static void aux_bridge_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    /* This device is private and is created only once for each
+     * aux-bus in aux_init_bus(..). So don't allow the user to add one.
+     */
+    dc->user_creatable = false;
+}
+
 static void aux_bridge_init(Object *obj)
 {
     AUXTOI2CState *s = AUXTOI2C(obj);
@@ -225,6 +235,7 @@ static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState 
*bridge)
 static const TypeInfo aux_to_i2c_type_info = {
     .name = TYPE_AUXTOI2C,
     .parent = TYPE_DEVICE,
+    .class_init = aux_bridge_class_init,
     .instance_size = sizeof(AUXTOI2CState),
     .instance_init = aux_bridge_init
 };
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]