]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
aux-to-i2c-bridge: don't allow user to create one
authorKONRAD Frederic <frederic.konrad@adacore.com>
Fri, 25 Aug 2017 11:46:09 +0000 (13:46 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 26 Sep 2017 06:06:02 +0000 (09:06 +0300)
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 <thuth@redhat.com>
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/misc/auxbus.c

index 8a90ddda8422bc7e5fb3c610edf985fc9f313952..118274504449c230d7b5243e6d1e6e9fe5493465 100644 (file)
@@ -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
 };