summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_mass_storage.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-10-09 10:06:00 +0200
committerFelipe Balbi <balbi@ti.com>2013-10-10 10:21:52 -0500
commit5de862d73b2c1b3fbb0ac8b45eb496d77347d1b8 (patch)
tree282ddf3024c8fb916ecbc7f218a966b0de710705 /drivers/usb/gadget/f_mass_storage.c
parent23682e3c78c54620ccc6e3462220851e1ae8b02f (diff)
downloadblackbird-obmc-linux-5de862d73b2c1b3fbb0ac8b45eb496d77347d1b8.tar.gz
blackbird-obmc-linux-5de862d73b2c1b3fbb0ac8b45eb496d77347d1b8.zip
usb: gadget: f_mass_storage: create fsg_common_run_thread for use in fsg_common_init
fsg_common_init is a lengthy function. Factor a portion of it out. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
-rw-r--r--drivers/usb/gadget/f_mass_storage.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 93a26b365e6a..5b99aa1846c3 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2996,6 +2996,24 @@ void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
i);
}
+int fsg_common_run_thread(struct fsg_common *common)
+{
+ common->state = FSG_STATE_IDLE;
+ /* Tell the thread to start working */
+ common->thread_task =
+ kthread_create(fsg_main_thread, common, "file-storage");
+ if (IS_ERR(common->thread_task)) {
+ common->state = FSG_STATE_TERMINATED;
+ return PTR_ERR(common->thread_task);
+ }
+
+ DBG(common, "I/O thread pid: %d\n", task_pid_nr(common->thread_task));
+
+ wake_up_process(common->thread_task);
+
+ return 0;
+}
+
struct fsg_common *fsg_common_init(struct fsg_common *common,
struct usb_composite_dev *cdev,
struct fsg_config *cfg)
@@ -3032,21 +3050,13 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
fsg_common_set_inquiry_string(common, cfg->vendor_name,
cfg->product_name);
- /* Tell the thread to start working */
- common->thread_task =
- kthread_create(fsg_main_thread, common, "file-storage");
- if (IS_ERR(common->thread_task)) {
- rc = PTR_ERR(common->thread_task);
- goto error_release;
- }
/* Information */
INFO(common, FSG_DRIVER_DESC ", version: " FSG_DRIVER_VERSION "\n");
- INFO(common, "Number of LUNs=%d\n", common->nluns);
-
- DBG(common, "I/O thread pid: %d\n", task_pid_nr(common->thread_task));
- wake_up_process(common->thread_task);
+ rc = fsg_common_run_thread(common);
+ if (rc)
+ goto error_release;
return common;
OpenPOWER on IntegriCloud