usb: gadget: Use correct APIs and data types for UUID handling
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 25 Jan 2023 14:34:25 +0000 (16:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Jan 2023 09:37:29 +0000 (10:37 +0100)
We have two types for UUIDs depending on the byte ordering.
Instead of explaining how bytes should go over the wire,
use dedicated APIs and data types. This removes a confusion
over the byte ordering.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-By: Jó Ágila Bitsch <jgilab@gmail.com>
Link: https://lore.kernel.org/r/20230125143425.85268-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/composite.c
include/linux/usb/webusb.h

index 8e26036..fa7dd6c 100644 (file)
@@ -829,7 +829,7 @@ static int bos_desc(struct usb_composite_dev *cdev)
        if (cdev->use_webusb) {
                struct usb_plat_dev_cap_descriptor *webusb_cap;
                struct usb_webusb_cap_data *webusb_cap_data;
-               uuid_t webusb_uuid = WEBUSB_UUID;
+               guid_t webusb_uuid = WEBUSB_UUID;
 
                webusb_cap = cdev->req->buf + le16_to_cpu(bos->wTotalLength);
                webusb_cap_data = (struct usb_webusb_cap_data *) webusb_cap->CapabilityData;
@@ -841,7 +841,7 @@ static int bos_desc(struct usb_composite_dev *cdev)
                webusb_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
                webusb_cap->bDevCapabilityType = USB_PLAT_DEV_CAP_TYPE;
                webusb_cap->bReserved = 0;
-               export_uuid(webusb_cap->UUID, &webusb_uuid);
+               export_guid(webusb_cap->UUID, &webusb_uuid);
 
                if (cdev->bcd_webusb_version != 0)
                        webusb_cap_data->bcdVersion = cpu_to_le16(cdev->bcd_webusb_version);
index b430d84..fe43020 100644 (file)
 #include "uapi/linux/usb/ch9.h"
 
 /*
- * little endian PlatformCapablityUUID for WebUSB
+ * Little Endian PlatformCapablityUUID for WebUSB
  * 3408b638-09a9-47a0-8bfd-a0768815b665
- * to identify Platform Device Capability descriptors as referring to WebUSB
- *
- * the UUID above MUST be sent over the wire as the byte sequence:
- * {0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65}.
+ * to identify Platform Device Capability descriptors as referring to WebUSB.
  */
 #define WEBUSB_UUID \
-       UUID_INIT(0x38b60834, 0xa909, 0xa047, 0x8b, 0xfd, 0xa0, 0x76, 0x88, 0x15, 0xb6, 0x65)
+       GUID_INIT(0x3408b638, 0x09a9, 0x47a0, 0x8b, 0xfd, 0xa0, 0x76, 0x88, 0x15, 0xb6, 0x65)
 
 /*
  * WebUSB Platform Capability data