]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: gadget: config: Remove unused usb_gadget_config_buf
authorDr. David Alan Gilbert <linux@treblig.org>
Sun, 8 Jun 2025 23:33:37 +0000 (00:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 10:26:48 +0000 (12:26 +0200)
usb_gadget_config_buf() has been unused since 2012's
commit fa06920a3ece ("usb: gadget: Remove File-backed Storage Gadget
(g_file_storage).")

Remove it.

Signed-off-by: "Dr. David Alan Gilbert" <linux@treblig.org>
Link: https://lore.kernel.org/r/20250608233338.179894-2-linux@treblig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/config.c
include/linux/usb/gadget.h

index 95f144a54ed96fdd0e58bc2ac015484a89050258..256364d4b9411775e4557d99429ebc6ecba178a4 100644 (file)
@@ -53,59 +53,6 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
 }
 EXPORT_SYMBOL_GPL(usb_descriptor_fillbuf);
 
-/**
- * usb_gadget_config_buf - builts a complete configuration descriptor
- * @config: Header for the descriptor, including characteristics such
- *     as power requirements and number of interfaces.
- * @buf: Buffer for the resulting configuration descriptor.
- * @length: Length of buffer.  If this is not big enough to hold the
- *     entire configuration descriptor, an error code will be returned.
- * @desc: Null-terminated vector of pointers to the descriptors (interface,
- *     endpoint, etc) defining all functions in this device configuration.
- *
- * This copies descriptors into the response buffer, building a descriptor
- * for that configuration.  It returns the buffer length or a negative
- * status code.  The config.wTotalLength field is set to match the length
- * of the result, but other descriptor fields (including power usage and
- * interface count) must be set by the caller.
- *
- * Gadget drivers could use this when constructing a config descriptor
- * in response to USB_REQ_GET_DESCRIPTOR.  They will need to patch the
- * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed.
- */
-int usb_gadget_config_buf(
-       const struct usb_config_descriptor      *config,
-       void                                    *buf,
-       unsigned                                length,
-       const struct usb_descriptor_header      **desc
-)
-{
-       struct usb_config_descriptor            *cp = buf;
-       int                                     len;
-
-       /* config descriptor first */
-       if (length < USB_DT_CONFIG_SIZE || !desc)
-               return -EINVAL;
-       *cp = *config;
-
-       /* then interface/endpoint/class/vendor/... */
-       len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf,
-                       length - USB_DT_CONFIG_SIZE, desc);
-       if (len < 0)
-               return len;
-       len += USB_DT_CONFIG_SIZE;
-       if (len > 0xffff)
-               return -EINVAL;
-
-       /* patch up the config descriptor */
-       cp->bLength = USB_DT_CONFIG_SIZE;
-       cp->bDescriptorType = USB_DT_CONFIG;
-       cp->wTotalLength = cpu_to_le16(len);
-       cp->bmAttributes |= USB_CONFIG_ATT_ONE;
-       return len;
-}
-EXPORT_SYMBOL_GPL(usb_gadget_config_buf);
-
 /**
  * usb_copy_descriptors - copy a vector of USB descriptors
  * @src: null-terminated vector to copy
index df33333650a0d943324c3169619e85162ee5717f..0f28c5512fcb6ccd7a854ae8a66c21aec194c3c7 100644 (file)
@@ -860,10 +860,6 @@ container_of(str_item, struct gadget_string, item)
 int usb_descriptor_fillbuf(void *, unsigned,
                const struct usb_descriptor_header **);
 
-/* build config descriptor from single descriptor vector */
-int usb_gadget_config_buf(const struct usb_config_descriptor *config,
-       void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
-
 /* copy a NULL-terminated vector of descriptors */
 struct usb_descriptor_header **usb_copy_descriptors(
                struct usb_descriptor_header **);