[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/10] qdev: Eliminate "global not used" warning
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 08/10] qdev: Eliminate "global not used" warning |
Date: |
Wed, 15 Jun 2016 17:32:51 -0300 |
qdev_prop_check_globals() tries to warn the user if a given
-global option was not used. But it does that only if the device
is not hotpluggable.
The warning also makes it harder for management code or people
that write their own scripts or config files: there's no way to
know if a given -global option will trigger a warning or not,
because we don't have any introspection mechanism to check if a
machine-type instantiates a given device or not.
The warning is also the only reason we have the 'user_provided'
and 'used' fields in struct GlobalProperty. Removing the check
will let us simplify the code.
In other words, the warning is nearly useless and gets in our way
and our users' way. Remove it.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/core/qdev-properties.c | 27 ---------------------------
include/hw/qdev-properties.h | 1 -
vl.c | 1 -
3 files changed, 29 deletions(-)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 0fe7214..c14791d 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1036,33 +1036,6 @@ void qdev_prop_register_global_list(GlobalProperty
*props)
}
}
-int qdev_prop_check_globals(void)
-{
- GList *l;
- int ret = 0;
-
- for (l = global_props; l; l = l->next) {
- GlobalProperty *prop = l->data;
- ObjectClass *oc;
- DeviceClass *dc;
- if (prop->used) {
- continue;
- }
- if (!prop->user_provided) {
- continue;
- }
- oc = object_class_by_name(prop->driver);
- dc = DEVICE_CLASS(oc);
- if (!dc->hotpluggable && !prop->used) {
- error_report("Warning: global %s.%s=%s not used",
- prop->driver, prop->property, prop->value);
- ret = 1;
- continue;
- }
- }
- return ret;
-}
-
static void qdev_prop_set_globals_for_type(DeviceState *dev,
const char *typename)
{
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 034b75a..3bd5ea9 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -191,7 +191,6 @@ void qdev_prop_set_ptr(DeviceState *dev, const char *name,
void *value);
void qdev_prop_register_global(GlobalProperty *prop);
void qdev_prop_register_global_list(GlobalProperty *props);
-int qdev_prop_check_globals(void);
void qdev_prop_set_globals(DeviceState *dev);
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
Property *prop, const char *value);
diff --git a/vl.c b/vl.c
index 86d53ca..bf3bfa3 100644
--- a/vl.c
+++ b/vl.c
@@ -4623,7 +4623,6 @@ int main(int argc, char **argv, char **envp)
}
}
- qdev_prop_check_globals();
if (vmstate_dump_file) {
/* dump and exit */
dump_vmstate_json_to_file(vmstate_dump_file);
--
2.5.5
- Re: [Qemu-devel] [PATCH 03/10] vl: Reject invalid class names on -global, (continued)
- [Qemu-devel] [PATCH 01/10] qdev: Don't stop applying globals on first error, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 05/10] qdev: GlobalProperty.errp field, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 02/10] qdev: Eliminate qemu_add_globals() function, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 07/10] vl: Set errp to &error_abort on machine compat_props, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 08/10] qdev: Eliminate "global not used" warning,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 04/10] qdev: Use error_prepend() for errors applying globals, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 06/10] machine: Add machine_register_compat_props() function, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 10/10] machine: Skip global registration for non-existing classes, Eduardo Habkost, 2016/06/15
- [Qemu-devel] [PATCH 09/10] qdev: Eliminate GlobalProperty 'used' and 'user_provided' fields, Eduardo Habkost, 2016/06/15