[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 34/36] vl: remove serial_max_hds
From: |
Paolo Bonzini |
Subject: |
[PATCH 34/36] vl: remove serial_max_hds |
Date: |
Mon, 23 Nov 2020 09:14:33 -0500 |
serial_hd(i) is NULL if and only if i >= serial_max_hds(). Test
serial_hd(i) instead of bounding the loop at serial_max_hds(),
thus removing one more function that vl.c is expected to export.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/ppc/spapr.c | 6 ++----
include/sysemu/sysemu.h | 4 ----
softmmu/vl.c | 5 -----
3 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 049efa0bbf..b7e0894019 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2878,10 +2878,8 @@ static void spapr_machine_init(MachineState *machine)
/* Set up VIO bus */
spapr->vio_bus = spapr_vio_bus_init();
- for (i = 0; i < serial_max_hds(); i++) {
- if (serial_hd(i)) {
- spapr_vty_create(spapr->vio_bus, serial_hd(i));
- }
+ for (i = 0; serial_hd(i); i++) {
+ spapr_vty_create(spapr->vio_bus, serial_hd(i));
}
/* We always have at least the nvram device on VIO */
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 3dac3229ec..0e7b405d22 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -74,10 +74,6 @@ void hmp_pcie_aer_inject_error(Monitor *mon, const QDict
*qdict);
/* Return the Chardev for serial port i, or NULL if none */
Chardev *serial_hd(int i);
-/* return the number of serial ports defined by the user. serial_hd(i)
- * will always return NULL for any i which is greater than or equal to this.
- */
-int serial_max_hds(void);
/* parallel ports */
diff --git a/softmmu/vl.c b/softmmu/vl.c
index fce15c249a..d76f87028d 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1439,11 +1439,6 @@ Chardev *serial_hd(int i)
return NULL;
}
-int serial_max_hds(void)
-{
- return num_serial_hds;
-}
-
static int parallel_parse(const char *devname)
{
static int index = 0;
--
2.26.2
- [PATCH 36/36] vl: move all generic initialization out of vl.c, (continued)
- [PATCH 36/36] vl: move all generic initialization out of vl.c, Paolo Bonzini, 2020/11/23
- [PATCH 27/36] vl: remove separate preconfig main_loop, Paolo Bonzini, 2020/11/23
- [PATCH 32/36] vl: extract softmmu/runstate.c, Paolo Bonzini, 2020/11/23
- [PATCH 33/36] vl: extract softmmu/globals.c, Paolo Bonzini, 2020/11/23
- [PATCH 35/36] vl: clean up -boot variables, Paolo Bonzini, 2020/11/23
- [PATCH 34/36] vl: remove serial_max_hds,
Paolo Bonzini <=
- [PATCH 37/36] machine: introduce MachineInitPhase, Paolo Bonzini, 2020/11/27
- Re: [PATCH v3 00/36] cleanup qemu_init and make sense of command line processing, Igor Mammedov, 2020/11/30