[alsa-devel] [PATCH RFT] ASoC: ak4642: Fix up max_register setting
Mark Brown
broonie at kernel.org
Tue Jun 30 17:18:18 CEST 2015
On Tue, Jun 30, 2015 at 07:25:57PM +0800, Axel Lin wrote:
> 2015-06-30 18:46 GMT+08:00 Mark Brown <broonie at kernel.org>:
> >> static const struct regmap_config ak4642_regmap = {
> >> .reg_bits = 8,
> >> .val_bits = 8,
> >> - .max_register = ARRAY_SIZE(ak4642_reg) + 1,
> >> + .max_register = FIL1_3,
> >> .reg_defaults = ak4642_reg,
> >> - .num_reg_defaults = ARRAY_SIZE(ak4642_reg),
> >> + .num_reg_defaults = FIL1_3 + 1,
> > This change is incorrect, the number of register defaults must match the
> > size of the array of register defaults being passed in. Why are you
> > changing this?
> Because I reuse the same reg_default for ak4642 and ak4643.
> According to the datasheet:
> For ak4642, the valid registers are 0x0 ~ 0x1f (FIL1_3)
> For ak4643, the valid registers are 0x0 ~ 0x24 (SPK_MS)
> The default registers for 0x0 ~ 0x1f are the same for ak4642 and ak4643.
Ah, I see. That definitely deserves a comment since it's very unusual -
possibly also with a BUILD_BUG_ON() for the define being less than
ARRAY_SIZE().
> Or do you prefer having separate reg_default for ak4642 and ak4643?
> (Then it can use ARRAY_SIZE() here.)
No, what you're doing is OK but really ought to have comments so it's
clearer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150630/cf4e6fc1/attachment.sig>
More information about the Alsa-devel
mailing list