On Thu, Feb 15, 2024 at 8:55 AM Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > if (defaults_enabled() && object_class_by_name("pci-ohci")) { > > pci_create_simple(pci_bus, -1, "pci-ohci"); > > - usb_create_simple(usb_bus_find(-1), "usb-kbd"); > > - usb_create_simple(usb_bus_find(-1), "usb-tablet"); > > + Object *usb_bus = object_resolve_path_type("", TYPE_USB_BUS, NULL); > > + usb_create_simple(USB_BUS(usb_bus), "usb-kbd"); > > + usb_create_simple(USB_BUS(usb_bus), "usb-tablet"); > > } > > > > pci_init_nic_devices(pci_bus, mc->default_nic); > > Can we remove usb_bus_find() completely instead?
s/instead/in fact/ Yes, we can, but this would be just one patch in that series... Paolo > $ git grep -w usb_bus_find > hw/hppa/machine.c:401: usb_create_simple(usb_bus_find(-1), > "usb-kbd"); > hw/hppa/machine.c:402: usb_create_simple(usb_bus_find(-1), > "usb-mouse"); > hw/mips/loongson3_virt.c:450: usb_create_simple(usb_bus_find(-1), > "usb-kbd"); > hw/mips/loongson3_virt.c:451: usb_create_simple(usb_bus_find(-1), > "usb-tablet"); > hw/ppc/mac_newworld.c:434: USBBus *usb_bus = usb_bus_find(-1); > hw/ppc/sam460ex.c:423: usb_create_simple(usb_bus_find(-1), "usb-kbd"); > hw/ppc/sam460ex.c:424: usb_create_simple(usb_bus_find(-1), "usb-mouse"); > hw/ppc/spapr.c:3027: USBBus *usb_bus = usb_bus_find(-1); > hw/sh4/r2d.c:315: usb_create_simple(usb_bus_find(-1), "usb-kbd"); > hw/usb/bus.c:103:USBBus *usb_bus_find(int busnr) > hw/usb/bus.c:669: USBBus *bus = usb_bus_find(-1 /* any */); > include/hw/usb.h:500:USBBus *usb_bus_find(int busnr);