Re: [alsa-devel] [PATCH] ASoC: pcm512x: Add PCM512x driver
From: Takashi Iwai <hidden>
Date: 2014-02-06 13:12:48
Also in:
alsa-devel
At Thu, 6 Feb 2014 13:07:35 +0000, Mark Brown wrote:
On Thu, Feb 06, 2014 at 01:51:33PM +0100, Takashi Iwai wrote:quoted
Mark Brown wrote:quoted
quoted
+static const char *pcm512x_dsp_program_texts[] = {quoted
The numbers of items in pcm512x_dsp_program_texts[] and _values[] don't match.Yeah, fixed.
I'm thinking whether we can check this in the macro. I thought of using BUILD_BUG_ON(), but it's unsure whether it aligns there well.
quoted
quoted
+static const struct soc_enum pcm512x_clk_missing = + SOC_ENUM_SINGLE(PCM512x_CLKDET, 0, 7, pcm512x_clk_missing_text);quoted
Isn't it 8?Hrm, it is but this points out an error in the control helpers which has been there since forever - they call that parameter max but it's not a maximum, it's the number of elements in the enumeration. I bet we have a bunch of other enumerations which miss the last element as a result.
Yeah, the argument name is really confusing. I had to double-check the code when I reviewed your patch, too :) Also it'd be better to have a practice to use either ARRAY_SIZE() or a constant there, too. Takashi -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html