[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 2/4] add QemuSupportState to DeviceClass
From: |
Gerd Hoffmann |
Subject: |
[Qemu-ppc] [PATCH 2/4] add QemuSupportState to DeviceClass |
Date: |
Tue, 30 Oct 2018 12:13:46 +0100 |
So we can tag device support state.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/hw/qdev-core.h | 2 ++
hw/core/qdev.c | 8 +++++++-
qdev-monitor.c | 7 +++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index a24d0dd566..ff6bd3f08f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -3,6 +3,7 @@
#include "qemu/queue.h"
#include "qemu/bitmap.h"
+#include "qemu/support-state.h"
#include "qom/object.h"
#include "hw/irq.h"
#include "hw/hotplug.h"
@@ -105,6 +106,7 @@ typedef struct DeviceClass {
*/
bool user_creatable;
bool hotpluggable;
+ QemuSupportState supported;
/* callbacks */
DeviceReset reset;
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 6b3cc55b27..e788fca257 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -133,11 +133,17 @@ DeviceState *qdev_create(BusState *bus, const char *name)
DeviceState *qdev_try_create(BusState *bus, const char *type)
{
+ DeviceClass *dc;
DeviceState *dev;
- if (object_class_by_name(type) == NULL) {
+ dc = DEVICE_CLASS(object_class_by_name(type));
+ if (dc == NULL) {
return NULL;
}
+ if (qemu_is_deprecated(&dc->supported) ||
+ qemu_is_obsolete(&dc->supported)) {
+ qemu_warn_support_state("device", type, &dc->supported);
+ }
dev = DEVICE(object_new(type));
if (!dev) {
return NULL;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 802c18a74e..63cb43691c 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -128,6 +128,9 @@ static void qdev_print_devinfo(DeviceClass *dc)
if (!dc->user_creatable) {
out_printf(", no-user");
}
+ if (dc->supported.state != SUPPORT_STATE_UNKNOWN) {
+ out_printf(", %s", SupportState_str(dc->supported.state));
+ }
out_printf("\n");
}
@@ -579,6 +582,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
if (!dc) {
return NULL;
}
+ if (qemu_is_deprecated(&dc->supported) ||
+ qemu_is_obsolete(&dc->supported)) {
+ qemu_warn_support_state("device", driver, &dc->supported);
+ }
/* find bus */
path = qemu_opt_get(opts, "bus");
--
2.9.3
- [Qemu-ppc] [PATCH 0/4] Introducing QemuSupportState, Gerd Hoffmann, 2018/10/30
- [Qemu-ppc] [PATCH 2/4] add QemuSupportState to DeviceClass,
Gerd Hoffmann <=
- [Qemu-ppc] [PATCH 4/4] switch machine types to QemuSupportState, Gerd Hoffmann, 2018/10/30
- [Qemu-ppc] [PATCH 1/4] add QemuSupportState, Gerd Hoffmann, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Philippe Mathieu-Daudé, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Gerd Hoffmann, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Philippe Mathieu-Daudé, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Cornelia Huck, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Philippe Mathieu-Daudé, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Eduardo Habkost, 2018/10/30
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, Cornelia Huck, 2018/10/31
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/4] add QemuSupportState, John Snow, 2018/10/31