aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/inode.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2012-08-24 14:46:18 -0400
committerFelipe Balbi <balbi@ti.com>2012-08-31 05:49:40 -0400
commit85b8614d722389202af298e1bf8a599c431fef19 (patch)
tree45eeda8dbd200d26dd044dab4417292e3d687c92 /drivers/usb/gadget/inode.c
parent86bab36662d47388102ca437a3cbfd79e0ea75cd (diff)
usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED
This commit removes USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED Kconfig options. Since now kernel allows many UDC drivers to be compiled, those options may turn to no longer be valid. For instance, if someone decides to build UDC that supports super speed and UDC that supports high speed only, the latter will be "assumed" to support super speed since USB_GADGET_SUPERSPEED will be selected by the former. The test of whether CONFIG_USB_GADGET_*SPEED was defined was just an optimisation which removed otherwise dead code (ie. if UDC is not dual speed, there is no need to handle cases that can happen if speed is high). This commit removes those checks. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r--drivers/usb/gadget/inode.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index e58b16442971..ae13a106fb96 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -828,7 +828,6 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
828 if (value == 0) 828 if (value == 0)
829 data->state = STATE_EP_ENABLED; 829 data->state = STATE_EP_ENABLED;
830 break; 830 break;
831#ifdef CONFIG_USB_GADGET_DUALSPEED
832 case USB_SPEED_HIGH: 831 case USB_SPEED_HIGH:
833 /* fails if caller didn't provide that descriptor... */ 832 /* fails if caller didn't provide that descriptor... */
834 ep->desc = &data->hs_desc; 833 ep->desc = &data->hs_desc;
@@ -836,7 +835,6 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
836 if (value == 0) 835 if (value == 0)
837 data->state = STATE_EP_ENABLED; 836 data->state = STATE_EP_ENABLED;
838 break; 837 break;
839#endif
840 default: 838 default:
841 DBG(data->dev, "unconnected, %s init abandoned\n", 839 DBG(data->dev, "unconnected, %s init abandoned\n",
842 data->name); 840 data->name);
@@ -1324,7 +1322,6 @@ static const struct file_operations ep0_io_operations = {
1324 * Unrecognized ep0 requests may be handled in user space. 1322 * Unrecognized ep0 requests may be handled in user space.
1325 */ 1323 */
1326 1324
1327#ifdef CONFIG_USB_GADGET_DUALSPEED
1328static void make_qualifier (struct dev_data *dev) 1325static void make_qualifier (struct dev_data *dev)
1329{ 1326{
1330 struct usb_qualifier_descriptor qual; 1327 struct usb_qualifier_descriptor qual;
@@ -1347,7 +1344,6 @@ static void make_qualifier (struct dev_data *dev)
1347 1344
1348 memcpy (dev->rbuf, &qual, sizeof qual); 1345 memcpy (dev->rbuf, &qual, sizeof qual);
1349} 1346}
1350#endif
1351 1347
1352static int 1348static int
1353config_buf (struct dev_data *dev, u8 type, unsigned index) 1349config_buf (struct dev_data *dev, u8 type, unsigned index)
@@ -1427,7 +1423,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1427 dev->dev->bMaxPacketSize0 = dev->gadget->ep0->maxpacket; 1423 dev->dev->bMaxPacketSize0 = dev->gadget->ep0->maxpacket;
1428 req->buf = dev->dev; 1424 req->buf = dev->dev;
1429 break; 1425 break;
1430#ifdef CONFIG_USB_GADGET_DUALSPEED
1431 case USB_DT_DEVICE_QUALIFIER: 1426 case USB_DT_DEVICE_QUALIFIER:
1432 if (!dev->hs_config) 1427 if (!dev->hs_config)
1433 break; 1428 break;
@@ -1437,7 +1432,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1437 break; 1432 break;
1438 case USB_DT_OTHER_SPEED_CONFIG: 1433 case USB_DT_OTHER_SPEED_CONFIG:
1439 // FALLTHROUGH 1434 // FALLTHROUGH
1440#endif
1441 case USB_DT_CONFIG: 1435 case USB_DT_CONFIG:
1442 value = config_buf (dev, 1436 value = config_buf (dev,
1443 w_value >> 8, 1437 w_value >> 8,
@@ -1763,11 +1757,6 @@ gadgetfs_suspend (struct usb_gadget *gadget)
1763} 1757}
1764 1758
1765static struct usb_gadget_driver gadgetfs_driver = { 1759static struct usb_gadget_driver gadgetfs_driver = {
1766#ifdef CONFIG_USB_GADGET_DUALSPEED
1767 .max_speed = USB_SPEED_HIGH,
1768#else
1769 .max_speed = USB_SPEED_FULL,
1770#endif
1771 .function = (char *) driver_desc, 1760 .function = (char *) driver_desc,
1772 .unbind = gadgetfs_unbind, 1761 .unbind = gadgetfs_unbind,
1773 .setup = gadgetfs_setup, 1762 .setup = gadgetfs_setup,
@@ -1900,6 +1889,10 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1900 1889
1901 /* triggers gadgetfs_bind(); then we can enumerate. */ 1890 /* triggers gadgetfs_bind(); then we can enumerate. */
1902 spin_unlock_irq (&dev->lock); 1891 spin_unlock_irq (&dev->lock);
1892 if (dev->hs_config)
1893 gadgetfs_driver.max_speed = USB_SPEED_HIGH;
1894 else
1895 gadgetfs_driver.max_speed = USB_SPEED_FULL;
1903 value = usb_gadget_probe_driver(&gadgetfs_driver, gadgetfs_bind); 1896 value = usb_gadget_probe_driver(&gadgetfs_driver, gadgetfs_bind);
1904 if (value != 0) { 1897 if (value != 0) {
1905 kfree (dev->buf); 1898 kfree (dev->buf);