vl.c: new function serial_max_hds()
Create a new function serial_max_hds() which returns the number of serial ports defined by the user. This is needed only by spapr. This allows us to remove the MAX_SERIAL_PORTS define. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180420145249.32435-14-peter.maydell@linaro.org
This commit is contained in:
parent
6af2692e86
commit
b8846a4d63
@ -2589,7 +2589,7 @@ static void spapr_machine_init(MachineState *machine)
|
||||
/* Set up VIO bus */
|
||||
spapr->vio_bus = spapr_vio_bus_init();
|
||||
|
||||
for (i = 0; i < MAX_SERIAL_PORTS; i++) {
|
||||
for (i = 0; i < serial_max_hds(); i++) {
|
||||
if (serial_hd(i)) {
|
||||
spapr_vty_create(spapr->vio_bus, serial_hd(i));
|
||||
}
|
||||
|
@ -159,10 +159,12 @@ void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
|
||||
|
||||
/* serial ports */
|
||||
|
||||
#define MAX_SERIAL_PORTS 4
|
||||
|
||||
/* 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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user