@@ -1258,8 +1258,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
{
int i;
DeviceState *hpet = NULL;
- int pit_isa_irq = 0;
- qemu_irq pit_alt_irq = NULL;
+ qemu_irq pit_irq;
qemu_irq rtc_irq = NULL;
ISADevice *pit = NULL;
MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
@@ -1301,9 +1300,10 @@ void pc_basic_device_init(struct PCMachineState *pcms,
for (i = 0; i < GSI_NUM_PINS; i++) {
sysbus_connect_irq(SYS_BUS_DEVICE(hpet), i, gsi[i]);
}
- pit_isa_irq = -1;
- pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT);
+ pit_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT);
rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT);
+ } else {
+ pit_irq = isa_bus_get_irq(isa_bus, 0);
}
*rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq);
@@ -1314,7 +1314,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
if (kvm_pit_in_kernel()) {
pit = kvm_pit_init(isa_bus, 0x40);
} else {
- pit = i8254_pit_init(isa_bus, 0x40, pit_isa_irq, pit_alt_irq);
+ pit = i8254_pit_create(isa_bus, 0x40, pit_irq);
}
if (hpet) {
/* connect PIT to output control line of the HPET */
@@ -59,9 +59,8 @@ ISADevice *i8254_pit_create(ISABus *bus, int iobase, qemu_irq irq_in);
static inline ISADevice *i8254_pit_init(ISABus *bus, int base, int isa_irq,
qemu_irq alt_irq)
{
- return i8254_pit_create(bus, base, isa_irq >= 0
- ? isa_bus_get_irq(bus, isa_irq)
- : alt_irq);
+ assert(isa_irq == 0 && alt_irq == NULL);
+ return i8254_pit_create(bus, base, isa_bus_get_irq(bus, 0));
}
static inline ISADevice *kvm_pit_init(ISABus *bus, int base)
pc_basic_device_init() is the single caller of i8254_pit_init() with a non-NULL 'alt_irq' argument. Open-code i8254_pit_init() by direclty calling i8254_pit_create(). To confirm all other callers pass a NULL 'alt_irq', add an assertion in i8254_pit_init(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/i386/pc.c | 10 +++++----- include/hw/timer/i8254.h | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-)