On Fri, Aug 23, 2013 at 11:15:10AM +0300, Xenia Ragiadakou wrote: > This patch refactors the code in TRB_CONFIG_EP switch case, in > handle_cmd_completion(), into a fuction named xhci_handle_cmd_config_ep(). > > There were added two additional variables, 'add_flags' and 'drop_flags', > to reduce line length below 80 chars and improve code readability. Much better, thanks! Only one thing... > Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx> > --- > drivers/usb/host/xhci-ring.c | 112 +++++++++++++++++++++++-------------------- > 1 file changed, 60 insertions(+), 52 deletions(-) > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index beeee96..7103bd9 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -1393,6 +1393,64 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) > xhci_free_virt_device(xhci, slot_id); > } > > +static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, > + struct xhci_event_cmd *event, u32 cmd_comp_code) > +{ > + struct xhci_virt_device *virt_dev; > + struct xhci_input_control_ctx *ctrl_ctx; > + unsigned int ep_index; > + unsigned int ep_state; > + u32 add_flags, drop_flags; > + > + virt_dev = xhci->devs[slot_id]; > + if (handle_cmd_in_cmd_wait_list(xhci, virt_dev, event)) > + return; > + /* > + * Configure endpoint commands can come from the USB core > + * configuration or alt setting changes, or because the HW > + * needed an extra configure endpoint command after a reset > + * endpoint command or streams were being configured. > + * If the command was for a halted endpoint, the xHCI driver > + * is not waiting on the configure endpoint command. > + */ > + ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); > + if (!ctrl_ctx) { > + xhci_warn(xhci, "Could not get input context, bad type.\n"); > + return; > + } Can you add an extra newline here for readibility? > + add_flags = le32_to_cpu(ctrl_ctx->add_flags); > + drop_flags = le32_to_cpu(ctrl_ctx->drop_flags); > + /* Input ctx add_flags are the endpoint index plus one */ > + ep_index = xhci_last_valid_endpoint(add_flags) - 1; And here. > + /* A usb_set_interface() call directly after clearing a halted > + * condition may race on this quirky hardware. Not worth > + * worrying about, since this is prototype hardware. Not sure > + * if this will work for streams, but streams support was > + * untested on this prototype. > + */ > + if (xhci->quirks & XHCI_RESET_EP_QUIRK && > + ep_index != (unsigned int) -1 && > + add_flags - SLOT_FLAG == drop_flags) { > + ep_state = virt_dev->eps[ep_index].ep_state; > + if (!(ep_state & EP_HALTED)) > + goto bandwidth_change; > + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, > + "Completed config ep cmd - " > + "last ep index = %d, state = %d", > + ep_index, ep_state); > + /* Clear internal halted state and restart ring(s) */ > + virt_dev->eps[ep_index].ep_state &= ~EP_HALTED; > + ring_doorbell_for_active_rings(xhci, slot_id, ep_index); > + return; > + } Otherwise looks great! Sarah Sharp -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html