From nobody Mon Feb 9 17:24:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506293231422535.4968685351988; Sun, 24 Sep 2017 15:47:11 -0700 (PDT) Received: from localhost ([::1]:39743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFfu-0006hh-Hg for importer@patchew.org; Sun, 24 Sep 2017 18:46:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFbD-0002pK-Vk for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwFbA-00082s-3c for qemu-devel@nongnu.org; Sun, 24 Sep 2017 18:42:08 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:46967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwFb9-00081g-Ri; Sun, 24 Sep 2017 18:42:04 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 63E8A41C97; Mon, 25 Sep 2017 01:42:00 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id EA89CC3B; Mon, 25 Sep 2017 00:22:56 +0300 (MSK) Received: (nullmailer pid 28278 invoked by uid 1000); Sun, 24 Sep 2017 21:22:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 00:22:37 +0300 Message-Id: <0aa6d8d3063477e615da8b9ff12e5bff9b0ac9bd.1506288070.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 19/31] aux-to-i2c-bridge: don't allow user to create one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, KONRAD Frederic , Michael Tokarev Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: KONRAD Frederic 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 Signed-off-by: KONRAD Frederic Reviewed-by: Thomas Huth Signed-off-by: Michael Tokarev --- 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; }; =20 +static void aux_bridge_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D 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 =3D false; +} + static void aux_bridge_init(Object *obj) { AUXTOI2CState *s =3D AUXTOI2C(obj); @@ -225,6 +235,7 @@ static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CSt= ate *bridge) static const TypeInfo aux_to_i2c_type_info =3D { .name =3D TYPE_AUXTOI2C, .parent =3D TYPE_DEVICE, + .class_init =3D aux_bridge_class_init, .instance_size =3D sizeof(AUXTOI2CState), .instance_init =3D aux_bridge_init }; --=20 2.11.0