In many cases, documentation around composite drivers suggest
setting the idVendor and other module params as follows:

$ insmod g_ffs.ko idVendor=<ID> iSerialNumber=<string>

However, this won't work if the driver is not compiled in as a
module, as the module_param permissions are S_IRUGO.

Thus this patch changes the composite module_param permissions
to S_IRUGO|S_IWUSR to allow the module_params to be set at
runtime via /sys/modules/<driver>/parameters/

Cc: Sebastian Andrzej Siewior <bige...@linutronix.de>
Cc: Andrzej Pietrasiewicz <andrze...@samsung.com>
Cc: Michal Nazarewicz <min...@mina86.com>
Cc: Felipe Balbi <ba...@ti.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: linux-...@vger.kernel.org
Signed-off-by: John Stultz <john.stu...@linaro.org>
---
 include/linux/usb/composite.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b09c37e..22b1b02 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -399,24 +399,28 @@ struct usb_composite_overwrite {
 #define USB_GADGET_COMPOSITE_OPTIONS()                                 \
        static struct usb_composite_overwrite coverwrite;               \
                                                                        \
-       module_param_named(idVendor, coverwrite.idVendor, ushort, S_IRUGO); \
+       module_param_named(idVendor, coverwrite.idVendor, ushort,       \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(idVendor, "USB Vendor ID");                    \
                                                                        \
-       module_param_named(idProduct, coverwrite.idProduct, ushort, S_IRUGO); \
+       module_param_named(idProduct, coverwrite.idProduct, ushort,     \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(idProduct, "USB Product ID");                  \
                                                                        \
-       module_param_named(bcdDevice, coverwrite.bcdDevice, ushort, S_IRUGO); \
+       module_param_named(bcdDevice, coverwrite.bcdDevice, ushort,     \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)");        \
                                                                        \
        module_param_named(iSerialNumber, coverwrite.serial_number, charp, \
-                       S_IRUGO); \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");         \
                                                                        \
        module_param_named(iManufacturer, coverwrite.manufacturer, charp, \
-                       S_IRUGO); \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");     \
                                                                        \
-       module_param_named(iProduct, coverwrite.product, charp, S_IRUGO); \
+       module_param_named(iProduct, coverwrite.product, charp,         \
+                       S_IRUGO|S_IWUSR);                               \
        MODULE_PARM_DESC(iProduct, "USB Product string")
 
 void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to