[alsa-devel] [PATCH 1/1] ALSA: compress_core: Ensure device is stopped when stream closed

Mark Brown broonie at kernel.org
Fri Apr 26 17:38:48 CEST 2013


On Fri, Apr 26, 2013 at 02:56:27PM +0100, Richard Fitzgerald wrote:
> >> +     if ((data->stream.runtime->state == SNDRV_PCM_STATE_RUNNING) ||
> >> +         (data->stream.runtime->state == SNDRV_PCM_STATE_PAUSED))
> >> +             data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
> >> +

> >A switch statement would be more idiomatic for this sort of thing.
> >

> This follows the general style used in other functions in the
> source file. I'm happy to upload a version that uses a switch
> instead if that's preferred.

Well, it doesn't quite follow the same style as the code generally does:

        if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
                        stream->runtime->state == SNDRV_PCM_STATE_OPEN) {

with fewer () and different indentation to what you have above...  being
consistent with the rest of the file is best, though it would be nice to
update the file to do this sort of thing with switches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130426/1a04220f/attachment.sig>


More information about the Alsa-devel mailing list