diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-05-11 14:44:27 +0200 | 
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-05-11 14:44:31 +0200 | 
| commit | 41fb454ebe6024f5c1e3b3cbc0abc0da762e7b51 (patch) | |
| tree | 51c50bcb67a5039448ddfa1869d7948cab1217e9 /drivers/usb/core/message.c | |
| parent | 19c1a6f5764d787113fa323ffb18be7991208f82 (diff) | |
| parent | 091bf7624d1c90cec9e578a18529f615213ff847 (diff) | |
Merge commit 'v2.6.30-rc5' into core/iommu
Merge reason: core/iommu was on an .30-rc1 base,
              update it to .30-rc5 to refresh.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/usb/core/message.c')
| -rw-r--r-- | drivers/usb/core/message.c | 58 | 
1 files changed, 37 insertions, 21 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 30a0690f368..b6262837765 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1002,8 +1002,7 @@ int usb_clear_halt(struct usb_device *dev, int pipe)  	 * the copy in usb-storage, for as long as we need two copies.  	 */ -	/* toggle was reset by the clear */ -	usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), 0); +	usb_reset_endpoint(dev, endp);  	return 0;  } @@ -1076,6 +1075,30 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,  }  /** + * usb_reset_endpoint - Reset an endpoint's state. + * @dev: the device whose endpoint is to be reset + * @epaddr: the endpoint's address.  Endpoint number for output, + *	endpoint number + USB_DIR_IN for input + * + * Resets any host-side endpoint state such as the toggle bit, + * sequence number or current window. + */ +void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr) +{ +	unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK; +	struct usb_host_endpoint *ep; + +	if (usb_endpoint_out(epaddr)) +		ep = dev->ep_out[epnum]; +	else +		ep = dev->ep_in[epnum]; +	if (ep) +		usb_hcd_reset_endpoint(dev, ep); +} +EXPORT_SYMBOL_GPL(usb_reset_endpoint); + + +/**   * usb_disable_interface -- Disable all endpoints for an interface   * @dev: the device whose interface is being disabled   * @intf: pointer to the interface descriptor @@ -1117,7 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)  		usb_disable_endpoint(dev, i, true);  		usb_disable_endpoint(dev, i + USB_DIR_IN, true);  	} -	dev->toggle[0] = dev->toggle[1] = 0;  	/* getting rid of interfaces will disconnect  	 * any drivers bound to them (a key side effect) @@ -1154,28 +1176,24 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)   * usb_enable_endpoint - Enable an endpoint for USB communications   * @dev: the device whose interface is being enabled   * @ep: the endpoint - * @reset_toggle: flag to set the endpoint's toggle back to 0 + * @reset_ep: flag to reset the endpoint state   * - * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers. + * Resets the endpoint state if asked, and sets dev->ep_{in,out} pointers.   * For control endpoints, both the input and output sides are handled.   */  void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, -		bool reset_toggle) +		bool reset_ep)  {  	int epnum = usb_endpoint_num(&ep->desc);  	int is_out = usb_endpoint_dir_out(&ep->desc);  	int is_control = usb_endpoint_xfer_control(&ep->desc); -	if (is_out || is_control) { -		if (reset_toggle) -			usb_settoggle(dev, epnum, 1, 0); +	if (reset_ep) +		usb_hcd_reset_endpoint(dev, ep); +	if (is_out || is_control)  		dev->ep_out[epnum] = ep; -	} -	if (!is_out || is_control) { -		if (reset_toggle) -			usb_settoggle(dev, epnum, 0, 0); +	if (!is_out || is_control)  		dev->ep_in[epnum] = ep; -	}  	ep->enabled = 1;  } @@ -1183,18 +1201,18 @@ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep,   * usb_enable_interface - Enable all the endpoints for an interface   * @dev: the device whose interface is being enabled   * @intf: pointer to the interface descriptor - * @reset_toggles: flag to set the endpoints' toggles back to 0 + * @reset_eps: flag to reset the endpoints' state   *   * Enables all the endpoints for the interface's current altsetting.   */  void usb_enable_interface(struct usb_device *dev, -		struct usb_interface *intf, bool reset_toggles) +		struct usb_interface *intf, bool reset_eps)  {  	struct usb_host_interface *alt = intf->cur_altsetting;  	int i;  	for (i = 0; i < alt->desc.bNumEndpoints; ++i) -		usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles); +		usb_enable_endpoint(dev, &alt->endpoint[i], reset_eps);  }  /** @@ -1335,7 +1353,7 @@ EXPORT_SYMBOL_GPL(usb_set_interface);   * This issues a standard SET_CONFIGURATION request to the device using   * the current configuration.  The effect is to reset most USB-related   * state in the device, including interface altsettings (reset to zero), - * endpoint halts (cleared), and data toggle (only for bulk and interrupt + * endpoint halts (cleared), and endpoint state (only for bulk and interrupt   * endpoints).  Other usbcore state is unchanged, including bindings of   * usb device drivers to interfaces.   * @@ -1343,7 +1361,7 @@ EXPORT_SYMBOL_GPL(usb_set_interface);   * (multi-interface) devices.  Instead, the driver for each interface may   * use usb_set_interface() on the interfaces it claims.  Be careful though;   * some devices don't support the SET_INTERFACE request, and others won't - * reset all the interface state (notably data toggles).  Resetting the whole + * reset all the interface state (notably endpoint state).  Resetting the whole   * configuration would affect other drivers' interfaces.   *   * The caller must own the device lock. @@ -1376,8 +1394,6 @@ int usb_reset_configuration(struct usb_device *dev)  	if (retval < 0)  		return retval; -	dev->toggle[0] = dev->toggle[1] = 0; -  	/* re-init hc/hcd interface/endpoint state */  	for (i = 0; i < config->desc.bNumInterfaces; i++) {  		struct usb_interface *intf = config->interface[i];  | 
