aboutsummaryrefslogtreecommitdiff
path: root/hw/char/serial-isa.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-04 18:33:05 +0100
committerAndreas Färber <afaerber@suse.de>2015-02-24 00:19:06 +0100
commitb6607a1a204d52fe13746cc9c3d2da4303e39b18 (patch)
tree6b3ea8bd8e36c6186b309b62577aaa5b2a7a5e8b /hw/char/serial-isa.c
parentaef0d55a4bc52b1713de88c100ba6dc451578e50 (diff)
serial: Factor out common serial_hds_isa_init()
It's the same old loop copied five times, plus another instance where it's clipped to two iterations and unrolled. No external users of serial_isa_init() are left, so give it internal linkage. Maintainers of affected machines cc'ed. Cc: Richard Henderson <rth@twiddle.net> Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/char/serial-isa.c')
-rw-r--r--hw/char/serial-isa.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index c9fcb2761f..059ceb8b5f 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -119,7 +119,7 @@ static void serial_register_types(void)
type_init(serial_register_types)
-bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
+static bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
{
DeviceState *dev;
ISADevice *isadev;
@@ -136,3 +136,16 @@ bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
}
return true;
}
+
+void serial_hds_isa_init(ISABus *bus, int n)
+{
+ int i;
+
+ assert(n <= MAX_SERIAL_PORTS);
+
+ for (i = 0; i < n; ++i) {
+ if (serial_hds[i]) {
+ serial_isa_init(bus, i, serial_hds[i]);
+ }
+ }
+}