Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org, philipp@dreimann.net,
	joseph.salisbury@canonical.com
Subject: Re: [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks
Date: Thu, 12 Jul 2012 17:27:02 +0200	[thread overview]
Message-ID: <4FFEECC6.1090200@gmail.com> (raw)
In-Reply-To: <4FFEEB5A.6080004@ladisch.de>

On 12.07.2012 17:20, Clemens Ladisch wrote:
> Daniel Mack wrote:
>> On 12.07.2012 16:29, Clemens Ladisch wrote:
>>> Daniel Mack wrote:
>>>> In endpoint.c, bail out earlier in case the stream is stopped.
>>>> ...
>>>> @@ -350,7 +350,8 @@ static void snd_complete_urb(struct urb *urb)
>>>>  		     urb->status == -ENODEV ||		/* device removed */
>>>>  		     urb->status == -ECONNRESET ||	/* unlinked */
>>>>  		     urb->status == -ESHUTDOWN ||	/* device disabled */
>>>> -		     ep->chip->shutdown))		/* device disconnected */
>>>> +		     ep->chip->shutdown) ||		/* device disconnected */
>>>> +		     !test_bit(EP_FLAG_RUNNING, &ep->flags))
>>>>  		goto exit_clear;
>>>
>>> Is this really needed?
>>> The URBs will be unlinked at the same time.
>>
>> This just brings the code in sync with what we had before. If URBs are
>> just unlinked but not killed, they will return with data payload, and in
>> case of implicit feedback streams, the retire code could issue new
>> output packets.
> 
> And is that bad?
> 
> The EP_FLAG_RUNNING bit is cleared immediately before the URBs are
> unlinked, and some URB could have been completed regularly immediately
> before that.  So if there is any case where the additional test_bit()
> call prevents submitting a new playback packet, there is another similar
> case where you've just got such a playback packet anyway.
> 
> In other words: if that test_bit() call were necessary to protect
> against something bad, it wouldn't be sufficient.
> 
> The driver ensures that (implicit feedback) playback URBs are unlinked
> only after the corresponding capture URBs have been completely killed,
> doesn't it?

You're right. Especially because sending out packets in implicit
feedback mode happens from queue_pending_output_urbs() which has an
extra chip.

So we can drop the whole patch then. Thanks for the review!


Daniel

  reply	other threads:[~2012-07-12 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 13:19 [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks Daniel Mack
2012-07-12 13:19 ` [PATCH 2/2] ALSA: snd-usb: move calls to usb_set_interface Daniel Mack
2012-07-13  5:58   ` Takashi Iwai
2012-07-13  6:08     ` Daniel Mack
2012-07-13  7:33       ` Takashi Iwai
2012-07-12 14:29 ` [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks Clemens Ladisch
2012-07-12 14:58   ` Daniel Mack
2012-07-12 15:20     ` Clemens Ladisch
2012-07-12 15:27       ` Daniel Mack [this message]
     [not found]         ` <4FFF232E.8020008@canonical.com>
2012-07-12 19:26           ` Daniel Mack

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=4FFEECC6.1090200@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=joseph.salisbury@canonical.com \
    --cc=philipp@dreimann.net \
    --cc=tiwai@suse.de \
    /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