Skip to content

Commit

Permalink
vl: remove serial_max_hds
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini committed Dec 10, 2020
1 parent bf4d405 commit 46ee119
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions hw/ppc/spapr.c
Expand Up @@ -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 */
Expand Down
4 changes: 0 additions & 4 deletions include/sysemu/sysemu.h
Expand Up @@ -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 */

Expand Down
5 changes: 0 additions & 5 deletions softmmu/vl.c
Expand Up @@ -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;
Expand Down

0 comments on commit 46ee119

Please sign in to comment.