diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2c6b9578a7d3670d8403afc4c323f376653693ff..9693cefdf26f5ead6d9e36789d04a4fd41bf1eaa 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1938,6 +1938,16 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, return ret; } +void usb_hcd_fixup_endpoint(struct usb_device *udev, + struct usb_host_endpoint *ep, int interval) +{ + struct usb_hcd *hcd; + + hcd = bus_to_hcd(udev->bus); + if (hcd->driver->fixup_endpoint) + hcd->driver->fixup_endpoint(hcd, udev, ep, interval); +} + /* Disables the endpoint: synchronizes with the hcd to make sure all * endpoint state is gone from hardware. usb_hcd_flush_endpoint() must * have been called previously. Use for set_configuration, set_interface, diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 6138a21cf0f11e4a6481a4e4d04f803a635a5f2d..6f0c19d765159b08c0494508888a9895527556fa 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1259,6 +1259,21 @@ static void remove_intf_ep_devs(struct usb_interface *intf) intf->ep_devs_created = 0; } +void usb_fixup_endpoint(struct usb_device *dev, int epaddr, int interval) +{ + 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_endpoint_xfer_int(&ep->desc)) + usb_hcd_fixup_endpoint(dev, ep, interval); +} +EXPORT_SYMBOL_GPL(usb_fixup_endpoint); + /** * usb_disable_endpoint -- Disable an endpoint by address * @dev: the device whose endpoint is being disabled diff --git a/include/linux/usb.h b/include/linux/usb.h index 7d72c4e0713c1068d11a01256de7a37bc44b809b..75d9ef39a878fccfd07383e7f4d44515f82e9007 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1836,6 +1836,8 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); +extern void usb_fixup_endpoint(struct usb_device *dev, int epaddr, + int interval); /* this request isn't really synchronous, but it belongs with the others */ extern int usb_driver_set_configuration(struct usb_device *udev, int config); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 3dbb42c637c142d0652ccc33dd8d6814a6706ef5..a60b7fc02fce3ac1083e89f518c4cb8651d9c05f 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -382,6 +382,11 @@ struct hc_driver { * or bandwidth constraints. */ void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); + /* Override the endpoint-derived interval + * (if there is any cached hardware state). + */ + void (*fixup_endpoint)(struct usb_hcd *hcd, struct usb_device *udev, + struct usb_host_endpoint *ep, int interval); /* Returns the hardware-chosen device address */ int (*address_device)(struct usb_hcd *, struct usb_device *udev); /* prepares the hardware to send commands to the device */ @@ -443,6 +448,8 @@ extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *); extern void usb_hcd_flush_endpoint(struct usb_device *udev, struct usb_host_endpoint *ep); +extern void usb_hcd_fixup_endpoint(struct usb_device *udev, + struct usb_host_endpoint *ep, int interval); extern void usb_hcd_disable_endpoint(struct usb_device *udev, struct usb_host_endpoint *ep); extern void usb_hcd_reset_endpoint(struct usb_device *udev,