[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path() |
Date: |
Sat, 4 Jul 2020 16:49:36 +0200 |
To avoid to access the USBDevice internals, and use the
recently added usb_get_port_path() helper instead.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/ppc/spapr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index f6f034d039..221d3e7a8c 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3121,7 +3121,8 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p,
BusState *bus,
* We use SRP luns of the form 01000000 | (usb-port << 16) | lun
* in the top 32 bits of the 64-bit LUN
*/
- unsigned usb_port = atoi(usb->port->path);
+ g_autofree char *usb_port_path = usb_get_port_path(usb);
+ unsigned usb_port = atoi(usb_port_path);
unsigned id = 0x1000000 | (usb_port << 16) | d->lun;
return g_strdup_printf("%s@%"PRIX64, qdev_fw_name(dev),
(uint64_t)id << 32);
@@ -3137,7 +3138,8 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p,
BusState *bus,
if (strcmp("usb-host", qdev_fw_name(dev)) == 0) {
USBDevice *usbdev = CAST(USBDevice, dev, TYPE_USB_DEVICE);
if (usb_host_dev_is_scsi_storage(usbdev)) {
- return g_strdup_printf("storage@%s/disk", usbdev->port->path);
+ g_autofree char *usb_port_path = usb_get_port_path(usbdev);
+ return g_strdup_printf("storage@%s/disk", usb_port_path);
}
}
--
2.21.3
- [PATCH 13/26] hw/usb/desc: Reduce some declarations scope, (continued)
- [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é, 2020/07/04
- [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é <=
- [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
- [PATCH 23/26] hw/usb/usb-hcd: Use EHCI type definitions, Philippe Mathieu-Daudé, 2020/07/04