[alsa-devel] [PATCH] ASoC: tas571x: Fix -Wunused-const-variable

Nick Desaulniers ndesaulniers at google.com
Thu Jun 13 01:55:18 CEST 2019


On Wed, Jun 12, 2019 at 4:25 PM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux at googlegroups.com> wrote:
> Since tac5711_controls is identical to tas5721_controls we can just swap
> them

380 static const struct snd_kcontrol_new tas5711_controls[] = {
381   SOC_SINGLE_TLV("Master Volume",
382            TAS571X_MVOL_REG,
383            0, 0xff, 1, tas5711_volume_tlv),
384   SOC_DOUBLE_R_TLV("Speaker Volume",
385        TAS571X_CH1_VOL_REG,
386        TAS571X_CH2_VOL_REG,
387        0, 0xff, 1, tas5711_volume_tlv),
388   SOC_DOUBLE("Speaker Switch",
389        TAS571X_SOFT_MUTE_REG,
390        TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
391        1, 1),
392 };

vs

666 static const struct snd_kcontrol_new tas5721_controls[] = {
667   SOC_SINGLE_TLV("Master Volume",
668            TAS571X_MVOL_REG,
669            0, 0xff, 1, tas5711_volume_tlv),
670   SOC_DOUBLE_R_TLV("Speaker Volume",
671        TAS571X_CH1_VOL_REG,
672        TAS571X_CH2_VOL_REG,
673        0, 0xff, 1, tas5711_volume_tlv),
674   SOC_DOUBLE("Speaker Switch",
675        TAS571X_SOFT_MUTE_REG,
676        TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
677        1, 1),
678 };

Thanks for the patch!

Reviewed-by: Nick Desaulniers <ndesaulniers at google.com>

Alternatively, we could make 2 variables w/ the same variable, 1
variable.  It seems there's at least 4 `_control` variables:
tas5711_controls
tas5707_controls
tas5717_controls
tas5721_controls

so maybe `tas57X1_controls` would be appropriate?  Not sure if the
maintainers have a preference here?

(Looks like L669 also refers to tas5711, but it seems there no tas5721
equivalent for `_volume_tlv`.)
-- 
Thanks,
~Nick Desaulniers


More information about the Alsa-devel mailing list