This is a note to let you know that I've just added the patch titled ASoC: DAPM: Cover regression by kctl change notification fix to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 827b0913a9d9d07a0c3e559dbb20ca4d6d285a54 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@xxxxxxx> Date: Fri, 5 Nov 2021 10:09:25 +0100 Subject: ASoC: DAPM: Cover regression by kctl change notification fix From: Takashi Iwai <tiwai@xxxxxxx> commit 827b0913a9d9d07a0c3e559dbb20ca4d6d285a54 upstream. The recent fix for DAPM to correct the kctl change notification by the commit 5af82c81b2c4 ("ASoC: DAPM: Fix missing kctl change notifications") caused other regressions since it changed the behavior of snd_soc_dapm_set_pin() that is called from several API functions. Formerly it returned always 0 for success, but now it returns 0 or 1. This patch addresses it, restoring the old behavior of snd_soc_dapm_set_pin() while keeping the fix in snd_soc_dapm_put_pin_switch(). Fixes: 5af82c81b2c4 ("ASoC: DAPM: Fix missing kctl change notifications") Reported-by: Yu-Hsuan Hsu <yuhsuan@xxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> Link: https://lore.kernel.org/r/20211105090925.20575-1-tiwai@xxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/soc-dapm.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2491,8 +2491,13 @@ static struct snd_soc_dapm_widget *dapm_ return NULL; } -static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, - const char *pin, int status) +/* + * set the DAPM pin status: + * returns 1 when the value has been updated, 0 when unchanged, or a negative + * error code; called from kcontrol put callback + */ +static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, + const char *pin, int status) { struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); int ret = 0; @@ -2518,6 +2523,18 @@ static int snd_soc_dapm_set_pin(struct s return ret; } +/* + * similar as __snd_soc_dapm_set_pin(), but returns 0 when successful; + * called from several API functions below + */ +static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, + const char *pin, int status) +{ + int ret = __snd_soc_dapm_set_pin(dapm, pin, status); + + return ret < 0 ? ret : 0; +} + /** * snd_soc_dapm_sync_unlocked - scan and power dapm paths * @dapm: DAPM context @@ -3445,10 +3462,10 @@ int snd_soc_dapm_put_pin_switch(struct s const char *pin = (const char *)kcontrol->private_value; int ret; - if (ucontrol->value.integer.value[0]) - ret = snd_soc_dapm_enable_pin(&card->dapm, pin); - else - ret = snd_soc_dapm_disable_pin(&card->dapm, pin); + mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); + ret = __snd_soc_dapm_set_pin(&card->dapm, pin, + !!ucontrol->value.integer.value[0]); + mutex_unlock(&card->dapm_mutex); snd_soc_dapm_sync(&card->dapm); return ret; Patches currently in stable-queue which might be from tiwai@xxxxxxx are queue-4.14/input-i8042-add-quirk-for-fujitsu-lifebook-t725.patch queue-4.14/alsa-ua101-fix-division-by-zero-at-probe.patch queue-4.14/alsa-gus-fix-null-pointer-dereference-on-pointer-blo.patch queue-4.14/alsa-hda-reduce-udelay-at-skl-position-reporting.patch queue-4.14/alsa-mixer-fix-deadlock-in-snd_mixer_oss_set_volume.patch queue-4.14/bluetooth-sco-fix-lock_sock-blockage-by-memcpy_from_.patch queue-4.14/alsa-line6-fix-control-and-interrupt-message-timeouts.patch queue-4.14/alsa-timer-unconditionally-unlink-slave-instances-too.patch queue-4.14/alsa-synth-missing-check-for-possible-null-after-the-call-to-kstrdup.patch queue-4.14/alsa-mixer-oss-fix-racy-access-to-slots.patch queue-4.14/alsa-timer-fix-use-after-free-problem.patch queue-4.14/asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch queue-4.14/alsa-6fire-fix-control-and-bulk-message-timeouts.patch