[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/26] hw/usb/bus: Simplify usb_get_dev_path()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 16/26] hw/usb/bus: Simplify usb_get_dev_path() |
Date: |
Sat, 4 Jul 2020 16:49:33 +0200 |
Simplify usb_get_dev_path() a bit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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
- [PATCH 11/26] hw/usb/hcd-xhci: Add missing header, (continued)
- [PATCH 11/26] hw/usb/hcd-xhci: Add missing header, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 12/26] hw/usb/hcd-musb: Restrict header scope, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 14/26] hw/usb/quirks: Rename included source with '.inc.c' suffix, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 13/26] hw/usb/desc: Reduce some declarations scope, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 15/26] hw/usb: Add new 'usb-quirks.h' local header, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 16/26] hw/usb/bus: Simplify usb_get_dev_path(),
Philippe Mathieu-Daudé <=
- [PATCH 17/26] hw/usb/bus: Rename usb_get_dev_path() as usb_get_full_dev_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 18/26] hw/usb/bus: Add usb_get_port_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 20/26] hw/usb: Introduce "hw/usb/usb.h" public API, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 21/26] hw/usb: Move internal API to local 'usb-internal.h' header, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 22/26] hw/usb/usb-hcd: Use OHCI type definitions, Philippe Mathieu-Daudé, 2020/07/04