lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hzgq1io88.wl-tiwai@suse.de>
Date:   Thu, 18 Nov 2021 14:32:07 +0100
From:   Takashi Iwai <tiwai@...e.de>
To:     Sameer Pujar <spujar@...dia.com>
Cc:     <broonie@...nel.org>, <lgirdwood@...il.com>, <perex@...ex.cz>,
        <tiwai@...e.com>, <thierry.reding@...il.com>,
        <jonathanh@...dia.com>, <alsa-devel@...a-project.org>,
        <linux-tegra@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 12/16] ASoC: tegra: Fix kcontrol put callback in MVC

On Thu, 18 Nov 2021 08:07:07 +0100,
Sameer Pujar wrote:
> 
> The kcontrol put callback is expected to return 1 when there is change
> in HW or when the update is acknowledged by driver. This would ensure
> that change notifications are sent to subscribed applications. Filter
> out duplicate updates in MVC driver.
> 
> Fixes: e539891f9687 ("ASoC: tegra: Add Tegra210 based MVC driver")
> Signed-off-by: Sameer Pujar <spujar@...dia.com>
> Suggested-by: Jaroslav Kysela <perex@...ex.cz>
> Suggested-by: Mark Brown <broonie@...nel.org>
> ---
>  sound/soc/tegra/tegra210_mvc.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c
> index b7e3170..85b1558 100644
> --- a/sound/soc/tegra/tegra210_mvc.c
> +++ b/sound/soc/tegra/tegra210_mvc.c
> @@ -136,7 +136,7 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol,
>  	struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
>  	struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
>  	unsigned int value;
> -	u8 mute_mask;
> +	u8 new_mask, old_mask;
>  	int err;
>  
>  	pm_runtime_get_sync(cmpnt->dev);
> @@ -148,11 +148,19 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol,
>  	if (err < 0)
>  		goto end;
>  
> -	mute_mask = ucontrol->value.integer.value[0];
> +	regmap_read(mvc->regmap, TEGRA210_MVC_CTRL, &value);
> +
> +	old_mask = (value >> TEGRA210_MVC_MUTE_SHIFT) & TEGRA210_MUTE_MASK_EN;
> +	new_mask = ucontrol->value.integer.value[0];
> +
> +	if (new_mask == old_mask) {
> +		err = 0;
> +		goto end;
> +	}
>  
>  	err = regmap_update_bits(mvc->regmap, mc->reg,
>  				 TEGRA210_MVC_MUTE_MASK,
> -				 mute_mask << TEGRA210_MVC_MUTE_SHIFT);
> +				 new_mask << TEGRA210_MVC_MUTE_SHIFT);

I guess this test-and-update procedure can be simplified with
regmap_update_bits_check().


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ