diff options
author | David Brownell <david-b@pacbell.net> | 2006-04-02 14:19:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-14 14:12:24 -0400 |
commit | 984163338a24198863116ccf3e7762fd1fc3c663 (patch) | |
tree | 15053f9c9298c193c656655e87112cf139ecd69f /drivers/usb/gadget/inode.c | |
parent | 51400f1d6ef7ca871b584117527f7c6b12bf182b (diff) |
[PATCH] USB: gadgetfs highspeed bugfix
This catches up to a change in the Kconfig support for highspeed modes;
the change predated 2.6.10, and anyone using gadgetfs on a highspeed
device would see the kernel wrongly reject the alternate descriptors.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r-- | drivers/usb/gadget/inode.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 3f618ce6998d..42b457030b03 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
810 | if (value == 0) | 810 | if (value == 0) |
811 | data->state = STATE_EP_ENABLED; | 811 | data->state = STATE_EP_ENABLED; |
812 | break; | 812 | break; |
813 | #ifdef HIGHSPEED | 813 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
814 | case USB_SPEED_HIGH: | 814 | case USB_SPEED_HIGH: |
815 | /* fails if caller didn't provide that descriptor... */ | 815 | /* fails if caller didn't provide that descriptor... */ |
816 | value = usb_ep_enable (ep, &data->hs_desc); | 816 | value = usb_ep_enable (ep, &data->hs_desc); |
@@ -982,7 +982,7 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
982 | /* assume that was SET_CONFIGURATION */ | 982 | /* assume that was SET_CONFIGURATION */ |
983 | if (dev->current_config) { | 983 | if (dev->current_config) { |
984 | unsigned power; | 984 | unsigned power; |
985 | #ifdef HIGHSPEED | 985 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
986 | if (dev->gadget->speed == USB_SPEED_HIGH) | 986 | if (dev->gadget->speed == USB_SPEED_HIGH) |
987 | power = dev->hs_config->bMaxPower; | 987 | power = dev->hs_config->bMaxPower; |
988 | else | 988 | else |
@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_operations = { | |||
1262 | * Unrecognized ep0 requests may be handled in user space. | 1262 | * Unrecognized ep0 requests may be handled in user space. |
1263 | */ | 1263 | */ |
1264 | 1264 | ||
1265 | #ifdef HIGHSPEED | 1265 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1266 | static void make_qualifier (struct dev_data *dev) | 1266 | static void make_qualifier (struct dev_data *dev) |
1267 | { | 1267 | { |
1268 | struct usb_qualifier_descriptor qual; | 1268 | struct usb_qualifier_descriptor qual; |
@@ -1291,7 +1291,7 @@ static int | |||
1291 | config_buf (struct dev_data *dev, u8 type, unsigned index) | 1291 | config_buf (struct dev_data *dev, u8 type, unsigned index) |
1292 | { | 1292 | { |
1293 | int len; | 1293 | int len; |
1294 | #ifdef HIGHSPEED | 1294 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1295 | int hs; | 1295 | int hs; |
1296 | #endif | 1296 | #endif |
1297 | 1297 | ||
@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 type, unsigned index) | |||
1299 | if (index > 0) | 1299 | if (index > 0) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
1301 | 1301 | ||
1302 | #ifdef HIGHSPEED | 1302 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1303 | hs = (dev->gadget->speed == USB_SPEED_HIGH); | 1303 | hs = (dev->gadget->speed == USB_SPEED_HIGH); |
1304 | if (type == USB_DT_OTHER_SPEED_CONFIG) | 1304 | if (type == USB_DT_OTHER_SPEED_CONFIG) |
1305 | hs = !hs; | 1305 | hs = !hs; |
@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1335 | dev->state = STATE_CONNECTED; | 1335 | dev->state = STATE_CONNECTED; |
1336 | dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; | 1336 | dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; |
1337 | 1337 | ||
1338 | #ifdef HIGHSPEED | 1338 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1339 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { | 1339 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { |
1340 | ERROR (dev, "no high speed config??\n"); | 1340 | ERROR (dev, "no high speed config??\n"); |
1341 | return -EINVAL; | 1341 | return -EINVAL; |
1342 | } | 1342 | } |
1343 | #endif /* HIGHSPEED */ | 1343 | #endif /* CONFIG_USB_GADGET_DUALSPEED */ |
1344 | 1344 | ||
1345 | INFO (dev, "connected\n"); | 1345 | INFO (dev, "connected\n"); |
1346 | event = next_event (dev, GADGETFS_CONNECT); | 1346 | event = next_event (dev, GADGETFS_CONNECT); |
@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1352 | /* ... down_trylock (&data->lock) ... */ | 1352 | /* ... down_trylock (&data->lock) ... */ |
1353 | if (data->state != STATE_EP_DEFER_ENABLE) | 1353 | if (data->state != STATE_EP_DEFER_ENABLE) |
1354 | continue; | 1354 | continue; |
1355 | #ifdef HIGHSPEED | 1355 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1356 | if (gadget->speed == USB_SPEED_HIGH) | 1356 | if (gadget->speed == USB_SPEED_HIGH) |
1357 | value = usb_ep_enable (ep, &data->hs_desc); | 1357 | value = usb_ep_enable (ep, &data->hs_desc); |
1358 | else | 1358 | else |
1359 | #endif /* HIGHSPEED */ | 1359 | #endif /* CONFIG_USB_GADGET_DUALSPEED */ |
1360 | value = usb_ep_enable (ep, &data->desc); | 1360 | value = usb_ep_enable (ep, &data->desc); |
1361 | if (value) { | 1361 | if (value) { |
1362 | ERROR (dev, "deferred %s enable --> %d\n", | 1362 | ERROR (dev, "deferred %s enable --> %d\n", |
@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1391 | value = min (w_length, (u16) sizeof *dev->dev); | 1391 | value = min (w_length, (u16) sizeof *dev->dev); |
1392 | req->buf = dev->dev; | 1392 | req->buf = dev->dev; |
1393 | break; | 1393 | break; |
1394 | #ifdef HIGHSPEED | 1394 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1395 | case USB_DT_DEVICE_QUALIFIER: | 1395 | case USB_DT_DEVICE_QUALIFIER: |
1396 | if (!dev->hs_config) | 1396 | if (!dev->hs_config) |
1397 | break; | 1397 | break; |
@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1428 | // user mode expected to disable endpoints | 1428 | // user mode expected to disable endpoints |
1429 | } else { | 1429 | } else { |
1430 | u8 config, power; | 1430 | u8 config, power; |
1431 | #ifdef HIGHSPEED | 1431 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1432 | if (gadget->speed == USB_SPEED_HIGH) { | 1432 | if (gadget->speed == USB_SPEED_HIGH) { |
1433 | config = dev->hs_config->bConfigurationValue; | 1433 | config = dev->hs_config->bConfigurationValue; |
1434 | power = dev->hs_config->bMaxPower; | 1434 | power = dev->hs_config->bMaxPower; |
@@ -1728,7 +1728,7 @@ gadgetfs_suspend (struct usb_gadget *gadget) | |||
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | static struct usb_gadget_driver gadgetfs_driver = { | 1730 | static struct usb_gadget_driver gadgetfs_driver = { |
1731 | #ifdef HIGHSPEED | 1731 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1732 | .speed = USB_SPEED_HIGH, | 1732 | .speed = USB_SPEED_HIGH, |
1733 | #else | 1733 | #else |
1734 | .speed = USB_SPEED_FULL, | 1734 | .speed = USB_SPEED_FULL, |