From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756594AbbJ2Bla (ORCPT ); Wed, 28 Oct 2015 21:41:30 -0400 Received: from mga11.intel.com ([192.55.52.93]:26250 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756577AbbJ2Bl3 (ORCPT ); Wed, 28 Oct 2015 21:41:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,212,1444719600"; d="scan'208";a="673967809" Subject: Re: [PATCH 1/1] usb: xhci: fix checking ep busy for CFC To: Mathias Nyman , Greg Kroah-Hartman References: <1445996189-2688-1-git-send-email-baolu.lu@linux.intel.com> <5630CD2E.8030304@intel.com> Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: "Lu, Baolu" Message-ID: <5631792D.8030808@linux.intel.com> Date: Thu, 29 Oct 2015 09:41:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5630CD2E.8030304@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/2015 09:27 PM, Mathias Nyman wrote: > 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 >> Signed-off-by: Lu Baolu >> --- >> 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() Fair enough. I will make this change and send out the v2. > > -Mathias Thanks, Baolu > > -- > To unsubscribe from this list: send the line "unsubscribe > linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >