aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-08-07 17:04:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:17 -0400
commitf2217e8edd95b0428d8123d426e0097a5e955f9f (patch)
tree2364fb618dcae52cc8b6a947ce75152983dc3a9a /drivers/usb/host/xhci-mem.c
parent018218d1d9eb06116d24a02dd5e7a390f0353d0f (diff)
USB: xhci: Configure endpoint code refactoring.
Refactor out the code issue, wait for, and parse the event completion code for a configure endpoint command. Modify it to support the evaluate context command, which has a very similar submission process. Add functions to copy parts of the output context into the input context (which will be used in the evaluate context command). Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index cb2033879ae..c5313c83f42 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -601,6 +601,44 @@ void xhci_endpoint_zero(struct xhci_hcd *xhci,
601 */ 601 */
602} 602}
603 603
604/* Copy output xhci_ep_ctx to the input xhci_ep_ctx copy.
605 * Useful when you want to change one particular aspect of the endpoint and then
606 * issue a configure endpoint command.
607 */
608void xhci_endpoint_copy(struct xhci_hcd *xhci,
609 struct xhci_virt_device *vdev, unsigned int ep_index)
610{
611 struct xhci_ep_ctx *out_ep_ctx;
612 struct xhci_ep_ctx *in_ep_ctx;
613
614 out_ep_ctx = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index);
615 in_ep_ctx = xhci_get_ep_ctx(xhci, vdev->in_ctx, ep_index);
616
617 in_ep_ctx->ep_info = out_ep_ctx->ep_info;
618 in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2;
619 in_ep_ctx->deq = out_ep_ctx->deq;
620 in_ep_ctx->tx_info = out_ep_ctx->tx_info;
621}
622
623/* Copy output xhci_slot_ctx to the input xhci_slot_ctx.
624 * Useful when you want to change one particular aspect of the endpoint and then
625 * issue a configure endpoint command. Only the context entries field matters,
626 * but we'll copy the whole thing anyway.
627 */
628void xhci_slot_copy(struct xhci_hcd *xhci, struct xhci_virt_device *vdev)
629{
630 struct xhci_slot_ctx *in_slot_ctx;
631 struct xhci_slot_ctx *out_slot_ctx;
632
633 in_slot_ctx = xhci_get_slot_ctx(xhci, vdev->in_ctx);
634 out_slot_ctx = xhci_get_slot_ctx(xhci, vdev->out_ctx);
635
636 in_slot_ctx->dev_info = out_slot_ctx->dev_info;
637 in_slot_ctx->dev_info2 = out_slot_ctx->dev_info2;
638 in_slot_ctx->tt_info = out_slot_ctx->tt_info;
639 in_slot_ctx->dev_state = out_slot_ctx->dev_state;
640}
641
604/* Set up the scratchpad buffer array and scratchpad buffers, if needed. */ 642/* Set up the scratchpad buffer array and scratchpad buffers, if needed. */
605static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags) 643static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
606{ 644{