[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240104105442.2820-1-hdanton@sina.com>
Date: Thu, 4 Jan 2024 18:54:42 +0800
From: Hillf Danton <hdanton@...a.com>
To: Wesley Cheng <quic_wcheng@...cinc.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
linux-sound@...r.kernel.org,
linux-usb@...r.kernel.org,
Mathias Nyman <mathias.nyman@...ux.intel.com>
Subject: Re: [PATCH v12 02/41] xhci: add helper to stop endpoint and wait for completion
On Tue, 2 Jan 2024 13:45:10 -0800
> From: Mathias Nyman <mathias.nyman@...ux.intel.com>
> +/*
> + * Synchronous XHCI stop endpoint helper. Issues the stop endpoint command and
> + * waits for the command completion before returning.
> + */
> +int xhci_stop_endpoint_sync(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, int suspend,
> + gfp_t gfp_flags)
> +{
> + struct xhci_command *command;
> + unsigned long flags;
> + int ret;
> +
> + command = xhci_alloc_command(xhci, true, GFP_KERNEL);
Given unused gfp_flags, s/GFP_KERNEL/gfp_flags/ ?
> + if (!command)
> + return -ENOMEM;
> +
> + spin_lock_irqsave(&xhci->lock, flags);
> + ret = xhci_queue_stop_endpoint(xhci, command, ep->vdev->slot_id,
> + ep->ep_index, suspend);
> + if (ret < 0) {
> + spin_unlock_irqrestore(&xhci->lock, flags);
> + goto out;
> + }
> +
> + xhci_ring_cmd_db(xhci);
> + spin_unlock_irqrestore(&xhci->lock, flags);
> +
> + ret = wait_for_completion_timeout(command->completion, msecs_to_jiffies(3000));
> + if (!ret)
> + xhci_warn(xhci, "%s: Unable to stop endpoint.\n",
> + __func__);
> +
> + if (command->status == COMP_COMMAND_ABORTED ||
> + command->status == COMP_COMMAND_RING_STOPPED) {
> + xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");
> + ret = -ETIME;
> + }
> +out:
> + xhci_free_command(xhci, command);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(xhci_stop_endpoint_sync);
Powered by blists - more mailing lists