On Wed, Oct 15, 2014 at 03:53:03PM +0530, Vinod Koul wrote:
On Wed, Oct 15, 2014 at 12:49:47PM +0200, Mark Brown wrote:
On Wed, Oct 15, 2014 at 12:34:56PM +0530, Vinod Koul wrote:
+/* 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.
Thats is the reason added the comment above.
The comment isn't very clear (splitting it into multiple paragraphs doesn't help since it looks like the calculation stands separately to the controls), and everything would be a lot simpler if there were a define for the number of controls created per SST_GAIN() rather than just hard coding the magic number.