Re: [PATCH 04/26] qdev: move helper function to monitor/misc

2020-01-10 Thread Philippe Mathieu-Daudé

On 1/10/20 4:30 PM, Marc-André Lureau wrote:

Move the one-user function to the place it is being used.

Signed-off-by: Marc-André Lureau 


Reviewed-by: Philippe Mathieu-Daudé 


---
  include/hw/qdev-core.h |  2 --
  hw/core/qdev.c | 26 --
  monitor/misc.c | 26 ++
  3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1518495b1e..6b0e7b265d 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -457,8 +457,6 @@ extern bool qdev_hot_removed;
  
  char *qdev_get_dev_path(DeviceState *dev);
  
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral);

-
  void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp);
  
  void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c2aa7f91a6..a520d7fa89 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -760,32 +760,6 @@ void qdev_alias_all_properties(DeviceState *target, Object 
*source)
  } while (class != object_class_by_name(TYPE_DEVICE));
  }
  
-static int qdev_add_hotpluggable_device(Object *obj, void *opaque)

-{
-GSList **list = opaque;
-DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
-  TYPE_DEVICE);
-
-if (dev == NULL) {
-return 0;
-}
-
-if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
-*list = g_slist_append(*list, dev);
-}
-
-return 0;
-}
-
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
-{
-GSList *list = NULL;
-
-object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
-
-return list;
-}
-
  static bool device_get_realized(Object *obj, Error **errp)
  {
  DeviceState *dev = DEVICE(obj);
diff --git a/monitor/misc.c b/monitor/misc.c
index a04d7edde0..be3c700511 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1954,6 +1954,32 @@ void object_add_completion(ReadLineState *rs, int 
nb_args, const char *str)
  g_slist_free(list);
  }
  
+static int qdev_add_hotpluggable_device(Object *obj, void *opaque)

+{
+GSList **list = opaque;
+DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+  TYPE_DEVICE);
+
+if (dev == NULL) {
+return 0;
+}
+
+if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+*list = g_slist_append(*list, dev);
+}
+
+return 0;
+}
+
+static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
+{
+GSList *list = NULL;
+
+object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
+
+return list;
+}
+
  static void peripheral_device_del_completion(ReadLineState *rs,
   const char *str, size_t len)
  {






[PATCH 04/26] qdev: move helper function to monitor/misc

2020-01-10 Thread Marc-André Lureau
Move the one-user function to the place it is being used.

Signed-off-by: Marc-André Lureau 
---
 include/hw/qdev-core.h |  2 --
 hw/core/qdev.c | 26 --
 monitor/misc.c | 26 ++
 3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1518495b1e..6b0e7b265d 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -457,8 +457,6 @@ extern bool qdev_hot_removed;
 
 char *qdev_get_dev_path(DeviceState *dev);
 
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral);
-
 void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp);
 
 void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c2aa7f91a6..a520d7fa89 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -760,32 +760,6 @@ void qdev_alias_all_properties(DeviceState *target, Object 
*source)
 } while (class != object_class_by_name(TYPE_DEVICE));
 }
 
-static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
-{
-GSList **list = opaque;
-DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
-  TYPE_DEVICE);
-
-if (dev == NULL) {
-return 0;
-}
-
-if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
-*list = g_slist_append(*list, dev);
-}
-
-return 0;
-}
-
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
-{
-GSList *list = NULL;
-
-object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
-
-return list;
-}
-
 static bool device_get_realized(Object *obj, Error **errp)
 {
 DeviceState *dev = DEVICE(obj);
diff --git a/monitor/misc.c b/monitor/misc.c
index a04d7edde0..be3c700511 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1954,6 +1954,32 @@ void object_add_completion(ReadLineState *rs, int 
nb_args, const char *str)
 g_slist_free(list);
 }
 
+static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
+{
+GSList **list = opaque;
+DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+  TYPE_DEVICE);
+
+if (dev == NULL) {
+return 0;
+}
+
+if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+*list = g_slist_append(*list, dev);
+}
+
+return 0;
+}
+
+static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
+{
+GSList *list = NULL;
+
+object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
+
+return list;
+}
+
 static void peripheral_device_del_completion(ReadLineState *rs,
  const char *str, size_t len)
 {
-- 
2.25.0.rc1.20.g2443f3f80d.dirty




Re: [PATCH 04/26] qdev: move helper function to monitor/misc

2019-12-01 Thread Philippe Mathieu-Daudé

On 12/1/19 12:15 PM, Marc-André Lureau wrote:

Move the one-user function to the place it is being used.

Signed-off-by: Marc-André Lureau 
---
  hw/core/qdev.c | 26 --
  include/hw/qdev-core.h |  2 --
  monitor/misc.c | 26 ++
  3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c1a338bbe4..90eb01bc8e 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -760,32 +760,6 @@ void qdev_alias_all_properties(DeviceState *target, Object 
*source)
  } while (class != object_class_by_name(TYPE_DEVICE));
  }
  
-static int qdev_add_hotpluggable_device(Object *obj, void *opaque)

-{
-GSList **list = opaque;
-DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
-  TYPE_DEVICE);
-
-if (dev == NULL) {
-return 0;
-}
-
-if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
-*list = g_slist_append(*list, dev);
-}
-
-return 0;
-}
-
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
-{
-GSList *list = NULL;
-
-object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
-
-return list;
-}
-
  static bool device_get_realized(Object *obj, Error **errp)
  {
  DeviceState *dev = DEVICE(obj);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1518495b1e..6b0e7b265d 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -457,8 +457,6 @@ extern bool qdev_hot_removed;
  
  char *qdev_get_dev_path(DeviceState *dev);
  
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral);

-
  void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp);
  
  void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);

diff --git a/monitor/misc.c b/monitor/misc.c
index 3baa15f3bf..36c85cecf3 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1956,6 +1956,32 @@ void object_add_completion(ReadLineState *rs, int 
nb_args, const char *str)
  g_slist_free(list);
  }
  
+static int qdev_add_hotpluggable_device(Object *obj, void *opaque)

+{
+GSList **list = opaque;
+DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+  TYPE_DEVICE);
+
+if (dev == NULL) {
+return 0;
+}
+
+if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+*list = g_slist_append(*list, dev);
+}
+
+return 0;
+}
+
+static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
+{
+GSList *list = NULL;
+
+object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
+
+return list;
+}
+
  static void peripheral_device_del_completion(ReadLineState *rs,
   const char *str, size_t len)
  {



Reviewed-by: Philippe Mathieu-Daudé 




[PATCH 04/26] qdev: move helper function to monitor/misc

2019-12-01 Thread Marc-André Lureau
Move the one-user function to the place it is being used.

Signed-off-by: Marc-André Lureau 
---
 hw/core/qdev.c | 26 --
 include/hw/qdev-core.h |  2 --
 monitor/misc.c | 26 ++
 3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c1a338bbe4..90eb01bc8e 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -760,32 +760,6 @@ void qdev_alias_all_properties(DeviceState *target, Object 
*source)
 } while (class != object_class_by_name(TYPE_DEVICE));
 }
 
-static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
-{
-GSList **list = opaque;
-DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
-  TYPE_DEVICE);
-
-if (dev == NULL) {
-return 0;
-}
-
-if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
-*list = g_slist_append(*list, dev);
-}
-
-return 0;
-}
-
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
-{
-GSList *list = NULL;
-
-object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
-
-return list;
-}
-
 static bool device_get_realized(Object *obj, Error **errp)
 {
 DeviceState *dev = DEVICE(obj);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1518495b1e..6b0e7b265d 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -457,8 +457,6 @@ extern bool qdev_hot_removed;
 
 char *qdev_get_dev_path(DeviceState *dev);
 
-GSList *qdev_build_hotpluggable_device_list(Object *peripheral);
-
 void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp);
 
 void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);
diff --git a/monitor/misc.c b/monitor/misc.c
index 3baa15f3bf..36c85cecf3 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1956,6 +1956,32 @@ void object_add_completion(ReadLineState *rs, int 
nb_args, const char *str)
 g_slist_free(list);
 }
 
+static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
+{
+GSList **list = opaque;
+DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+  TYPE_DEVICE);
+
+if (dev == NULL) {
+return 0;
+}
+
+if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+*list = g_slist_append(*list, dev);
+}
+
+return 0;
+}
+
+static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
+{
+GSList *list = NULL;
+
+object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
+
+return list;
+}
+
 static void peripheral_device_del_completion(ReadLineState *rs,
  const char *str, size_t len)
 {
-- 
2.24.0