From: Michal Nazarewicz <mina86@mina86.com>
To: John Stultz <john.stultz@linaro.org>, linux-kernel@vger.kernel.org
Cc: John Stultz <john.stultz@linaro.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] [RFC] usb: gadget: composite: Allow idVendor and other module_params to be writable
Date: Thu, 21 Feb 2013 23:52:44 +0100 [thread overview]
Message-ID: <xa1tvc9lnutf.fsf@mina86.com> (raw)
In-Reply-To: <1361485647-9439-1-git-send-email-john.stultz@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3449 bytes --]
On Thu, Feb 21 2013, John Stultz wrote:
> 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/
If the driver is not compiled as a module, setting those variables won't
work anyway. Or am I missing something?
You can, however, pass them on Linux command line (with some prefix
which I can never remember).
If you want to configure things at run-time without having to compile
stuff as modules, you need to wait for the configfs based gadgets.
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
> Cc: Michal Nazarewicz <mina86@mina86.com>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@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
>
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2013-02-21 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-21 22:27 [PATCH] [RFC] usb: gadget: composite: Allow idVendor and other module_params to be writable John Stultz
2013-02-21 22:52 ` Michal Nazarewicz [this message]
2013-02-21 23:29 ` John Stultz
2013-02-21 23:53 ` Michal Nazarewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xa1tvc9lnutf.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox