diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2008-04-08 13:24:46 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-24 21:16:59 -0700 |
commit | fc721f5194dc98c8108fb155a4fbae1cd746cf41 (patch) | |
tree | 12170e62de774ef771d300074f25e63d30ca0a6e /drivers/usb | |
parent | 6c529cdca914ba2a08a4bba54f11dedc2d3a7c17 (diff) | |
download | linux-fc721f5194dc98c8108fb155a4fbae1cd746cf41.tar.bz2 |
wusb: make ep0_reinit available for modules
We need to be able to call ep0_reinit() [renamed to usb_ep0_reinit()]
from the WUSB security code. The reason is that when we authenticate
the device, it's address changes (from having bit 7 set to having it
cleared). Thus, we need to signal the USB stack to reinitialize EP0,
so the status with the previous address kept at the HCD layer is
cleared and properly reinitialized.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 11 | ||||
-rw-r--r-- | drivers/usb/core/hub.h | 1 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1815034ccb7a..830c851384bf 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2211,12 +2211,13 @@ static int hub_port_debounce(struct usb_hub *hub, int port1) return portstatus; } -static void ep0_reinit(struct usb_device *udev) +void usb_ep0_reinit(struct usb_device *udev) { usb_disable_endpoint(udev, 0 + USB_DIR_IN); usb_disable_endpoint(udev, 0 + USB_DIR_OUT); usb_enable_endpoint(udev, &udev->ep0); } +EXPORT_SYMBOL_GPL(usb_ep0_reinit); #define usb_sndaddr0pipe() (PIPE_CONTROL << 30) #define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN) @@ -2237,7 +2238,7 @@ static int hub_set_address(struct usb_device *udev, int devnum) if (retval == 0) { udev->devnum = devnum; /* Device now using proper address */ usb_set_device_state(udev, USB_STATE_ADDRESS); - ep0_reinit(udev); + usb_ep0_reinit(udev); } return retval; } @@ -2473,7 +2474,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, } dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); - ep0_reinit(udev); + usb_ep0_reinit(udev); } retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE); @@ -2729,7 +2730,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, loop_disable: hub_port_disable(hub, port1, 1); loop: - ep0_reinit(udev); + usb_ep0_reinit(udev); release_address(udev); usb_put_dev(udev); if ((status == -ENOTCONN) || (status == -ENOTSUPP)) @@ -3164,7 +3165,7 @@ int usb_reset_device(struct usb_device *udev) /* ep0 maxpacket size may change; let the HCD know about it. * Other endpoints will be handled by re-enumeration. */ - ep0_reinit(udev); + usb_ep0_reinit(udev); ret = hub_port_init(parent_hub, udev, port1, i); if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV) break; diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index d672cd81a3e4..2a116ce53c9b 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -195,5 +195,6 @@ struct usb_tt_clear { }; extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); +extern void usb_ep0_reinit(struct usb_device *); #endif /* __LINUX_HUB_H */ |