15 Oct
2014
15 Oct
'14
12:49 p.m.
On Wed, Oct 15, 2014 at 12:34:56PM +0530, Vinod Koul wrote:
+static const struct snd_kcontrol_new sst_gain_controls[] = {
- SST_GAIN("media0_in", SST_PATH_INDEX_MEDIA0_IN, SST_TASK_MMX, 0, &sst_gains[0]),
- SST_GAIN("media1_in", SST_PATH_INDEX_MEDIA1_IN, SST_TASK_MMX, 0, &sst_gains[1]),
+/* the SST_GAIN macro above will create three alsa controls for each
- instance invoked, gain, mute and ramp duration, which use the same gain
- cell sst_gain to keep track of data
- To calculate number of gain cell instances we need to device by 3 in
- below caulcation for gain cell memory.
- This gets rid of static number and issues while adding new controls
- */
+static struct sst_gain_value sst_gains[ARRAY_SIZE(sst_gain_controls)/3];
The use of ARRAY_SIZE() is nice here but I'm a bit confused about the divide by 3 - there's an entry in sst_gains referenced for each element in sst_gain_controls.