Skip to content

Commit

Permalink
hw/ppc/sam460ex: do not use usb_bus_find()
Browse files Browse the repository at this point in the history
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é <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240223124406.234509-3-pbonzini@redhat.com>
[PMD: Fixed style]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  • Loading branch information
bonzini authored and philmd committed Feb 27, 2024
1 parent ee3b34c commit 3ab78f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/ppc/sam460ex.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ static void sam460ex_init(MachineState *machine)
DeviceState *uic[4];
int i;
PCIBus *pci_bus;
USBBus *usb_bus;
PowerPCCPU *cpu;
CPUPPCState *env;
I2CBus *i2c;
Expand Down Expand Up @@ -421,8 +422,10 @@ 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));
usb_create_simple(usb_bus, "usb-kbd");
usb_create_simple(usb_bus, "usb-mouse");

/* PCIe buses */
dev = qdev_new(TYPE_PPC460EX_PCIE_HOST);
Expand Down

0 comments on commit 3ab78f3

Please sign in to comment.