6dd938b6d9ad7b92b6977214c2164cd95181ca65
[openwrt/staging/blogic.git] /
1 From 5f6feeaf528cf922a82f11e5b0711f5fe9d7538d Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Fri, 7 Jun 2019 14:50:12 +0100
4 Subject: [PATCH 652/806] Revert "usb: xhci: hack xhci_urb_enqueue to support
5 hid.mousepoll behaviour"
6
7 This reverts commit 1cf1071a79f320bc4497a3ade77431f04442eb17.
8 ---
9 drivers/usb/host/xhci.c | 86 -----------------------------------------
10 1 file changed, 86 deletions(-)
11
12 --- a/drivers/usb/host/xhci.c
13 +++ b/drivers/usb/host/xhci.c
14 @@ -1416,87 +1416,6 @@ command_cleanup:
15 }
16
17 /*
18 - * RPI: Fixup endpoint intervals when requested
19 - * - Check interval versus the (cached) endpoint context
20 - * - set the endpoint interval to the new value
21 - * - force an endpoint configure command
22 - */
23 -static void xhci_fixup_interval(struct xhci_hcd *xhci, struct urb *urb,
24 - unsigned int slot_id, unsigned int ep_index)
25 -{
26 - struct xhci_ep_ctx *ep_ctx_out, *ep_ctx_in;
27 - struct xhci_command *command;
28 - struct xhci_input_control_ctx *ctrl_ctx;
29 - struct xhci_virt_device *vdev;
30 - int xhci_interval, ep_interval;
31 - int ret;
32 - unsigned long flags;
33 - u32 ep_info_tmp;
34 -
35 - spin_lock_irqsave(&xhci->lock, flags);
36 -
37 - vdev = xhci->devs[slot_id];
38 - /* Get context-derived endpoint interval */
39 - ep_ctx_out = xhci_get_ep_ctx(xhci, vdev->out_ctx, ep_index);
40 - ep_ctx_in = xhci_get_ep_ctx(xhci, vdev->in_ctx, ep_index);
41 - xhci_interval = EP_INTERVAL_TO_UFRAMES(le32_to_cpu(ep_ctx_out->ep_info));
42 - ep_interval = urb->interval * 8;
43 -
44 - if (ep_interval == xhci_interval) {
45 - spin_unlock_irqrestore(&xhci->lock, flags);
46 - return;
47 - }
48 -
49 - xhci_dbg(xhci, "Fixup interval ep_interval=%d xhci_interval=%d\n",
50 - ep_interval, xhci_interval);
51 - command = xhci_alloc_command_with_ctx(xhci, true, GFP_ATOMIC);
52 - if (!command) {
53 - /* Failure here is benign, poll at the original rate */
54 - spin_unlock_irqrestore(&xhci->lock, flags);
55 - return;
56 - }
57 -
58 - /* xHCI uses exponents for intervals... */
59 - xhci_interval = fls(ep_interval) - 1;
60 - xhci_interval = clamp_val(xhci_interval, 3, 10);
61 - ep_info_tmp = le32_to_cpu(ep_ctx_out->ep_info);
62 - ep_info_tmp &= ~EP_INTERVAL(255);
63 - ep_info_tmp |= EP_INTERVAL(xhci_interval);
64 -
65 - /* Keep the endpoint context up-to-date while issuing the command. */
66 - xhci_endpoint_copy(xhci, vdev->in_ctx,
67 - vdev->out_ctx, ep_index);
68 - ep_ctx_in->ep_info = cpu_to_le32(ep_info_tmp);
69 -
70 - /*
71 - * We need to drop the lock, so take an explicit copy
72 - * of the ep context.
73 - */
74 - xhci_endpoint_copy(xhci, command->in_ctx, vdev->in_ctx, ep_index);
75 -
76 - ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx);
77 - if (!ctrl_ctx) {
78 - xhci_warn(xhci,
79 - "%s: Could not get input context, bad type.\n",
80 - __func__);
81 - spin_unlock_irqrestore(&xhci->lock, flags);
82 - xhci_free_command(xhci, command);
83 - return;
84 - }
85 - ctrl_ctx->add_flags = xhci_get_endpoint_flag_from_index(ep_index);
86 - ctrl_ctx->drop_flags = 0;
87 -
88 - spin_unlock_irqrestore(&xhci->lock, flags);
89 -
90 - ret = xhci_configure_endpoint(xhci, urb->dev, command,
91 - false, false);
92 - if (ret)
93 - xhci_warn(xhci, "%s: Configure endpoint failed: %d\n",
94 - __func__, ret);
95 - xhci_free_command(xhci, command);
96 -}
97 -
98 -/*
99 * non-error returns are a promise to giveback() the urb later
100 * we drop ownership so next owner (or urb unlink) can get it
101 */
102 @@ -1564,11 +1483,6 @@ static int xhci_urb_enqueue(struct usb_h
103 }
104 }
105
106 - if (usb_endpoint_xfer_int(&urb->ep->desc) &&
107 - (urb->dev->speed == USB_SPEED_FULL ||
108 - urb->dev->speed == USB_SPEED_LOW))
109 - xhci_fixup_interval(xhci, urb, slot_id, ep_index);
110 -
111 spin_lock_irqsave(&xhci->lock, flags);
112
113 if (xhci->xhc_state & XHCI_STATE_DYING) {