From nobody Tue May 7 10:21:46 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1503661661832893.615565988322; Fri, 25 Aug 2017 04:47:41 -0700 (PDT) Received: from localhost ([::1]:52663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dlD5Q-0005Rv-Ju for importer@patchew.org; Fri, 25 Aug 2017 07:47:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dlD4b-00054r-6M for qemu-devel@nongnu.org; Fri, 25 Aug 2017 07:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dlD4W-0001Rn-Oi for qemu-devel@nongnu.org; Fri, 25 Aug 2017 07:46:49 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:57764 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dlD4W-0001RP-IE; Fri, 25 Aug 2017 07:46:44 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 90CAC82286; Fri, 25 Aug 2017 13:46:42 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x3HzjyuCsnbY; Fri, 25 Aug 2017 13:46:42 +0200 (CEST) Received: from localhost.localdomain.localdomain (unknown [IPv6:2a01:e35:87f0:3180:2b18:7e65:c33:7f62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 1C9C082284; Fri, 25 Aug 2017 13:46:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com From: KONRAD Frederic To: qemu-devel@nongnu.org Date: Fri, 25 Aug 2017 13:46:09 +0200 Message-Id: <1503661569-11408-1-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH for-2.11] 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, thuth@redhat.com, frederic.konrad@adacore.com 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" 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 --- hw/misc/auxbus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 8a90ddd..1182745 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 1.8.3.1