diff mbox series

[4/4] qdev-monitor: Use qdev_get_parent_bus() in bus_print_dev()

Message ID 20230212224730.51438-5-philmd@linaro.org
State Superseded
Headers show
Series hw/qdev: Housekeeping around qdev_get_parent_bus() | expand

Commit Message

Philippe Mathieu-Daudé Feb. 12, 2023, 10:47 p.m. UTC
No need to pass 'dev' and 'dev->parent_bus' when we can
retrieve 'parent_bus' with qdev_get_parent_bus().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 softmmu/qdev-monitor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Richard Henderson Feb. 13, 2023, 11:31 p.m. UTC | #1
On 2/12/23 12:47, Philippe Mathieu-Daudé wrote:
> No need to pass 'dev' and 'dev->parent_bus' when we can
> retrieve 'parent_bus' with qdev_get_parent_bus().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   softmmu/qdev-monitor.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
> index 820e7f52ad..12e4899f0d 100644
> --- a/softmmu/qdev-monitor.c
> +++ b/softmmu/qdev-monitor.c
> @@ -770,9 +770,9 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
>       }
>   }
>   
> -static void bus_print_dev(BusState *bus, Monitor *mon, DeviceState *dev, int indent)
> +static void bus_print_dev(Monitor *mon, DeviceState *dev, int indent)
>   {
> -    BusClass *bc = BUS_GET_CLASS(bus);
> +    BusClass *bc = BUS_GET_CLASS(qdev_get_parent_bus(dev));
>   
>       if (bc->print_dev) {
>           bc->print_dev(mon, dev, indent);
> @@ -811,7 +811,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
>           qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
>           class = object_class_get_parent(class);
>       } while (class != object_class_by_name(TYPE_DEVICE));
> -    bus_print_dev(dev->parent_bus, mon, dev, indent);
> +    bus_print_dev(mon, dev, indent);
>       QLIST_FOREACH(child, &dev->child_bus, sibling) {
>           qbus_print(mon, child, indent);
>       }
diff mbox series

Patch

diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 820e7f52ad..12e4899f0d 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -770,9 +770,9 @@  static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
     }
 }
 
-static void bus_print_dev(BusState *bus, Monitor *mon, DeviceState *dev, int indent)
+static void bus_print_dev(Monitor *mon, DeviceState *dev, int indent)
 {
-    BusClass *bc = BUS_GET_CLASS(bus);
+    BusClass *bc = BUS_GET_CLASS(qdev_get_parent_bus(dev));
 
     if (bc->print_dev) {
         bc->print_dev(mon, dev, indent);
@@ -811,7 +811,7 @@  static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
         qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
         class = object_class_get_parent(class);
     } while (class != object_class_by_name(TYPE_DEVICE));
-    bus_print_dev(dev->parent_bus, mon, dev, indent);
+    bus_print_dev(mon, dev, indent);
     QLIST_FOREACH(child, &dev->child_bus, sibling) {
         qbus_print(mon, child, indent);
     }