public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lu, Baolu" <baolu.lu@linux.intel.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] usb: xhci: fix checking ep busy for CFC
Date: Thu, 29 Oct 2015 20:58:33 +0800	[thread overview]
Message-ID: <563217F9.7040707@linux.intel.com> (raw)
In-Reply-To: <5632165E.2020102@cogentembedded.com>



On 10/29/2015 08:51 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 10/29/2015 5:46 AM, 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>
>>
>> ---
>> v1->v2:
>> Implement the logic in xhci_queue_isoc_tx_prepare() instead of
>> a seperated function as suggested by Mathias.
>>
>> ---
>>   drivers/usb/host/xhci-ring.c | 32 ++++++--------------------------
>>   1 file changed, 6 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>> index fa83625..8edc286 100644
>> --- a/drivers/usb/host/xhci-ring.c
>> +++ b/drivers/usb/host/xhci-ring.c
> [...]
>> @@ -3983,10 +3961,12 @@ int xhci_queue_isoc_tx_prepare(struct 
>> xhci_hcd *xhci, gfp_t mem_flags,
>>       }
>>
>>       /* Calculate the start frame and put it in urb->start_frame. */
>> -    if (HCC_CFC(xhci->hcc_params) &&
>> -            ep_ring_is_processing(xhci, slot_id, ep_index)) {
>> -        urb->start_frame = xep->next_frame_id;
>> -        goto skip_start_over;
>> +    if (HCC_CFC(xhci->hcc_params)) {
>> +        if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK)
>> +                    == EP_STATE_RUNNING &&
>> +                !list_empty(&ep_ring->td_list))
>> +            urb->start_frame = xep->next_frame_id;
>> +            goto skip_start_over;
>
>    Forgot {}?

Oh, I am sorry. I am wondering how it passed my test.

I will send v3 patch soon any way.

>
>>       }
>>
>>       start_frame = readl(&xhci->run_regs->microframe_index);
>
> MBR, Sergei
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


  reply	other threads:[~2015-10-29 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29  2:46 [PATCH v2 1/1] usb: xhci: fix checking ep busy for CFC Lu Baolu
2015-10-29 12:51 ` Sergei Shtylyov
2015-10-29 12:58   ` Lu, Baolu [this message]
2015-10-29 14:08     ` Mathias Nyman
2015-10-29 14:25       ` 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=563217F9.7040707@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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