aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-10-09 04:05:59 -0400
committerFelipe Balbi <balbi@ti.com>2013-10-10 11:21:51 -0400
commit23682e3c78c54620ccc6e3462220851e1ae8b02f (patch)
tree6ce6633403f0e53f1307da35ca99c8fcd93a3c77 /drivers/usb/gadget
parentb27c08c953e994f792a03d9b7cbc5cf3f9844135 (diff)
usb: gadget: f_mass_storage: create fsg_common_set_inquiry_string 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')
-rw-r--r--drivers/usb/gadget/f_mass_storage.c29
-rw-r--r--drivers/usb/gadget/f_mass_storage.h3
2 files changed, 22 insertions, 10 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 6a67e2ed75d9..93a26b365e6a 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2980,11 +2980,27 @@ fail:
2980 return rc; 2980 return rc;
2981} 2981}
2982 2982
2983void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
2984 const char *pn)
2985{
2986 int i;
2987
2988 /* Prepare inquiryString */
2989 i = get_default_bcdDevice();
2990 snprintf(common->inquiry_string, sizeof(common->inquiry_string),
2991 "%-8s%-16s%04x", vn ?: "Linux",
2992 /* Assume product name dependent on the first LUN */
2993 pn ?: ((*common->luns)->cdrom
2994 ? "File-CD Gadget"
2995 : "File-Stor Gadget"),
2996 i);
2997}
2998
2983struct fsg_common *fsg_common_init(struct fsg_common *common, 2999struct fsg_common *fsg_common_init(struct fsg_common *common,
2984 struct usb_composite_dev *cdev, 3000 struct usb_composite_dev *cdev,
2985 struct fsg_config *cfg) 3001 struct fsg_config *cfg)
2986{ 3002{
2987 int i, rc; 3003 int rc;
2988 3004
2989 common = fsg_common_setup(common); 3005 common = fsg_common_setup(common);
2990 if (IS_ERR(common)) 3006 if (IS_ERR(common))
@@ -3013,16 +3029,9 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
3013 if (rc) 3029 if (rc)
3014 goto error_release; 3030 goto error_release;
3015 3031
3016 /* Prepare inquiryString */
3017 i = get_default_bcdDevice();
3018 snprintf(common->inquiry_string, sizeof common->inquiry_string,
3019 "%-8s%-16s%04x", cfg->vendor_name ?: "Linux",
3020 /* Assume product name dependent on the first LUN */
3021 cfg->product_name ?: ((*common->luns)->cdrom
3022 ? "File-CD Gadget"
3023 : "File-Stor Gadget"),
3024 i);
3025 3032
3033 fsg_common_set_inquiry_string(common, cfg->vendor_name,
3034 cfg->product_name);
3026 /* Tell the thread to start working */ 3035 /* Tell the thread to start working */
3027 common->thread_task = 3036 common->thread_task =
3028 kthread_create(fsg_main_thread, common, "file-storage"); 3037 kthread_create(fsg_main_thread, common, "file-storage");
diff --git a/drivers/usb/gadget/f_mass_storage.h b/drivers/usb/gadget/f_mass_storage.h
index 2a51e7b1cc60..34a15d6bc3ca 100644
--- a/drivers/usb/gadget/f_mass_storage.h
+++ b/drivers/usb/gadget/f_mass_storage.h
@@ -123,6 +123,9 @@ int fsg_common_create_lun(struct fsg_common *common, struct fsg_lun_config *cfg,
123 123
124int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg); 124int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg);
125 125
126void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
127 const char *pn);
128
126void fsg_config_from_params(struct fsg_config *cfg, 129void fsg_config_from_params(struct fsg_config *cfg,
127 const struct fsg_module_parameters *params, 130 const struct fsg_module_parameters *params,
128 unsigned int fsg_num_buffers); 131 unsigned int fsg_num_buffers);