mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] usb: xhci: fix checking ep busy for CFC
Date: Wed, 28 Oct 2015 15:27:10 +0200	[thread overview]
Message-ID: <5630CD2E.8030304@intel.com> (raw)
In-Reply-To: <1445996189-2688-1-git-send-email-baolu.lu@linux.intel.com>

On 28.10.2015 03:36, Lu Baolu wrote:
> Function ep_ring_is_processing() checks the dequeue pointer
> in endpoint context to know whether an endpoint is busy with
> processing TRBs. This is not correct since dequeue pointer
> field in an endpoint context is only valid when the endpoint
> is in Halted or Stopped states. This buggy code causes audio
> noise when playing sound with USB headset connected to host
> controllers which support CFC (one of xhci 1.1 features).
>
> This patch should exist in stable kernel since v4.3.
>
> Reported-and-tested-by: YD Tseng <yd_tseng@asmedia.com.tw>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>   drivers/usb/host/xhci-ring.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index fa83625..2b50d45 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -3903,7 +3903,6 @@ static int ep_ring_is_processing(struct xhci_hcd *xhci,
>   	struct xhci_ring *ep_ring;
>   	struct xhci_ep_ctx *ep_ctx;
>   	struct xhci_virt_ep *xep;
> -	dma_addr_t hw_deq;
>
>   	xdev = xhci->devs[slot_id];
>   	xep = &xhci->devs[slot_id]->eps[ep_index];
> @@ -3913,9 +3912,7 @@ static int ep_ring_is_processing(struct xhci_hcd *xhci,
>   	if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) != EP_STATE_RUNNING)
>   		return 0;
>
> -	hw_deq = le64_to_cpu(ep_ctx->deq) & ~EP_CTX_CYCLE_MASK;
> -	return (hw_deq !=
> -		xhci_trb_virt_to_dma(ep_ring->enq_seg, ep_ring->enqueue));
> +	return !list_empty(&ep_ring->td_list);
>   }

Would it make sense to remove the ep_ring_is_processing() function completely?

It is only called in one place, and the main use is checking list_empty(&ep_ring->td_list).
This could be checked directly in xhci_queue_isoc_tx_prepare()

-Mathias


  reply	other threads:[~2015-10-28 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  1:36 Lu Baolu
2015-10-28 13:27 ` Mathias Nyman [this message]
2015-10-29  1:41   ` Lu, Baolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5630CD2E.8030304@intel.com \
    --to=mathias.nyman@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome