[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/26] hw/usb/bus: Simplify usb_get_dev_path()
- To: qemu-devel@xxxxxxxxxx, BALATON Zoltan <balaton@xxxxxxxxxx>
- From: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Date: Sat, 4 Jul 2020 16:49:33 +0200
- Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Huacai Chen <chenhc@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Magnus Damm <magnus.damm@xxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Leif Lindholm <leif@xxxxxxxxxxxx>, Andrzej Zaborowski <balrogg@xxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Beniamino Galvani <b.galvani@xxxxxxxxx>, Niek Linnenbank <nieklinnenbank@xxxxxxxxx>, qemu-arm@xxxxxxxxxx, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, Radoslaw Biernacki <radoslaw.biernacki@xxxxxxxxxx>, Igor Mitsyanko <i.mitsyanko@xxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>, Paul Zimmerman <pauldzim@xxxxxxxxx>, qemu-ppc@xxxxxxxxxx, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>
- Delivery-date: Sat, 04 Jul 2020 14:56:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Simplify usb_get_dev_path() a bit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
---
hw/usb/bus.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 111c3af7c1..f8901e822c 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -580,19 +580,18 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState
*qdev, int indent)
static char *usb_get_dev_path(DeviceState *qdev)
{
USBDevice *dev = USB_DEVICE(qdev);
- DeviceState *hcd = qdev->parent_bus->parent;
- char *id = NULL;
if (dev->flags & (1 << USB_DEV_FLAG_FULL_PATH)) {
- id = qdev_get_dev_path(hcd);
- }
- if (id) {
- char *ret = g_strdup_printf("%s/%s", id, dev->port->path);
- g_free(id);
- return ret;
- } else {
- return g_strdup(dev->port->path);
+ DeviceState *hcd = qdev->parent_bus->parent;
+ char *id = qdev_get_dev_path(hcd);
+
+ if (id) {
+ char *ret = g_strdup_printf("%s/%s", id, dev->port->path);
+ g_free(id);
+ return ret;
+ }
}
+ return g_strdup(dev->port->path);
}
static char *usb_get_fw_dev_path(DeviceState *qdev)
--
2.21.3
|