aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index f9540adf2a4f..c78c64ae87af 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -734,7 +734,7 @@ show_function (struct device *dev, struct device_attribute *attr, char *buf)
734 return 0; 734 return 0;
735 return scnprintf (buf, PAGE_SIZE, "%s\n", dum->driver->function); 735 return scnprintf (buf, PAGE_SIZE, "%s\n", dum->driver->function);
736} 736}
737DEVICE_ATTR (function, S_IRUGO, show_function, NULL); 737static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
738 738
739/*-------------------------------------------------------------------------*/ 739/*-------------------------------------------------------------------------*/
740 740
@@ -857,6 +857,9 @@ EXPORT_SYMBOL (usb_gadget_unregister_driver);
857 857
858#undef is_enabled 858#undef is_enabled
859 859
860/* just declare this in any driver that really need it */
861extern int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode);
862
860int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode) 863int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode)
861{ 864{
862 return -ENOSYS; 865 return -ENOSYS;
@@ -1122,7 +1125,6 @@ static int periodic_bytes (struct dummy *dum, struct dummy_ep *ep)
1122 1125
1123 /* high bandwidth mode */ 1126 /* high bandwidth mode */
1124 tmp = le16_to_cpu(ep->desc->wMaxPacketSize); 1127 tmp = le16_to_cpu(ep->desc->wMaxPacketSize);
1125 tmp = le16_to_cpu (tmp);
1126 tmp = (tmp >> 11) & 0x03; 1128 tmp = (tmp >> 11) & 0x03;
1127 tmp *= 8 /* applies to entire frame */; 1129 tmp *= 8 /* applies to entire frame */;
1128 limit += limit * tmp; 1130 limit += limit * tmp;
@@ -1265,9 +1267,14 @@ restart:
1265 struct usb_ctrlrequest setup; 1267 struct usb_ctrlrequest setup;
1266 int value = 1; 1268 int value = 1;
1267 struct dummy_ep *ep2; 1269 struct dummy_ep *ep2;
1270 unsigned w_index;
1271 unsigned w_value;
1268 1272
1269 setup = *(struct usb_ctrlrequest*) urb->setup_packet; 1273 setup = *(struct usb_ctrlrequest*) urb->setup_packet;
1270 if (setup.wLength != urb->transfer_buffer_length) { 1274 w_index = le16_to_cpu(setup.wIndex);
1275 w_value = le16_to_cpu(setup.wValue);
1276 if (le16_to_cpu(setup.wLength) !=
1277 urb->transfer_buffer_length) {
1271 maybe_set_status (urb, -EOVERFLOW); 1278 maybe_set_status (urb, -EOVERFLOW);
1272 goto return_urb; 1279 goto return_urb;
1273 } 1280 }
@@ -1297,16 +1304,16 @@ restart:
1297 case USB_REQ_SET_ADDRESS: 1304 case USB_REQ_SET_ADDRESS:
1298 if (setup.bRequestType != Dev_Request) 1305 if (setup.bRequestType != Dev_Request)
1299 break; 1306 break;
1300 dum->address = setup.wValue; 1307 dum->address = w_value;
1301 maybe_set_status (urb, 0); 1308 maybe_set_status (urb, 0);
1302 dev_dbg (udc_dev(dum), "set_address = %d\n", 1309 dev_dbg (udc_dev(dum), "set_address = %d\n",
1303 setup.wValue); 1310 w_value);
1304 value = 0; 1311 value = 0;
1305 break; 1312 break;
1306 case USB_REQ_SET_FEATURE: 1313 case USB_REQ_SET_FEATURE:
1307 if (setup.bRequestType == Dev_Request) { 1314 if (setup.bRequestType == Dev_Request) {
1308 value = 0; 1315 value = 0;
1309 switch (setup.wValue) { 1316 switch (w_value) {
1310 case USB_DEVICE_REMOTE_WAKEUP: 1317 case USB_DEVICE_REMOTE_WAKEUP:
1311 break; 1318 break;
1312 case USB_DEVICE_B_HNP_ENABLE: 1319 case USB_DEVICE_B_HNP_ENABLE:
@@ -1324,14 +1331,13 @@ restart:
1324 } 1331 }
1325 if (value == 0) { 1332 if (value == 0) {
1326 dum->devstatus |= 1333 dum->devstatus |=
1327 (1 << setup.wValue); 1334 (1 << w_value);
1328 maybe_set_status (urb, 0); 1335 maybe_set_status (urb, 0);
1329 } 1336 }
1330 1337
1331 } else if (setup.bRequestType == Ep_Request) { 1338 } else if (setup.bRequestType == Ep_Request) {
1332 // endpoint halt 1339 // endpoint halt
1333 ep2 = find_endpoint (dum, 1340 ep2 = find_endpoint (dum, w_index);
1334 setup.wIndex);
1335 if (!ep2) { 1341 if (!ep2) {
1336 value = -EOPNOTSUPP; 1342 value = -EOPNOTSUPP;
1337 break; 1343 break;
@@ -1343,7 +1349,7 @@ restart:
1343 break; 1349 break;
1344 case USB_REQ_CLEAR_FEATURE: 1350 case USB_REQ_CLEAR_FEATURE:
1345 if (setup.bRequestType == Dev_Request) { 1351 if (setup.bRequestType == Dev_Request) {
1346 switch (setup.wValue) { 1352 switch (w_value) {
1347 case USB_DEVICE_REMOTE_WAKEUP: 1353 case USB_DEVICE_REMOTE_WAKEUP:
1348 dum->devstatus &= ~(1 << 1354 dum->devstatus &= ~(1 <<
1349 USB_DEVICE_REMOTE_WAKEUP); 1355 USB_DEVICE_REMOTE_WAKEUP);
@@ -1356,8 +1362,7 @@ restart:
1356 } 1362 }
1357 } else if (setup.bRequestType == Ep_Request) { 1363 } else if (setup.bRequestType == Ep_Request) {
1358 // endpoint halt 1364 // endpoint halt
1359 ep2 = find_endpoint (dum, 1365 ep2 = find_endpoint (dum, w_index);
1360 setup.wIndex);
1361 if (!ep2) { 1366 if (!ep2) {
1362 value = -EOPNOTSUPP; 1367 value = -EOPNOTSUPP;
1363 break; 1368 break;
@@ -1383,7 +1388,7 @@ restart:
1383 if (urb->transfer_buffer_length > 0) { 1388 if (urb->transfer_buffer_length > 0) {
1384 if (setup.bRequestType == 1389 if (setup.bRequestType ==
1385 Ep_InRequest) { 1390 Ep_InRequest) {
1386 ep2 = find_endpoint (dum, setup.wIndex); 1391 ep2 = find_endpoint (dum, w_index);
1387 if (!ep2) { 1392 if (!ep2) {
1388 value = -EOPNOTSUPP; 1393 value = -EOPNOTSUPP;
1389 break; 1394 break;
@@ -1535,7 +1540,8 @@ hub_descriptor (struct usb_hub_descriptor *desc)
1535 memset (desc, 0, sizeof *desc); 1540 memset (desc, 0, sizeof *desc);
1536 desc->bDescriptorType = 0x29; 1541 desc->bDescriptorType = 0x29;
1537 desc->bDescLength = 9; 1542 desc->bDescLength = 9;
1538 desc->wHubCharacteristics = __constant_cpu_to_le16 (0x0001); 1543 desc->wHubCharacteristics = (__force __u16)
1544 (__constant_cpu_to_le16 (0x0001));
1539 desc->bNbrPorts = 1; 1545 desc->bNbrPorts = 1;
1540 desc->bitmap [0] = 0xff; 1546 desc->bitmap [0] = 0xff;
1541 desc->bitmap [1] = 0xff; 1547 desc->bitmap [1] = 0xff;
@@ -1581,7 +1587,7 @@ static int dummy_hub_control (
1581 hub_descriptor ((struct usb_hub_descriptor *) buf); 1587 hub_descriptor ((struct usb_hub_descriptor *) buf);
1582 break; 1588 break;
1583 case GetHubStatus: 1589 case GetHubStatus:
1584 *(u32 *) buf = __constant_cpu_to_le32 (0); 1590 *(__le32 *) buf = __constant_cpu_to_le32 (0);
1585 break; 1591 break;
1586 case GetPortStatus: 1592 case GetPortStatus:
1587 if (wIndex != 1) 1593 if (wIndex != 1)
@@ -1621,8 +1627,8 @@ static int dummy_hub_control (
1621 } 1627 }
1622 } 1628 }
1623 set_link_state (dum); 1629 set_link_state (dum);
1624 ((u16 *) buf)[0] = cpu_to_le16 (dum->port_status); 1630 ((__le16 *) buf)[0] = cpu_to_le16 (dum->port_status);
1625 ((u16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16); 1631 ((__le16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16);
1626 break; 1632 break;
1627 case SetHubFeature: 1633 case SetHubFeature:
1628 retval = -EPIPE; 1634 retval = -EPIPE;