[Sound-open-firmware] [PATCH 18/25] volume: volume_cmd(): only stop/pause at running
Liam Girdwood
liam.r.girdwood at linux.intel.com
Thu Feb 9 11:19:26 CET 2017
On Thu, 2017-02-09 at 02:21 +0000, Jie, Yang wrote:
> > -----Original Message-----
> > From: sound-open-firmware-bounces at alsa-project.org [mailto:sound-open-
> > firmware-bounces at alsa-project.org] On Behalf Of Liam Girdwood
> > Sent: Wednesday, February 8, 2017 8:10 PM
> > To: Keyon Jie <yang.jie at linux.intel.com>
> > Cc: Jie, Yang <yang.jie at intel.com>; Ingalsuo, Seppo
> > <seppo.ingalsuo at intel.com>; sound-open-firmware at alsa-project.org
> > Subject: Re: [Sound-open-firmware] [PATCH 18/25] volume: volume_cmd(): only
> > stop/pause at running
> >
> > On Tue, 2017-02-07 at 22:03 +0800, Keyon Jie wrote:
> > > We should only stop/pause it when the volume component is in running
> > > status.
> > >
> > > Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> > > ---
> > > src/audio/volume.c | 9 +++++++--
> > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/audio/volume.c b/src/audio/volume.c index
> > > 7a3f608..eb1530f 100644
> > > --- a/src/audio/volume.c
> > > +++ b/src/audio/volume.c
> > > @@ -429,10 +429,15 @@ static int volume_cmd(struct comp_dev *dev, int
> > cmd, void *data)
> > > dev->state = COMP_STATE_RUNNING;
> > > break;
> > > case COMP_CMD_STOP:
> > > - dev->state = COMP_STATE_SETUP;
> > > + if (dev->state == COMP_STATE_RUNNING ||
> > > + dev->state == COMP_STATE_DRAINING ||
> > > + dev->state == COMP_STATE_PAUSED)
> > > + dev->state = COMP_STATE_SETUP;
> >
> > indentation
>
> Do you mean changing like this:
>
> case COMP_CMD_STOP:
> if (dev->state == COMP_STATE_RUNNING ||
> dev->state == COMP_STATE_DRAINING ||
> dev->state == COMP_STATE_PAUSED)
> dev->state = COMP_STATE_SETUP;
To be honest tabs alone don't make following if statements like this
easy. Sometimes you need to add some spaces to some of the conditions to
get alignment :-
if (x == 1 ||
y == 2 ||
z == 0)
state = a;
Liam
>
> Thanks,
> ~Keyon
>
> >
> > > break;
> > > case COMP_CMD_PAUSE:
> > > - dev->state = COMP_STATE_PAUSED;
> > > + /* only support pausing for running */
> > > + if (dev->state == COMP_STATE_RUNNING)
> > > + dev->state = COMP_STATE_PAUSED;
> > > break;
> > > case COMP_CMD_RELEASE:
> > > dev->state = COMP_STATE_RUNNING;
> >
> >
> > _______________________________________________
> > Sound-open-firmware mailing list
> > Sound-open-firmware at alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
> _______________________________________________
> Sound-open-firmware mailing list
> Sound-open-firmware at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
More information about the Sound-open-firmware
mailing list