Remove bonito_init() by inlining it.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
TBC next year.
---
include/hw/mips/mips.h | 3 ---
hw/mips/fuloong2e.c | 7 ++++++-
hw/pci-host/bonito.c | 15 ---------------
3 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/include/hw/mips/mips.h b/include/hw/mips/mips.h
index 6c9c8805f3f..609a33881f6 100644
--- a/include/hw/mips/mips.h
+++ b/include/hw/mips/mips.h
@@ -12,9 +12,6 @@
/* gt64xxx.c */
PCIBus *gt64120_register(qemu_irq *pic);
-/* bonito.c */
-PCIBus *bonito_init(qemu_irq *pic);
-
/* rc4030.c */
typedef struct rc4030DMAState *rc4030_dma;
void rc4030_dma_read(void *dma, uint8_t *buf, int len);
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 45c596f4fe5..19b3788e816 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -25,6 +25,7 @@
#include "qapi/error.h"
#include "cpu.h"
#include "hw/clock.h"
+#include "hw/pci-host/bonito.h"
#include "hw/intc/i8259.h"
#include "hw/dma/i8257.h"
#include "hw/isa/superio.h"
@@ -303,6 +304,7 @@ static void mips_fuloong2e_init(MachineState *machine)
MIPSCPU *cpu;
CPUMIPSState *env;
DeviceState *dev;
+ BonitoState *bonito;
cpuclk = clock_new(OBJECT(machine), "cpu-refclk");
clock_set_hz(cpuclk, 533080000); /* ~533 MHz */
@@ -360,7 +362,10 @@ static void mips_fuloong2e_init(MachineState *machine)
cpu_mips_clock_init(cpu);
/* North bridge, Bonito --> IP2 */
- pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
+ bonito = BONITO_PCI_HOST_BRIDGE(qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE));
+ bonito->pic = (qemu_irq *)&(env->irq[2]); /* TODO link/property */
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(bonito), &error_fatal);
+ pci_bus = PCI_HOST_BRIDGE(bonito)->bus;
/* South bridge -> IP5 */
vt82c686b_southbridge_init(pci_bus, FULOONG2E_VIA_SLOT, env->irq[5],
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index b959b353854..28d385ff363 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -714,21 +714,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp)
qemu_register_reset(bonito_reset, s);
}
-PCIBus *bonito_init(qemu_irq *pic)
-{
- DeviceState *dev;
- BonitoState *pcihost;
- PCIHostState *phb;
-
- dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
- phb = PCI_HOST_BRIDGE(dev);
- pcihost = BONITO_PCI_HOST_BRIDGE(dev);
- pcihost->pic = pic;
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
- return phb->bus;
-}
-
static void bonito_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
--
2.26.2