diff mbox

[08/10] qdev: Eliminate "global not used" warning

Message ID 1466022773-8965-9-git-send-email-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Habkost June 15, 2016, 8:32 p.m. UTC
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 <ehabkost@redhat.com>
---
 hw/core/qdev-properties.c    | 27 ---------------------------
 include/hw/qdev-properties.h |  1 -
 vl.c                         |  1 -
 3 files changed, 29 deletions(-)
diff mbox

Patch

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);