]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/usb/gadget/g_dnl.c
usb:dfu:g_dnl: Change number of exported configurations at composite gadget
[karo-tx-uboot.git] / drivers / usb / gadget / g_dnl.c
index cc3f3449c97c85b2e4fad5ed46f3f55210d845fc..3cb7302b59031355b829cbfc5ee27c216891ba11 100644 (file)
@@ -4,19 +4,7 @@
  * Copyright (C) 2012 Samsung Electronics
  * Lukasz Majewski  <l.majewski@samsung.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <errno.h>
 
 #define STRING_MANUFACTURER 25
 #define STRING_PRODUCT 2
+/* Index of String Descriptor describing this configuration */
 #define STRING_USBDOWN 2
-#define CONFIG_USBDOWNLOADER 2
+/* Number of supported configurations */
+#define CONFIGURATION_NUMBER 1
 
 #define DRIVER_VERSION         "usb_dnl 2.0"
 
@@ -116,7 +106,7 @@ static int g_dnl_config_register(struct usb_composite_dev *cdev)
        static struct usb_configuration config = {
                .label = "usb_dnload",
                .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
-               .bConfigurationValue =  CONFIG_USBDOWNLOADER,
+               .bConfigurationValue =  CONFIGURATION_NUMBER,
                .iConfiguration =       STRING_USBDOWN,
 
                .bind = g_dnl_do_config,
@@ -125,6 +115,12 @@ static int g_dnl_config_register(struct usb_composite_dev *cdev)
        return usb_add_config(cdev, &config);
 }
 
+__weak
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
+{
+       return 0;
+}
+
 static int g_dnl_bind(struct usb_composite_dev *cdev)
 {
        struct usb_gadget *gadget = cdev->gadget;
@@ -147,6 +143,7 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
        g_dnl_string_defs[1].id = id;
        device_desc.iProduct = id;
 
+       g_dnl_bind_fixup(&device_desc);
        ret = g_dnl_config_register(cdev);
        if (ret)
                goto error;