qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH 08/10] qdev: Eliminate "global not used" warning
Date: Wed, 15 Jun 2016 17:32:51 -0300	[thread overview]
Message-ID: <1466022773-8965-9-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1466022773-8965-1-git-send-email-ehabkost@redhat.com>

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

  parent reply	other threads:[~2016-06-15 20:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 20:32 [Qemu-devel] [PATCH 00/10] globals: Clean up validation and error checking Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 01/10] qdev: Don't stop applying globals on first error Eduardo Habkost
2016-06-19 16:40   ` Marcel Apfelbaum
2016-06-20  7:43   ` Markus Armbruster
2016-06-15 20:32 ` [Qemu-devel] [PATCH 02/10] qdev: Eliminate qemu_add_globals() function Eduardo Habkost
2016-06-20 12:03   ` Igor Mammedov
2016-06-15 20:32 ` [Qemu-devel] [PATCH 03/10] vl: Reject invalid class names on -global Eduardo Habkost
2016-06-20  7:56   ` Markus Armbruster
2016-06-20 12:44   ` Igor Mammedov
2016-06-15 20:32 ` [Qemu-devel] [PATCH 04/10] qdev: Use error_prepend() for errors applying globals Eduardo Habkost
2016-06-20  8:02   ` Markus Armbruster
2016-06-20 13:43     ` Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 05/10] qdev: GlobalProperty.errp field Eduardo Habkost
2016-06-20  8:14   ` Markus Armbruster
2016-06-20 13:45     ` Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 06/10] machine: Add machine_register_compat_props() function Eduardo Habkost
2016-06-19 16:25   ` Marcel Apfelbaum
2016-06-15 20:32 ` [Qemu-devel] [PATCH 07/10] vl: Set errp to &error_abort on machine compat_props Eduardo Habkost
2016-06-19 16:27   ` Marcel Apfelbaum
2016-06-15 20:32 ` Eduardo Habkost [this message]
2016-06-15 20:32 ` [Qemu-devel] [PATCH 09/10] qdev: Eliminate GlobalProperty 'used' and 'user_provided' fields Eduardo Habkost
2016-06-15 20:32 ` [Qemu-devel] [PATCH 10/10] machine: Skip global registration for non-existing classes Eduardo Habkost
2016-06-19 16:39   ` Marcel Apfelbaum
2016-06-19 16:50     ` Marcel Apfelbaum
2016-06-20 13:38       ` Eduardo Habkost
2016-06-20 13:11 ` [Qemu-devel] [PATCH 00/10] globals: Clean up validation and error checking Igor Mammedov
2016-06-20 13:48   ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466022773-8965-9-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).