[PATCH v2] ASoC: max98373: don't access volatile registers in bias level off

Mark Brown broonie at kernel.org
Tue Dec 15 13:11:43 CET 2020


On Mon, Dec 14, 2020 at 02:42:37PM +0800, Bard Liao wrote:

> --- a/sound/soc/codecs/max98373.h
> +++ b/sound/soc/codecs/max98373.h
> @@ -203,6 +203,17 @@
>  /* MAX98373_R2000_SW_RESET */
>  #define MAX98373_SOFT_RESET (0x1 << 0)
>  
> +struct max98373_cache {
> +	u32 reg;
> +	u32 val;
> +};
> +
> +struct max98373_cache max98373_cache[] = {
> +	{MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK, 0},
> +	{MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK, 0},
> +	{MAX98373_R20B6_BDE_CUR_STATE_READBACK, 0},
> +};

This is declaring a variable in the header, meaning there'll be one copy
in each of the object files using the header and that if they get linked
into a single object you should get warnings about duplicate symbols.
It would be better to both allocate the version used at runtime
dynamically (in case we somehow get multiple max98373s in a system) and
have this list of registers be a static variable inside the driver code
which is used to initialize that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20201215/128905cc/attachment.sig>


More information about the Alsa-devel mailing list