[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path()
- To: qemu-devel@xxxxxxxxxx, BALATON Zoltan <balaton@xxxxxxxxxx>
- From: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Date: Sat, 4 Jul 2020 16:49:36 +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:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxxxx>
---
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
|