Skip to content

Commit 5270b95

Browse files
Sarah Sharpgregkh
authored andcommitted
USB: xhci: Refactor input device context setup.
Refactor common code to set up the add and drop flags for the input device context setup. This setup is used before a configure endpoint command for the reset endpoint quirk, and will be used for the command to alloc or free streams rings. Signed-off-by: Sarah Sharp <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 63a0d9a commit 5270b95

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

drivers/usb/host/xhci-hcd.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,12 +1247,27 @@ void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
12471247
xhci_zero_in_ctx(xhci, virt_dev);
12481248
}
12491249

1250+
static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci,
1251+
unsigned int slot_id, u32 add_flags, u32 drop_flags)
1252+
{
1253+
struct xhci_input_control_ctx *ctrl_ctx;
1254+
ctrl_ctx = xhci_get_input_control_ctx(xhci,
1255+
xhci->devs[slot_id]->in_ctx);
1256+
ctrl_ctx->add_flags = add_flags;
1257+
ctrl_ctx->drop_flags = drop_flags;
1258+
xhci_slot_copy(xhci, xhci->devs[slot_id]);
1259+
ctrl_ctx->add_flags |= SLOT_FLAG;
1260+
1261+
xhci_dbg(xhci, "Slot ID %d Input Context:\n", slot_id);
1262+
xhci_dbg_ctx(xhci, xhci->devs[slot_id]->in_ctx,
1263+
xhci_last_valid_endpoint(add_flags));
1264+
}
1265+
12501266
void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci,
12511267
unsigned int slot_id, unsigned int ep_index,
12521268
struct xhci_dequeue_state *deq_state)
12531269
{
12541270
struct xhci_container_ctx *in_ctx;
1255-
struct xhci_input_control_ctx *ctrl_ctx;
12561271
struct xhci_ep_ctx *ep_ctx;
12571272
u32 added_ctxs;
12581273
dma_addr_t addr;
@@ -1272,15 +1287,9 @@ void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci,
12721287
}
12731288
ep_ctx->deq = addr | deq_state->new_cycle_state;
12741289

1275-
xhci_slot_copy(xhci, xhci->devs[slot_id]);
1276-
1277-
ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx);
12781290
added_ctxs = xhci_get_endpoint_flag_from_index(ep_index);
1279-
ctrl_ctx->add_flags = added_ctxs | SLOT_FLAG;
1280-
ctrl_ctx->drop_flags = added_ctxs;
1281-
1282-
xhci_dbg(xhci, "Slot ID %d Input Context:\n", slot_id);
1283-
xhci_dbg_ctx(xhci, in_ctx, ep_index);
1291+
xhci_setup_input_ctx_for_config_ep(xhci, slot_id,
1292+
added_ctxs, added_ctxs);
12841293
}
12851294

12861295
void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,

0 commit comments

Comments
 (0)