Patchwork [qom-cpu,for-1.5,2/4] qdev: Introduce qdev_prop_set_custom_globals()

login
register
mail settings
Submitter Andreas Färber
Date May 6, 2013, 5:50 p.m.
Message ID <5187ED65.9060808@suse.de>
Download mbox | patch
Permalink /patch/241737/
State New
Headers show

Comments

Andreas Färber - May 6, 2013, 5:50 p.m.
Am 01.05.2013 18:07, schrieb Andreas Färber:
> Reuse it in qdev_prop_set_globals().
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  hw/core/qdev-properties.c    | 35 ++++++++++++++++++++++++-----------
>  include/hw/qdev-properties.h |  2 ++
>  2 files changed, 26 insertions(+), 11 deletions(-)

Igor suggested to avoid "custom", so renaming to
qdev_prop_set_globals_for_type():

                                     Property *prop, const char *value);

Patch

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 68d1bff..3a324fb 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1099,15 +1099,15 @@  void
qdev_prop_register_global_list(GlobalProperty *props)
     }
 }

-void qdev_prop_set_custom_globals(DeviceState *dev, const char *driver,
-                                  Error **errp)
+void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,
+                                    Error **errp)
 {
     GlobalProperty *prop;

     QTAILQ_FOREACH(prop, &global_props, next) {
         Error *err = NULL;

-        if (strcmp(driver, prop->driver) != 0) {
+        if (strcmp(typename, prop->driver) != 0) {
             continue;
         }
         qdev_prop_parse(dev, prop->property, prop->value, &err);
@@ -1125,7 +1125,8 @@  void qdev_prop_set_globals(DeviceState *dev, Error
**errp)
     do {
         Error *err = NULL;

-        qdev_prop_set_custom_globals(dev, object_class_get_name(class),
&err);
+        qdev_prop_set_globals_for_type(dev, object_class_get_name(class),
+                                       &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 833300c..39448b7 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -169,8 +169,8 @@  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);
 void qdev_prop_set_globals(DeviceState *dev, Error **errp);
-void qdev_prop_set_custom_globals(DeviceState *dev, const char *driver,
-                                  Error **errp);
+void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,
+                                    Error **errp);
 void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState
*dev,