From nobody Thu Nov 6 12:14:39 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541501170068174.9594567045193; Tue, 6 Nov 2018 02:46:10 -0800 (PST) Received: from localhost ([::1]:40172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJys4-0007nq-Q9 for importer@patchew.org; Tue, 06 Nov 2018 05:46:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJykL-000699-PR for qemu-devel@nongnu.org; Tue, 06 Nov 2018 05:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJyWQ-0005Gw-DS for qemu-devel@nongnu.org; Tue, 06 Nov 2018 05:23:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58394) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJyWQ-0005GH-7Y; Tue, 06 Nov 2018 05:23:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D29C30014DC; Tue, 6 Nov 2018 10:23:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9317C18241; Tue, 6 Nov 2018 10:23:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C18F88FAE; Tue, 6 Nov 2018 11:23:35 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 6 Nov 2018 11:23:33 +0100 Message-Id: <20181106102335.20027-5-kraxel@redhat.com> In-Reply-To: <20181106102335.20027-1-kraxel@redhat.com> References: <20181106102335.20027-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 06 Nov 2018 10:23:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/6] Warn on obsolete and deprecated devices. 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: Eduardo Habkost , "Michael S. Tsirkin" , Alexander Graf , Markus Armbruster , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-ppc@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Print a warning for deprecated and obsolete devices. Also add support state to device listing. Signed-off-by: Gerd Hoffmann --- hw/core/qdev.c | 8 +++++++- qdev-monitor.c | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55b27..6205522c3e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -133,11 +133,17 @@ DeviceState *qdev_create(BusState *bus, const char *n= ame) =20 DeviceState *qdev_try_create(BusState *bus, const char *type) { + ObjectClass *oc; DeviceState *dev; =20 - if (object_class_by_name(type) =3D=3D NULL) { + oc =3D object_class_by_name(type); + if (oc =3D=3D NULL) { return NULL; } + if (qemu_is_deprecated(oc) || + qemu_is_obsolete(oc)) { + qemu_warn_support_state("device", type, oc); + } dev =3D DEVICE(object_new(type)); if (!dev) { return NULL; diff --git a/qdev-monitor.c b/qdev-monitor.c index 802c18a74e..80370372f9 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -115,6 +115,8 @@ static void out_printf(const char *fmt, ...) =20 static void qdev_print_devinfo(DeviceClass *dc) { + ObjectClass *oc =3D OBJECT_CLASS(dc); + out_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc))); if (dc->bus_type) { out_printf(", bus %s", dc->bus_type); @@ -128,6 +130,9 @@ static void qdev_print_devinfo(DeviceClass *dc) if (!dc->user_creatable) { out_printf(", no-user"); } + if (oc->supported.state !=3D SUPPORT_STATE_UNSPECIFIED) { + out_printf(", %s", SupportState_str(oc->supported.state)); + } out_printf("\n"); } =20 @@ -579,6 +584,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **e= rrp) if (!dc) { return NULL; } + if (qemu_is_deprecated(OBJECT_CLASS(dc)) || + qemu_is_obsolete(OBJECT_CLASS(dc))) { + qemu_warn_support_state("device", driver, OBJECT_CLASS(dc)); + } =20 /* find bus */ path =3D qemu_opt_get(opts, "bus"); --=20 2.9.3