]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: composite: make module parameters accessible at runtime
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Thu, 10 May 2012 08:07:59 +0000 (10:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 May 2012 19:22:43 +0000 (12:22 -0700)
Enable module parameters to be modified at runtime, especially
if the module is compiled-in.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/composite.c

index a8b8ab80bc774a56e727207457bb4da88257c250..df2749052e2cfcd8fbd30fedf85fbd7783f59e6d 100644 (file)
@@ -40,27 +40,27 @@ static int (*composite_gadget_bind)(struct usb_composite_dev *cdev);
  */
 
 static ushort idVendor;
-module_param(idVendor, ushort, 0);
+module_param(idVendor, ushort, 0644);
 MODULE_PARM_DESC(idVendor, "USB Vendor ID");
 
 static ushort idProduct;
-module_param(idProduct, ushort, 0);
+module_param(idProduct, ushort, 0644);
 MODULE_PARM_DESC(idProduct, "USB Product ID");
 
 static ushort bcdDevice;
-module_param(bcdDevice, ushort, 0);
+module_param(bcdDevice, ushort, 0644);
 MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)");
 
 static char *iManufacturer;
-module_param(iManufacturer, charp, 0);
+module_param(iManufacturer, charp, 0644);
 MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");
 
 static char *iProduct;
-module_param(iProduct, charp, 0);
+module_param(iProduct, charp, 0644);
 MODULE_PARM_DESC(iProduct, "USB Product string");
 
 static char *iSerialNumber;
-module_param(iSerialNumber, charp, 0);
+module_param(iSerialNumber, charp, 0644);
 MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");
 
 static char composite_manufacturer[50];
@@ -1473,10 +1473,16 @@ static int composite_bind(struct usb_gadget *gadget)
        /* standardized runtime overrides for device ID data */
        if (idVendor)
                cdev->desc.idVendor = cpu_to_le16(idVendor);
+       else
+               idVendor = le16_to_cpu(cdev->desc.idVendor);
        if (idProduct)
                cdev->desc.idProduct = cpu_to_le16(idProduct);
+       else
+               idProduct = le16_to_cpu(cdev->desc.idProduct);
        if (bcdDevice)
                cdev->desc.bcdDevice = cpu_to_le16(bcdDevice);
+       else
+               bcdDevice = le16_to_cpu(cdev->desc.bcdDevice);
 
        /* string overrides */
        if (iManufacturer || !cdev->desc.iManufacturer) {