aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-12-18 16:42:06 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 16:42:06 -0500
commit143c9054949436cb05e468439dc5e46231f33d09 (patch)
treec2e972d8188fb1b36368e9acb5b6b59466c9d903 /drivers/usb/gadget
parent0b6807034791160d5e584138943d2daea765436d (diff)
parent35eecf052250f663f07a4cded7d3503fd1b50729 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/intel/i40e/i40e_main.c drivers/net/macvtap.c Both minor merge hassles, simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/composite.c1
-rw-r--r--drivers/usb/gadget/f_fs.c2
-rw-r--r--drivers/usb/gadget/f_mass_storage.c27
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c1
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c7
-rw-r--r--drivers/usb/gadget/storage_common.h4
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.c2
-rw-r--r--drivers/usb/gadget/zero.c6
9 files changed, 28 insertions, 23 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index a91e6422f930..f66d96ad1f51 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET
682config USB_CONFIGFS_MASS_STORAGE 682config USB_CONFIGFS_MASS_STORAGE
683 boolean "Mass storage" 683 boolean "Mass storage"
684 depends on USB_CONFIGFS 684 depends on USB_CONFIGFS
685 depends on BLOCK
685 select USB_F_MASS_STORAGE 686 select USB_F_MASS_STORAGE
686 help 687 help
687 The Mass Storage Gadget acts as a USB Mass Storage disk drive. 688 The Mass Storage Gadget acts as a USB Mass Storage disk drive.
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 3e7ae707f691..2018ba1a2172 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -593,6 +593,7 @@ static void reset_config(struct usb_composite_dev *cdev)
593 bitmap_zero(f->endpoints, 32); 593 bitmap_zero(f->endpoints, 32);
594 } 594 }
595 cdev->config = NULL; 595 cdev->config = NULL;
596 cdev->delayed_status = 0;
596} 597}
597 598
598static int set_config(struct usb_composite_dev *cdev, 599static int set_config(struct usb_composite_dev *cdev,
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 774e8b89cdb5..241fc873ffa4 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1304,7 +1304,7 @@ static struct ffs_data *ffs_data_new(void)
1304{ 1304{
1305 struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL); 1305 struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
1306 if (unlikely(!ffs)) 1306 if (unlikely(!ffs))
1307 return 0; 1307 return NULL;
1308 1308
1309 ENTER(); 1309 ENTER();
1310 1310
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index a03ba2c83589..b96393908860 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -523,7 +523,7 @@ static int fsg_setup(struct usb_function *f,
523 */ 523 */
524 DBG(fsg, "bulk reset request\n"); 524 DBG(fsg, "bulk reset request\n");
525 raise_exception(fsg->common, FSG_STATE_RESET); 525 raise_exception(fsg->common, FSG_STATE_RESET);
526 return DELAYED_STATUS; 526 return USB_GADGET_DELAYED_STATUS;
527 527
528 case US_BULK_GET_MAX_LUN: 528 case US_BULK_GET_MAX_LUN:
529 if (ctrl->bRequestType != 529 if (ctrl->bRequestType !=
@@ -602,13 +602,14 @@ static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
602 return true; 602 return true;
603} 603}
604 604
605static int sleep_thread(struct fsg_common *common) 605static int sleep_thread(struct fsg_common *common, bool can_freeze)
606{ 606{
607 int rc = 0; 607 int rc = 0;
608 608
609 /* Wait until a signal arrives or we are woken up */ 609 /* Wait until a signal arrives or we are woken up */
610 for (;;) { 610 for (;;) {
611 try_to_freeze(); 611 if (can_freeze)
612 try_to_freeze();
612 set_current_state(TASK_INTERRUPTIBLE); 613 set_current_state(TASK_INTERRUPTIBLE);
613 if (signal_pending(current)) { 614 if (signal_pending(current)) {
614 rc = -EINTR; 615 rc = -EINTR;
@@ -682,7 +683,7 @@ static int do_read(struct fsg_common *common)
682 /* Wait for the next buffer to become available */ 683 /* Wait for the next buffer to become available */
683 bh = common->next_buffhd_to_fill; 684 bh = common->next_buffhd_to_fill;
684 while (bh->state != BUF_STATE_EMPTY) { 685 while (bh->state != BUF_STATE_EMPTY) {
685 rc = sleep_thread(common); 686 rc = sleep_thread(common, false);
686 if (rc) 687 if (rc)
687 return rc; 688 return rc;
688 } 689 }
@@ -937,7 +938,7 @@ static int do_write(struct fsg_common *common)
937 } 938 }
938 939
939 /* Wait for something to happen */ 940 /* Wait for something to happen */
940 rc = sleep_thread(common); 941 rc = sleep_thread(common, false);
941 if (rc) 942 if (rc)
942 return rc; 943 return rc;
943 } 944 }
@@ -1504,7 +1505,7 @@ static int throw_away_data(struct fsg_common *common)
1504 } 1505 }
1505 1506
1506 /* Otherwise wait for something to happen */ 1507 /* Otherwise wait for something to happen */
1507 rc = sleep_thread(common); 1508 rc = sleep_thread(common, true);
1508 if (rc) 1509 if (rc)
1509 return rc; 1510 return rc;
1510 } 1511 }
@@ -1625,7 +1626,7 @@ static int send_status(struct fsg_common *common)
1625 /* Wait for the next buffer to become available */ 1626 /* Wait for the next buffer to become available */
1626 bh = common->next_buffhd_to_fill; 1627 bh = common->next_buffhd_to_fill;
1627 while (bh->state != BUF_STATE_EMPTY) { 1628 while (bh->state != BUF_STATE_EMPTY) {
1628 rc = sleep_thread(common); 1629 rc = sleep_thread(common, true);
1629 if (rc) 1630 if (rc)
1630 return rc; 1631 return rc;
1631 } 1632 }
@@ -1828,7 +1829,7 @@ static int do_scsi_command(struct fsg_common *common)
1828 bh = common->next_buffhd_to_fill; 1829 bh = common->next_buffhd_to_fill;
1829 common->next_buffhd_to_drain = bh; 1830 common->next_buffhd_to_drain = bh;
1830 while (bh->state != BUF_STATE_EMPTY) { 1831 while (bh->state != BUF_STATE_EMPTY) {
1831 rc = sleep_thread(common); 1832 rc = sleep_thread(common, true);
1832 if (rc) 1833 if (rc)
1833 return rc; 1834 return rc;
1834 } 1835 }
@@ -2174,7 +2175,7 @@ static int get_next_command(struct fsg_common *common)
2174 /* Wait for the next buffer to become available */ 2175 /* Wait for the next buffer to become available */
2175 bh = common->next_buffhd_to_fill; 2176 bh = common->next_buffhd_to_fill;
2176 while (bh->state != BUF_STATE_EMPTY) { 2177 while (bh->state != BUF_STATE_EMPTY) {
2177 rc = sleep_thread(common); 2178 rc = sleep_thread(common, true);
2178 if (rc) 2179 if (rc)
2179 return rc; 2180 return rc;
2180 } 2181 }
@@ -2193,7 +2194,7 @@ static int get_next_command(struct fsg_common *common)
2193 2194
2194 /* Wait for the CBW to arrive */ 2195 /* Wait for the CBW to arrive */
2195 while (bh->state != BUF_STATE_FULL) { 2196 while (bh->state != BUF_STATE_FULL) {
2196 rc = sleep_thread(common); 2197 rc = sleep_thread(common, true);
2197 if (rc) 2198 if (rc)
2198 return rc; 2199 return rc;
2199 } 2200 }
@@ -2379,7 +2380,7 @@ static void handle_exception(struct fsg_common *common)
2379 } 2380 }
2380 if (num_active == 0) 2381 if (num_active == 0)
2381 break; 2382 break;
2382 if (sleep_thread(common)) 2383 if (sleep_thread(common, true))
2383 return; 2384 return;
2384 } 2385 }
2385 2386
@@ -2516,7 +2517,7 @@ static int fsg_main_thread(void *common_)
2516 } 2517 }
2517 2518
2518 if (!common->running) { 2519 if (!common->running) {
2519 sleep_thread(common); 2520 sleep_thread(common, true);
2520 continue; 2521 continue;
2521 } 2522 }
2522 2523
@@ -3111,7 +3112,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
3111 fsg->common->can_stall); 3112 fsg->common->can_stall);
3112 if (ret) 3113 if (ret)
3113 return ret; 3114 return ret;
3114 fsg_common_set_inquiry_string(fsg->common, 0, 0); 3115 fsg_common_set_inquiry_string(fsg->common, NULL, NULL);
3115 ret = fsg_common_run_thread(fsg->common); 3116 ret = fsg_common_run_thread(fsg->common);
3116 if (ret) 3117 if (ret)
3117 return ret; 3118 return ret;
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 0ac6064aa3b8..409a3c45a36a 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -54,6 +54,7 @@
54 */ 54 */
55#ifdef CONFIG_ARCH_PXA 55#ifdef CONFIG_ARCH_PXA
56#include <mach/pxa25x-udc.h> 56#include <mach/pxa25x-udc.h>
57#include <mach/hardware.h>
57#endif 58#endif
58 59
59#ifdef CONFIG_ARCH_LUBBOCK 60#ifdef CONFIG_ARCH_LUBBOCK
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 9875d9c0823f..e20bc109fdd7 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -1180,6 +1180,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
1180} 1180}
1181 1181
1182static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); 1182static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg);
1183static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg);
1183 1184
1184/** 1185/**
1185 * s3c_hsotg_process_control - process a control request 1186 * s3c_hsotg_process_control - process a control request
@@ -1221,6 +1222,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
1221 if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { 1222 if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
1222 switch (ctrl->bRequest) { 1223 switch (ctrl->bRequest) {
1223 case USB_REQ_SET_ADDRESS: 1224 case USB_REQ_SET_ADDRESS:
1225 s3c_hsotg_disconnect(hsotg);
1224 dcfg = readl(hsotg->regs + DCFG); 1226 dcfg = readl(hsotg->regs + DCFG);
1225 dcfg &= ~DCFG_DevAddr_MASK; 1227 dcfg &= ~DCFG_DevAddr_MASK;
1226 dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT; 1228 dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT;
@@ -1245,7 +1247,9 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
1245 /* as a fallback, try delivering it to the driver to deal with */ 1247 /* as a fallback, try delivering it to the driver to deal with */
1246 1248
1247 if (ret == 0 && hsotg->driver) { 1249 if (ret == 0 && hsotg->driver) {
1250 spin_unlock(&hsotg->lock);
1248 ret = hsotg->driver->setup(&hsotg->gadget, ctrl); 1251 ret = hsotg->driver->setup(&hsotg->gadget, ctrl);
1252 spin_lock(&hsotg->lock);
1249 if (ret < 0) 1253 if (ret < 0)
1250 dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret); 1254 dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret);
1251 } 1255 }
@@ -1308,10 +1312,12 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
1308 return; 1312 return;
1309 } 1313 }
1310 1314
1315 spin_lock(&hsotg->lock);
1311 if (req->actual == 0) 1316 if (req->actual == 0)
1312 s3c_hsotg_enqueue_setup(hsotg); 1317 s3c_hsotg_enqueue_setup(hsotg);
1313 else 1318 else
1314 s3c_hsotg_process_control(hsotg, req->buf); 1319 s3c_hsotg_process_control(hsotg, req->buf);
1320 spin_unlock(&hsotg->lock);
1315} 1321}
1316 1322
1317/** 1323/**
@@ -2533,7 +2539,6 @@ irq_retry:
2533 writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS); 2539 writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS);
2534 2540
2535 call_gadget(hsotg, suspend); 2541 call_gadget(hsotg, suspend);
2536 s3c_hsotg_disconnect(hsotg);
2537 } 2542 }
2538 2543
2539 if (gintsts & GINTSTS_WkUpInt) { 2544 if (gintsts & GINTSTS_WkUpInt) {
diff --git a/drivers/usb/gadget/storage_common.h b/drivers/usb/gadget/storage_common.h
index c74c2fdbd56e..70c891469f57 100644
--- a/drivers/usb/gadget/storage_common.h
+++ b/drivers/usb/gadget/storage_common.h
@@ -119,10 +119,6 @@ static inline bool fsg_lun_is_open(struct fsg_lun *curlun)
119 return curlun->filp != NULL; 119 return curlun->filp != NULL;
120} 120}
121 121
122/* Big enough to hold our biggest descriptor */
123#define EP0_BUFSIZE 256
124#define DELAYED_STATUS (EP0_BUFSIZE + 999) /* An impossibly large value */
125
126/* Default size of buffer length. */ 122/* Default size of buffer length. */
127#define FSG_BUFLEN ((u32)16384) 123#define FSG_BUFLEN ((u32)16384)
128 124
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 6c3d7950d2a9..0f8aad78b54f 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -370,7 +370,7 @@ err:
370 return -ENOMEM; 370 return -ENOMEM;
371} 371}
372 372
373void bot_cleanup_old_alt(struct f_uas *fu) 373static void bot_cleanup_old_alt(struct f_uas *fu)
374{ 374{
375 if (!(fu->flags & USBG_ENABLED)) 375 if (!(fu->flags & USBG_ENABLED))
376 return; 376 return;
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 0dd07ae1555d..f49b0b61ecc8 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -91,17 +91,17 @@ static struct usb_zero_options gzero_options = {
91 * functional coverage for the "USBCV" test harness from USB-IF. 91 * functional coverage for the "USBCV" test harness from USB-IF.
92 * It's always set if OTG mode is enabled. 92 * It's always set if OTG mode is enabled.
93 */ 93 */
94unsigned autoresume = DEFAULT_AUTORESUME; 94static unsigned autoresume = DEFAULT_AUTORESUME;
95module_param(autoresume, uint, S_IRUGO); 95module_param(autoresume, uint, S_IRUGO);
96MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup"); 96MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup");
97 97
98/* Maximum Autoresume time */ 98/* Maximum Autoresume time */
99unsigned max_autoresume; 99static unsigned max_autoresume;
100module_param(max_autoresume, uint, S_IRUGO); 100module_param(max_autoresume, uint, S_IRUGO);
101MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup"); 101MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup");
102 102
103/* Interval between two remote wakeups */ 103/* Interval between two remote wakeups */
104unsigned autoresume_interval_ms; 104static unsigned autoresume_interval_ms;
105module_param(autoresume_interval_ms, uint, S_IRUGO); 105module_param(autoresume_interval_ms, uint, S_IRUGO);
106MODULE_PARM_DESC(autoresume_interval_ms, 106MODULE_PARM_DESC(autoresume_interval_ms,
107 "milliseconds to increase successive wakeup delays"); 107 "milliseconds to increase successive wakeup delays");