Paolo Bonzini <pbonz...@redhat.com> writes: > usb_bus_find() is always used with argument -1; it can be replaced with > a search of the single USB bus on the machine. > > Suggested-by: Philippe Mathieu-Daudé <phi...@linaro.org> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > hw/ppc/sam460ex.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c > index 1e615b8d355..4d5655ab6b4 100644 > --- a/hw/ppc/sam460ex.c > +++ b/hw/ppc/sam460ex.c > @@ -273,6 +273,7 @@ static void sam460ex_init(MachineState *machine) > DeviceState *uic[4]; > int i; > PCIBus *pci_bus; > + USBBus *usb_bus; > PowerPCCPU *cpu; > CPUPPCState *env; > I2CBus *i2c; > @@ -420,8 +421,9 @@ static void sam460ex_init(MachineState *machine) > sysbus_realize_and_unref(sbdev, &error_fatal); > sysbus_mmio_map(sbdev, 0, 0x4bffd0000); > sysbus_connect_irq(sbdev, 0, qdev_get_gpio_in(uic[2], 30)); > - usb_create_simple(usb_bus_find(-1), "usb-kbd"); > - usb_create_simple(usb_bus_find(-1), "usb-mouse"); > + usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS, > &error_abort));
This long line is really easy to break. > + usb_create_simple(usb_bus, "usb-kbd"); > + usb_create_simple(usb_bus, "usb-mouse"); > > /* PCIe buses */ > dev = qdev_new(TYPE_PPC460EX_PCIE_HOST);