diff mbox series

[2/2] hw/misc/mos6522: Do not open-code hmp_info_human_readable_text()

Message ID 20240610150758.2827-3-philmd@linaro.org
State New
Headers show
Series hw/misc/mos6522: Do not open-code hmp_info_human_readable_text() | expand

Commit Message

Philippe Mathieu-Daudé June 10, 2024, 3:07 p.m. UTC
Register the command 'info via' using HMPCommand::cmd_info_hrt(),
so it is processed using the generic hmp_info_human_readable_text().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/misc/mos6522.h    |  2 --
 include/monitor/hmp-target.h |  1 -
 hw/misc/mos6522.c            | 13 -------------
 hmp-commands-info.hx         |  2 +-
 4 files changed, 1 insertion(+), 17 deletions(-)

Comments

Daniel P. Berrangé June 10, 2024, 5:09 p.m. UTC | #1
On Mon, Jun 10, 2024 at 05:07:58PM +0200, Philippe Mathieu-Daudé wrote:
> Register the command 'info via' using HMPCommand::cmd_info_hrt(),
> so it is processed using the generic hmp_info_human_readable_text().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/hw/misc/mos6522.h    |  2 --
>  include/monitor/hmp-target.h |  1 -
>  hw/misc/mos6522.c            | 13 -------------
>  hmp-commands-info.hx         |  2 +-
>  4 files changed, 1 insertion(+), 17 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h
index fba45668ab..a54fe063ac 100644
--- a/include/hw/misc/mos6522.h
+++ b/include/hw/misc/mos6522.h
@@ -172,6 +172,4 @@  extern const VMStateDescription vmstate_mos6522;
 uint64_t mos6522_read(void *opaque, hwaddr addr, unsigned size);
 void mos6522_write(void *opaque, hwaddr addr, uint64_t val, unsigned size);
 
-void hmp_info_via(Monitor *mon, const QDict *qdict);
-
 #endif /* MOS6522_H */
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index b679aaebbf..9b46fec84a 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -53,7 +53,6 @@  void hmp_mce(Monitor *mon, const QDict *qdict);
 void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
 void hmp_info_sev(Monitor *mon, const QDict *qdict);
 void hmp_info_sgx(Monitor *mon, const QDict *qdict);
-void hmp_info_via(Monitor *mon, const QDict *qdict);
 void hmp_memory_dump(Monitor *mon, const QDict *qdict);
 void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
 void hmp_info_registers(Monitor *mon, const QDict *qdict);
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index b1bb7f54f0..afa343dd27 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -29,8 +29,6 @@ 
 #include "hw/misc/mos6522.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
-#include "monitor/monitor.h"
-#include "monitor/hmp.h"
 #include "qapi/qapi-commands-machine.h"
 #include "qapi/type-helpers.h"
 #include "qemu/timer.h"
@@ -587,17 +585,6 @@  HumanReadableText *qmp_x_query_mos6522_devices(Error **errp)
     return human_readable_text_from_str(buf);
 }
 
-void hmp_info_via(Monitor *mon, const QDict *qdict)
-{
-    Error *err = NULL;
-    g_autoptr(HumanReadableText) info = qmp_x_query_mos6522_devices(&err);
-
-    if (hmp_handle_error(mon, err)) {
-        return;
-    }
-    monitor_puts(mon, info->human_readable_text);
-}
-
 static const MemoryRegionOps mos6522_ops = {
     .read = mos6522_read,
     .write = mos6522_write,
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index cfd4ad5651..a24c217d89 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -873,7 +873,7 @@  ERST
         .args_type    = "",
         .params       = "",
         .help         = "show guest mos6522 VIA devices",
-        .cmd          = hmp_info_via,
+        .cmd_info_hrt = qmp_x_query_mos6522_devices,
     },
 #endif