Re: [PATCH] ASoC: sun4i-codec: Distinguish sun4i from sun7i

From: Mark Brown
Date: Tue Sep 06 2016 - 06:33:51 EST


On Mon, Sep 05, 2016 at 09:24:04PM +0200, Danny Milosavljevic wrote:

> -static const struct snd_kcontrol_new sun4i_codec_widgets[] = {
> - SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
> - SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
> - sun4i_codec_pa_volume_scale),
> +#define SUN4I_COMMON_CODEC_CONTROLS \
> + SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,\
> + SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,\
> + sun4i_codec_pa_volume_scale)
> +
> +static const struct snd_kcontrol_new sun4i_codec_controls[] = {
> + SUN4I_COMMON_CODEC_CONTROLS,
> +};

No, please don't do this - macros like this just make the code harder to
work with. Do what everything else that handles multiple devices in one
driver does and have several different tables of controls, registering
the ones that are appropriate for the current device at runtime.

Attachment: signature.asc
Description: PGP signature