* [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture
@ 2018-08-22 15:03 Ricardo Biehl Pasquali
2018-08-22 15:08 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Biehl Pasquali @ 2018-08-22 15:03 UTC (permalink / raw)
To: tiwai; +Cc: alsa-devel
In __snd_pcm_lib_xfer(), when capture, if state is PREPARED
and size is less than start_threshold nothing can be done.
As there is no error, 0 is returned.
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
---
version 2:
The code was not changed. Just resubmitting to follow the
rules from Documentation/process/submitting-patches.rst.
--- pcm_lib.c.orig 2018-08-21 15:31:54.457405053 -0300
+++ pcm_lib.c 2018-08-21 15:56:01.264549084 -0300
@@ -2125,7 +2125,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str
pcm_transfer_f transfer;
bool nonblock;
bool is_playback;
- int err;
+ int err = 0;
err = pcm_sanity_check(substream);
if (err < 0)
@@ -2173,11 +2173,15 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str
goto _end_unlock;
if (!is_playback &&
- runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
- size >= runtime->start_threshold) {
- err = snd_pcm_start(substream);
- if (err < 0)
+ runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
+ if (size >= runtime->start_threshold) {
+ err = snd_pcm_start(substream);
+ if (err < 0)
+ goto _end_unlock;
+ } else {
+ /* nothing to do */
goto _end_unlock;
+ }
}
runtime->twake = runtime->control->avail_min ? : 1;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture
2018-08-22 15:03 [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture Ricardo Biehl Pasquali
@ 2018-08-22 15:08 ` Takashi Iwai
2018-08-22 15:25 ` Ricardo Biehl Pasquali
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2018-08-22 15:08 UTC (permalink / raw)
To: Ricardo Biehl Pasquali; +Cc: alsa-devel
On Wed, 22 Aug 2018 17:03:59 +0200,
Ricardo Biehl Pasquali wrote:
>
> In __snd_pcm_lib_xfer(), when capture, if state is PREPARED
> and size is less than start_threshold nothing can be done.
> As there is no error, 0 is returned.
>
> Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
> ---
>
> version 2:
> The code was not changed. Just resubmitting to follow the
> rules from Documentation/process/submitting-patches.rst.
Almost good, but still not perfect, unfortunately :)
The patch should be applicable onto the kernel tree as is with -p1
option, i.e. the diff should be like
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
But never mind, I'll apply this manually at this time, just keep the
above in mind for the next time.
Currently we're dealing with 4.19 merge, hence I'm going to queue to
the branch for 4.20.
thanks,
Takashi
>
> --- pcm_lib.c.orig 2018-08-21 15:31:54.457405053 -0300
> +++ pcm_lib.c 2018-08-21 15:56:01.264549084 -0300
> @@ -2125,7 +2125,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str
> pcm_transfer_f transfer;
> bool nonblock;
> bool is_playback;
> - int err;
> + int err = 0;
>
> err = pcm_sanity_check(substream);
> if (err < 0)
> @@ -2173,11 +2173,15 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str
> goto _end_unlock;
>
> if (!is_playback &&
> - runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
> - size >= runtime->start_threshold) {
> - err = snd_pcm_start(substream);
> - if (err < 0)
> + runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
> + if (size >= runtime->start_threshold) {
> + err = snd_pcm_start(substream);
> + if (err < 0)
> + goto _end_unlock;
> + } else {
> + /* nothing to do */
> goto _end_unlock;
> + }
> }
>
> runtime->twake = runtime->control->avail_min ? : 1;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture
2018-08-22 15:08 ` Takashi Iwai
@ 2018-08-22 15:25 ` Ricardo Biehl Pasquali
2018-08-22 15:46 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Biehl Pasquali @ 2018-08-22 15:25 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
Takashi wrote:
> Almost good, but still not perfect, unfortunately :)
> The patch should be applicable onto the kernel tree as is with -p1
> option, i.e. the diff should be like
> --- a/sound/core/pcm_lib.c
> +++ b/sound/core/pcm_lib.c
>
> But never mind, I'll apply this manually at this time, just keep the
> above in mind for the next time.
Ok, thank you!
The .orig thing is ok if I had used the full pathname?
diff does not generate a/ and b/ (at least with '-up'
options). By the way, 'diff -up' is what
submitting-patches document recommends when no git tree
is available.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture
2018-08-22 15:25 ` Ricardo Biehl Pasquali
@ 2018-08-22 15:46 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-08-22 15:46 UTC (permalink / raw)
To: Ricardo Biehl Pasquali; +Cc: alsa-devel
On Wed, 22 Aug 2018 17:25:24 +0200,
Ricardo Biehl Pasquali wrote:
>
> Takashi wrote:
> > Almost good, but still not perfect, unfortunately :)
> > The patch should be applicable onto the kernel tree as is with -p1
> > option, i.e. the diff should be like
> > --- a/sound/core/pcm_lib.c
> > +++ b/sound/core/pcm_lib.c
> >
> > But never mind, I'll apply this manually at this time, just keep the
> > above in mind for the next time.
>
> Ok, thank you!
>
> The .orig thing is ok if I had used the full pathname?
That's OK. The patch just needs to be simply applicable with -p1.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-22 15:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-22 15:03 [PATCH v2] ALSA: pcm: Return 0 when size < start_threshold in capture Ricardo Biehl Pasquali
2018-08-22 15:08 ` Takashi Iwai
2018-08-22 15:25 ` Ricardo Biehl Pasquali
2018-08-22 15:46 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.