[Sound-open-firmware] [PATCH 17/25] component: status: rename COMP_STATE_STOPPED to COMP_STATE_SETUP

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Feb 8 13:08:51 CET 2017


On Tue, 2017-02-07 at 22:03 +0800, Keyon Jie wrote:
> For component 'inactive, but ready' status, naming 'SETUP' may
> be more understandable than 'STOPPED', and 'SETUP' is consistent
> with ALSA.
> 
>      new()        params()       start()
> none ======> init =======> setup ======> running
>      <======      <=======       <======
>      free()       reset()         stop()

Please add this flow as comments to the COMP_STATE_ macros

> ---
>  src/audio/dai.c                    | 2 +-
>  src/audio/host.c                   | 2 +-
>  src/audio/mixer.c                  | 2 +-
>  src/audio/volume.c                 | 2 +-
>  src/include/reef/audio/component.h | 4 ++--
>  5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/audio/dai.c b/src/audio/dai.c
> index e827045..9c40b2f 100644
> --- a/src/audio/dai.c
> +++ b/src/audio/dai.c
> @@ -403,7 +403,7 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data)
>  			dai_trigger(dd->ssp, cmd, dd->direction);
>  		/* go through */
>  		case COMP_STATE_PREPARE:
> -			dev->state = COMP_STATE_INIT;
> +			dev->state = COMP_STATE_SETUP;
>  			break;
>  		}
>  		break;
> diff --git a/src/audio/host.c b/src/audio/host.c
> index 0580837..28b5e7b 100644
> --- a/src/audio/host.c
> +++ b/src/audio/host.c
> @@ -689,7 +689,7 @@ static int host_stop(struct comp_dev *dev)
>  	local_elem->src = source_elem->src;
>  	hd->next_inc = hd->period->size;
>  
> -	dev->state = COMP_STATE_STOPPED;
> +	dev->state = COMP_STATE_SETUP;
>  	return 0;
>  }
>  
> diff --git a/src/audio/mixer.c b/src/audio/mixer.c
> index 3a8d12f..4487862 100644
> --- a/src/audio/mixer.c
> +++ b/src/audio/mixer.c
> @@ -250,7 +250,7 @@ static int mixer_reset(struct comp_dev *dev)
>  	list_for_item(blist, &dev->bsource_list) {
>  		source = container_of(blist, struct comp_buffer, sink_list);
>  		/* only mix the sources with the same state with mixer*/
> -		if (source->source->state > COMP_STATE_STOPPED)
> +		if (source->source->state > COMP_STATE_SETUP)
>  			return 1; /* should not reset the downstream components */
>  	}
>  
> diff --git a/src/audio/volume.c b/src/audio/volume.c
> index ddab23b..7a3f608 100644
> --- a/src/audio/volume.c
> +++ b/src/audio/volume.c
> @@ -429,7 +429,7 @@ 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_STOPPED;
> +		dev->state = COMP_STATE_SETUP;
>  		break;
>  	case COMP_CMD_PAUSE:
>  		dev->state = COMP_STATE_PAUSED;
> diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h
> index fcef11e..2e88f19 100644
> --- a/src/include/reef/audio/component.h
> +++ b/src/include/reef/audio/component.h
> @@ -42,8 +42,8 @@
>  
>  /* audio component states */
>  #define COMP_STATE_INIT		0	/* component being initialised */
> -#define COMP_STATE_SUSPEND	1	/* component suspended */
> -#define COMP_STATE_STOPPED	2	/* component inactive, but ready */
> +#define COMP_STATE_SETUP       1       /* component inactive, but ready */
> +#define COMP_STATE_SUSPEND     2       /* component suspended */
>  #define COMP_STATE_DRAINING	3	/* component draining */
>  #define COMP_STATE_PREPARE	4	/* component prepared */
>  #define COMP_STATE_PAUSED	5	/* component paused */




More information about the Sound-open-firmware mailing list