qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] hw/core/qdev: Make qdev_pass_gpios() arguments self-describi


From: Philippe Mathieu-Daudé
Subject: [PATCH 1/2] hw/core/qdev: Make qdev_pass_gpios() arguments self-describing
Date: Tue, 18 Aug 2020 16:38:24 +0200

Make the direction qdev_pass_gpios() pass the GPIOs more obvious
by renaming its arguments as 'from_dev' and 'to_container'.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/qdev-core.h | 10 +++++-----
 hw/core/qdev.c         | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index ea3f73a282d..c72d4db2d26 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -643,8 +643,8 @@ static inline void qdev_init_gpio_in_named(DeviceState *dev,
 
 /**
  * qdev_pass_gpios: create GPIO lines on container which pass through to device
- * @dev: Device which has GPIO lines
- * @container: Container device which needs to expose them
+ * @from_dev: Device which has GPIO lines
+ * @to_container: Container device which needs to expose them
  * @name: Name of GPIO array to pass through (NULL for the anonymous GPIO 
array)
  *
  * In QEMU, complicated devices like SoCs are often modelled with a
@@ -653,14 +653,14 @@ static inline void qdev_init_gpio_in_named(DeviceState 
*dev,
  * to create GPIO arrays on itself which simply pass through to a GPIO
  * array of one of its internal devices.
  *
- * If @dev has both input and output GPIOs named @name then both will
+ * If @from_dev has both input and output GPIOs named @name then both will
  * be passed through. It is not possible to pass a subset of the array
  * with this function.
  *
- * To users of the container device, the GPIO array created on @container
+ * To users of the container device, the GPIO array created on @to_container
  * behaves exactly like any other.
  */
-void qdev_pass_gpios(DeviceState *dev, DeviceState *container,
+void qdev_pass_gpios(DeviceState *from_dev, DeviceState *to_container,
                      const char *name);
 
 BusState *qdev_get_parent_bus(DeviceState *dev);
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 96772a15bd5..79cbd990114 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -576,30 +576,30 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, 
qemu_irq pin)
     qdev_connect_gpio_out_named(dev, NULL, n, pin);
 }
 
-void qdev_pass_gpios(DeviceState *dev, DeviceState *container,
+void qdev_pass_gpios(DeviceState *from_dev, DeviceState *to_container,
                      const char *name)
 {
     int i;
-    NamedGPIOList *ngl = qdev_get_named_gpio_list(dev, name);
+    NamedGPIOList *ngl = qdev_get_named_gpio_list(from_dev, name);
 
     for (i = 0; i < ngl->num_in; i++) {
         const char *nm = ngl->name ? ngl->name : "unnamed-gpio-in";
         char *propname = g_strdup_printf("%s[%d]", nm, i);
 
-        object_property_add_alias(OBJECT(container), propname,
-                                  OBJECT(dev), propname);
+        object_property_add_alias(OBJECT(to_container), propname,
+                                  OBJECT(from_dev), propname);
         g_free(propname);
     }
     for (i = 0; i < ngl->num_out; i++) {
         const char *nm = ngl->name ? ngl->name : "unnamed-gpio-out";
         char *propname = g_strdup_printf("%s[%d]", nm, i);
 
-        object_property_add_alias(OBJECT(container), propname,
-                                  OBJECT(dev), propname);
+        object_property_add_alias(OBJECT(to_container), propname,
+                                  OBJECT(from_dev), propname);
         g_free(propname);
     }
     QLIST_REMOVE(ngl, node);
-    QLIST_INSERT_HEAD(&container->gpios, ngl, node);
+    QLIST_INSERT_HEAD(&to_container->gpios, ngl, node);
 }
 
 BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]