From patchwork Thu Feb 21 22:27:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15024 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0C19C240B6 for ; Thu, 21 Feb 2013 22:28:01 +0000 (UTC) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by fiordland.canonical.com (Postfix) with ESMTP id 72597A18CB8 for ; Thu, 21 Feb 2013 22:28:00 +0000 (UTC) Received: by mail-ve0-f180.google.com with SMTP id jx10so32513veb.11 for ; Thu, 21 Feb 2013 14:28:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=9eKjMMckrHHoJPIrviGhbdEmzZmhIcXI8oj7a58znEU=; b=KsSkbjAOSQIqNqYy8lG6bEjqD5IL/MyeENhzEn8rAA3tSqrt3WoptVNBe+l+OdKYJj e502ZnFf8DlTRDTpYUvMHYC4IV0bIdk9u7sx8zuIJ2gt0t96SMgDnEOolNsqymp48A11 nHn9YQ6hy0j7ATiOdyyUV2V+3UV1fNMYFc6aPtqpPXB5GcZXLtNrUZhQYyWP3IXTaZP0 IMR3FmFcHbhoXKuz499DFhPs5BlTcoHvkQ76yR7eVHTeQQOAHj/JBgCMYE8tRM9Jpap8 QCV3nHulakd+Fgb0GI18kX33j/5oKn0l353uG7lKl8JbVX2939xHvcJJjPtQIXBO/ROt 2mEQ== X-Received: by 10.52.18.148 with SMTP id w20mr29133525vdd.8.1361485679874; Thu, 21 Feb 2013 14:27:59 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp59405veb; Thu, 21 Feb 2013 14:27:58 -0800 (PST) X-Received: by 10.66.221.6 with SMTP id qa6mr461760pac.181.1361485678030; Thu, 21 Feb 2013 14:27:58 -0800 (PST) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id u2si518983paw.96.2013.02.21.14.27.57 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 14:27:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.53 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.53; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.53 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: by mail-pa0-f53.google.com with SMTP id bg4so78916pad.12 for ; Thu, 21 Feb 2013 14:27:57 -0800 (PST) X-Received: by 10.66.164.97 with SMTP id yp1mr605688pab.47.1361485677339; Thu, 21 Feb 2013 14:27:57 -0800 (PST) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPS id z6sm472984pav.3.2013.02.21.14.27.55 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 14:27:56 -0800 (PST) From: John Stultz To: linux-kernel@vger.kernel.org Cc: John Stultz , Sebastian Andrzej Siewior , Andrzej Pietrasiewicz , Michal Nazarewicz , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH] [RFC] usb: gadget: composite: Allow idVendor and other module_params to be writable Date: Thu, 21 Feb 2013 14:27:27 -0800 Message-Id: <1361485647-9439-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQkYEzMcXdRBg1ffQIIwrqwh6ZNQNsmdCG3RrCqXYn/rUMt8zg7oJD1Ejyj2aII0TgkXyvmP In many cases, documentation around composite drivers suggest setting the idVendor and other module params as follows: $ insmod g_ffs.ko idVendor= iSerialNumber= 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//parameters/ Cc: Sebastian Andrzej Siewior Cc: Andrzej Pietrasiewicz Cc: Michal Nazarewicz Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Signed-off-by: John Stultz --- 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,