diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-11-03 03:26:05 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-12-10 12:15:19 -0500 |
commit | 46ee119fb64570c6efdff3342fbec3e86267bda3 (patch) | |
tree | 4c3e4950b8d7db44635e7af88eadb45f74c03932 | |
parent | bf4d4056fb7ef7d629d003a338445db9801aa743 (diff) |
vl: remove serial_max_hds
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.
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | hw/ppc/spapr.c | 6 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 4 | ||||
-rw-r--r-- | softmmu/vl.c | 5 |
3 files changed, 2 insertions, 13 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3f5b0d0159..6abb45d0ed 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 18cf586cd0..29c32f9851 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -71,10 +71,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 4c95537af3..43a0a45b68 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2159,11 +2159,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; |