aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/multi.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-09-26 14:38:16 +0200
committerFelipe Balbi <balbi@ti.com>2013-10-01 09:50:57 -0500
commit6fdc5dd25e0cd5afc114fe65427150c65f0eb67b (patch)
tree36d30eff7d42a7ddb4ca76d6387888bb892803be /drivers/usb/gadget/multi.c
parentusb: gadget: configfs: add a method to unregister the gadget (diff)
downloadlinux-dev-6fdc5dd25e0cd5afc114fe65427150c65f0eb67b.tar.xz
linux-dev-6fdc5dd25e0cd5afc114fe65427150c65f0eb67b.zip
usb: gadget: create a utility module for mass_storage
Converting to configfs requires making the f_mass_storage.c a module. But first we need to get rid of "#include "storage_common.c". This patch makes storage_common.c a separately compiled file, which is built as a utility module named u_ms.ko. After all mass storage users are converted to the new function interface this module can be eliminated by merging it with the mass storage function's module. USB descriptors are exported so that they can be accessed from f_mass_storage. FSG_VENDOR_ID and FSG_PRODUCT_ID are moved to their only user. Handling of CONFIG_USB_GADGET_DEBUG_FILES is moved to f_mass_storage.c. The fsg_num_buffers static is moved to FSG_MODULE_PARAMETER users, so instead of using a global variable the f_mass_storage introduces fsg_num_buffers member in fsg_common (and fsg_config). fsg_strings and fsg_stringtab are moved to f_mass_storage.c. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/multi.c')
-rw-r--r--drivers/usb/gadget/multi.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 23393254a8a3..6867d9dbbca4 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -132,6 +132,20 @@ static struct usb_gadget_strings *dev_strings[] = {
/****************************** Configurations ******************************/
static struct fsg_module_parameters fsg_mod_data = { .stall = 1 };
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
+
+static unsigned int fsg_num_buffers = CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS;
+
+#else
+
+/*
+ * Number of buffers we will use.
+ * 2 is usually enough for good buffering pipeline
+ */
+#define fsg_num_buffers CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS
+
+#endif /* CONFIG_USB_DEBUG */
+
FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
static struct fsg_common fsg_common;
@@ -294,7 +308,8 @@ static int __ref multi_bind(struct usb_composite_dev *cdev)
/* set up mass storage function */
{
void *retp;
- retp = fsg_common_from_params(&fsg_common, cdev, &fsg_mod_data);
+ retp = fsg_common_from_params(&fsg_common, cdev, &fsg_mod_data,
+ fsg_num_buffers);
if (IS_ERR(retp)) {
status = PTR_ERR(retp);
goto fail1;