All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>, tiwai@suse.com
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/5] ALSA: pcm: Fix poll error return codes
Date: Thu, 5 May 2016 08:26:44 +0900	[thread overview]
Message-ID: <572A8534.4020207@sakamocchi.jp> (raw)
In-Reply-To: <1462370351-15388-2-git-send-email-ckeepax@opensource.wolfsonmicro.com>

Hi,

On May 4 2016 22:59, Charles Keepax wrote:
> We can't return a negative error code from the poll callback the return
> type is unsigned and is checked against the poll specific flags we need
> to return POLLERR if we encounter an error.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  sound/core/pcm_native.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 9106d8e..c61fd50 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -3161,7 +3161,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
>  
>  	substream = pcm_file->substream;
>  	if (PCM_RUNTIME_CHECK(substream))
> -		return -ENXIO;
> +		return POLLOUT | POLLWRNORM | POLLERR;
>  	runtime = substream->runtime;
>  
>  	poll_wait(file, &runtime->sleep, wait);
> @@ -3200,7 +3200,7 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
>  
>  	substream = pcm_file->substream;
>  	if (PCM_RUNTIME_CHECK(substream))
> -		return -ENXIO;
> +		return POLLIN | POLLRDNORM | POLLERR;
>  	runtime = substream->runtime;
>  
>  	poll_wait(file, &runtime->sleep, wait);

I agree with the concept of your patch to fix the return value of ALSA
PCM core. It should return a value which consists of POLLxxx masks.

On the other hand, I think POLLOUT, POLLIN, POLLWRNORM and POLLRDNORM
should not be included in the value. PCM_RUNTIME_CHECK() ensures PCM
substream or PCM runtime is NULL. This means that subsequent I/O
operations are failed, at least for handling PCM frames.

I think it better to return 'POLLERR | POLLHUP'.


Regards

Takashi Sakamoto

  reply	other threads:[~2016-05-04 23:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 13:59 [PATCH 0/5] Fix poll error returns Charles Keepax
2016-05-04 13:59 ` [PATCH 1/5] ALSA: pcm: Fix poll error return codes Charles Keepax
2016-05-04 23:26   ` Takashi Sakamoto [this message]
2016-05-05  9:39     ` Clemens Ladisch
2016-05-05 11:46       ` Charles Keepax
2016-05-06 18:11         ` Takashi Sakamoto
2016-05-04 13:59 ` [PATCH 2/5] ALSA: compress: Use snd_compr_get_poll on error path Charles Keepax
2016-05-04 13:59 ` [PATCH 3/5] ALSA: compress: Remove pointless NULL check Charles Keepax
2016-05-04 13:59 ` [PATCH 4/5] ALSA: compress: Fix poll error return codes Charles Keepax
2016-05-04 13:59 ` [PATCH v6 RESEND 5/5] ALSA: compress: Replace complex if statement with switch Charles Keepax
2016-05-09 12:13 ` [PATCH 0/5] Fix poll error returns Takashi Iwai
2016-05-09 15:19   ` Vinod Koul
2016-05-09 15:36     ` Takashi Iwai

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=572A8534.4020207@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.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 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.