Re: [RFCv2 08/10] xhci: Add a global command queue

From: Dan Williams
Date: Wed Feb 05 2014 - 01:57:18 EST


On Thu, Jan 30, 2014 at 6:10 AM, Mathias Nyman
<mathias.nyman@xxxxxxxxxxxxxxx> wrote:
> Create a list to store command structures, add a strucure to it every time
> a command is submitted, and remove it from the list once we get a
> command completion event matching the command.
>
> Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> ---
> drivers/usb/host/xhci-mem.c | 8 ++++++++
> drivers/usb/host/xhci-ring.c | 13 ++++++++++++-
> drivers/usb/host/xhci.h | 1 +
> 3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 49b8bd0..7f8e4c3 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1694,6 +1694,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
> {
> struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
> struct xhci_cd *cur_cd, *next_cd;
> + struct xhci_command *cur_cmd, *next_cmd;
> int size;
> int i, j, num_ports;
>
> @@ -1722,6 +1723,12 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
> kfree(cur_cd);
> }
>
> + list_for_each_entry_safe(cur_cmd, next_cmd,
> + &xhci->cmd_list, cmd_list) {
> + list_del(&cur_cmd->cmd_list);
> + kfree(cur_cmd);
> + }
> +

Aren't commands on the cmd_list currently being executed, or are there
other guarantees that make sure all commands have terminated?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/