qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path()


From: Alistair Francis
Subject: Re: [PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path()
Date: Mon, 6 Jul 2020 17:07:47 -0700

On Sat, Jul 4, 2020 at 7:59 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> 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>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  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
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]