Commit 98416333 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 51400f1d
...@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) ...@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
if (value == 0) if (value == 0)
data->state = STATE_EP_ENABLED; data->state = STATE_EP_ENABLED;
break; break;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
case USB_SPEED_HIGH: case USB_SPEED_HIGH:
/* fails if caller didn't provide that descriptor... */ /* fails if caller didn't provide that descriptor... */
value = usb_ep_enable (ep, &data->hs_desc); 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,7 +982,7 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
/* assume that was SET_CONFIGURATION */ /* assume that was SET_CONFIGURATION */
if (dev->current_config) { if (dev->current_config) {
unsigned power; unsigned power;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
if (dev->gadget->speed == USB_SPEED_HIGH) if (dev->gadget->speed == USB_SPEED_HIGH)
power = dev->hs_config->bMaxPower; power = dev->hs_config->bMaxPower;
else else
...@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_operations = { ...@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_operations = {
* Unrecognized ep0 requests may be handled in user space. * Unrecognized ep0 requests may be handled in user space.
*/ */
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
static void make_qualifier (struct dev_data *dev) static void make_qualifier (struct dev_data *dev)
{ {
struct usb_qualifier_descriptor qual; struct usb_qualifier_descriptor qual;
...@@ -1291,7 +1291,7 @@ static int ...@@ -1291,7 +1291,7 @@ static int
config_buf (struct dev_data *dev, u8 type, unsigned index) config_buf (struct dev_data *dev, u8 type, unsigned index)
{ {
int len; int len;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
int hs; int hs;
#endif #endif
...@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 type, unsigned index) ...@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 type, unsigned index)
if (index > 0) if (index > 0)
return -EINVAL; return -EINVAL;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
hs = (dev->gadget->speed == USB_SPEED_HIGH); hs = (dev->gadget->speed == USB_SPEED_HIGH);
if (type == USB_DT_OTHER_SPEED_CONFIG) if (type == USB_DT_OTHER_SPEED_CONFIG)
hs = !hs; hs = !hs;
...@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
dev->state = STATE_CONNECTED; dev->state = STATE_CONNECTED;
dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
ERROR (dev, "no high speed config??\n"); ERROR (dev, "no high speed config??\n");
return -EINVAL; return -EINVAL;
} }
#endif /* HIGHSPEED */ #endif /* CONFIG_USB_GADGET_DUALSPEED */
INFO (dev, "connected\n"); INFO (dev, "connected\n");
event = next_event (dev, GADGETFS_CONNECT); event = next_event (dev, GADGETFS_CONNECT);
...@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
/* ... down_trylock (&data->lock) ... */ /* ... down_trylock (&data->lock) ... */
if (data->state != STATE_EP_DEFER_ENABLE) if (data->state != STATE_EP_DEFER_ENABLE)
continue; continue;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
if (gadget->speed == USB_SPEED_HIGH) if (gadget->speed == USB_SPEED_HIGH)
value = usb_ep_enable (ep, &data->hs_desc); value = usb_ep_enable (ep, &data->hs_desc);
else else
#endif /* HIGHSPEED */ #endif /* CONFIG_USB_GADGET_DUALSPEED */
value = usb_ep_enable (ep, &data->desc); value = usb_ep_enable (ep, &data->desc);
if (value) { if (value) {
ERROR (dev, "deferred %s enable --> %d\n", ERROR (dev, "deferred %s enable --> %d\n",
...@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
value = min (w_length, (u16) sizeof *dev->dev); value = min (w_length, (u16) sizeof *dev->dev);
req->buf = dev->dev; req->buf = dev->dev;
break; break;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
case USB_DT_DEVICE_QUALIFIER: case USB_DT_DEVICE_QUALIFIER:
if (!dev->hs_config) if (!dev->hs_config)
break; break;
...@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
// user mode expected to disable endpoints // user mode expected to disable endpoints
} else { } else {
u8 config, power; u8 config, power;
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
if (gadget->speed == USB_SPEED_HIGH) { if (gadget->speed == USB_SPEED_HIGH) {
config = dev->hs_config->bConfigurationValue; config = dev->hs_config->bConfigurationValue;
power = dev->hs_config->bMaxPower; power = dev->hs_config->bMaxPower;
...@@ -1728,7 +1728,7 @@ gadgetfs_suspend (struct usb_gadget *gadget) ...@@ -1728,7 +1728,7 @@ gadgetfs_suspend (struct usb_gadget *gadget)
} }
static struct usb_gadget_driver gadgetfs_driver = { static struct usb_gadget_driver gadgetfs_driver = {
#ifdef HIGHSPEED #ifdef CONFIG_USB_GADGET_DUALSPEED
.speed = USB_SPEED_HIGH, .speed = USB_SPEED_HIGH,
#else #else
.speed = USB_SPEED_FULL, .speed = USB_SPEED_FULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment