[alsa-devel] [PATCH] ALSA: compress: fix the states to check for allowing read

Vinod Koul vinod.koul at intel.com
Mon Apr 29 10:57:11 CEST 2013


On Mon, Apr 29, 2013 at 11:20:42AM +0200, Takashi Iwai wrote:
> > I started with switch and then didnt want to code for all the PCM_STATES... but
> > yes that makes more sense, i will send that right away.
> 
> You can code like
> 	switch (stream->runtime->state) {
> 	case SNDRV_PCM_STATE_RUNNING:
> 	case SNDRV_PCM_STATE_DRAINING:
> 	case SNDRV_PCM_STATE_PAUSED:
> 	case SNDRV_PCM_STATE_SETUP:
> 		break; /* OK */
> 	default:
> 		retval = -EBADFD;
> 		break;
> 	}
Yup, and i did exactly opposite, let me know if you want like this :)

--
~Vinod


More information about the Alsa-devel mailing list