Re: [RFC v2 2/2] xhci: refactor handle_cmd_completion() switch branches into functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 22, 2013 at 08:06:17PM +0000, Paul Zimmerman wrote:
> > From: Xenia Ragiadakou
> > Sent: Thursday, August 22, 2013 8:20 AM
> > 
> > This patch refactors the switch statement in handle_cmd_completion() by
> > creating a separate function for each branch, named 'xhci_handle_cmd_<type>'.
> > 
> > Other changes introduced by this patch are:
> > 
> > - Renaming the already existed functions by adding the prefix
> >   'xhci_handle_cmd_' for consistency. Also, for handle_stopped_endpoint()
> >   the order of arguments was changed too, so that the prototype of
> >   'xhci_handle_cmd_' be similar and easy to follow.
> > - Additional local variables were added, such as cmd_trb, cmd_comp_code,
> >   cmd_type, add_flags and drop_flags, and the label 'update_ring',
> >   mainly to reduce code dublication and line length.
> > - The variable ep_ring, that was assigned in the case TRB_CONFIG_EP
> >   but never used, was removed.
> 
> Just a small suggestion, I think it would be better to name these functions
> to indicate they handle completion events, instead of commands. So maybe
> xhci_handle_stop_ep_complete, xhci_handle_set_deq_complete,
> xhci_handle_reset_ep_complete etc?
> 
> Feel free to ignore me if you disagree :)

I think that would be confusing, because some of the functions that
handle command _completion_ events then go on to _complete_ the
xhci_command->completion struct.

So let's just drop the word complete from the function names at all.
You queue xHCI commands with the xhci_queue_<cmd> functions, and you
handle the commands being done in xhci_handle_cmd_<cmd> functions.

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux