[RFC 11/19] usb/gadget: f_mass_storage: use fsg_common_set_cdev in fsg_common_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>

fsg_common_init is a lengthy function. Now there are helper functions
which cover all parts of it. Use them.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/usb/gadget/f_mass_storage.c |   23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index e828b89..a0ddd2c 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2980,7 +2980,6 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 	struct usb_gadget *gadget = cdev->gadget;
 	struct fsg_lun **curlun;
 	struct fsg_lun_config *lcfg;
-	struct usb_string *us;
 	int nluns, i, rc;
 	char *pathbuf;
 
@@ -3001,19 +3000,9 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 	fsg_common_set_ops(common, cfg->ops);
 	fsg_common_set_private_data(common, cfg->private_data);
 
-	common->gadget = gadget;
-	common->ep0 = gadget->ep0;
-	common->ep0req = cdev->req;
-	common->cdev = cdev;
-
-	us = usb_gstrings_attach(cdev, fsg_strings_array,
-				 ARRAY_SIZE(fsg_strings));
-	if (IS_ERR(us)) {
-		rc = PTR_ERR(us);
+	rc = fsg_common_set_cdev(common, cdev, cfg->can_stall);
+	if (rc)
 		goto error_release;
-	}
-	fsg_intf_desc.iInterface = us[FSG_STRING_INTERFACE].id;
-
 
 	rc = fsg_common_set_nluns(common, cfg->nluns);
 	if (rc)
@@ -3084,14 +3073,6 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 				     : "File-Stor Gadget"),
 		 i);
 
-	/*
-	 * Some peripheral controllers are known not to be able to
-	 * halt bulk endpoints correctly.  If one of them is present,
-	 * disable stalls.
-	 */
-	common->can_stall = cfg->can_stall &&
-		!(gadget_is_at91(common->gadget));
-
 
 	/* Tell the thread to start working */
 	common->thread_task =
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux