aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/file_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r--drivers/usb/gadget/file_storage.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index bf3f946fd455..47bb9f09a1aa 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -2307,6 +2307,29 @@ static int halt_bulk_in_endpoint(struct fsg_dev *fsg)
2307 return rc; 2307 return rc;
2308} 2308}
2309 2309
2310static int wedge_bulk_in_endpoint(struct fsg_dev *fsg)
2311{
2312 int rc;
2313
2314 DBG(fsg, "bulk-in set wedge\n");
2315 rc = usb_ep_set_wedge(fsg->bulk_in);
2316 if (rc == -EAGAIN)
2317 VDBG(fsg, "delayed bulk-in endpoint wedge\n");
2318 while (rc != 0) {
2319 if (rc != -EAGAIN) {
2320 WARN(fsg, "usb_ep_set_wedge -> %d\n", rc);
2321 rc = 0;
2322 break;
2323 }
2324
2325 /* Wait for a short time and then try again */
2326 if (msleep_interruptible(100) != 0)
2327 return -EINTR;
2328 rc = usb_ep_set_wedge(fsg->bulk_in);
2329 }
2330 return rc;
2331}
2332
2310static int pad_with_zeros(struct fsg_dev *fsg) 2333static int pad_with_zeros(struct fsg_dev *fsg)
2311{ 2334{
2312 struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; 2335 struct fsg_buffhd *bh = fsg->next_buffhd_to_fill;
@@ -2957,7 +2980,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2957 * We aren't required to halt the OUT endpoint; instead 2980 * We aren't required to halt the OUT endpoint; instead
2958 * we can simply accept and discard any data received 2981 * we can simply accept and discard any data received
2959 * until the next reset. */ 2982 * until the next reset. */
2960 halt_bulk_in_endpoint(fsg); 2983 wedge_bulk_in_endpoint(fsg);
2961 set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); 2984 set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
2962 return -EINVAL; 2985 return -EINVAL;
2963 } 2986 }