Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3841725pxb; Mon, 21 Feb 2022 06:49:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTSJdPgIl8zl87htkFeCoiResAJIJO3DBOVyNMD0Xa38cmD69WWwHBZjAAb0Q1o/nqBvDW X-Received: by 2002:a62:63c2:0:b0:4e1:604:f07 with SMTP id x185-20020a6263c2000000b004e106040f07mr20258268pfb.56.1645454964197; Mon, 21 Feb 2022 06:49:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645454964; cv=none; d=google.com; s=arc-20160816; b=XEngMxvBKm3HUMhjO2wLwCkMCPWDBc/YgCPPLgTEWb/9Sohlag4dXQJD0yTY7woxd4 3LuzFKbHoK9k7ilGSXzoeosimQiwnmH8xAtHeQez0mx1bKshLSyz08EeN1/LLVn29PgU 4+JerT4I1zuXaG3jHNUylIQsL02C8lWHRUR4la1k/ROvabuMlP6ltb+apzO0oaZTMcHb MkA94xGUpXd70aNWSvO05z2vTp+vukpdDA5pXq2xsGZjr5G7UNXYkPG0YWrpIpt+pvbN UMHFUDTmLXKVD8JMC5E5FC7KfZzjk0/2+xT7y52pHHZMFRB2xUAI8zqWwuXmQLNr0tiJ 9b6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s+OaAgLVmOcTsQAGOMoixDQJrKaqYus2hJFKrXHY6bM=; b=T7QrGrYc1qKOh6JurOXMCgS0ZZeqoqrAu5GR9G0UCJm+pbnftgOfxDUiU7EOcb27Uc T6U4jb7lEm9Ru4JwJMWfGqzkLTmTRrjxE663pct7HgsShc+T1GrOn63bPVlaDfg5fh+X NHrUxBClr82wmNqEdlFQeemTD7pk3HKeSuqL63gPKmh6xpdNrXJ3M6Y9Q1sUL1ViIOe4 ZVlueg26vNYLh9kByBsOfZ1LAkQbyvsgV96Fz9rJaNi3rlypcgadPppKRfd79jtc2eA7 DYS5sdoUhcd5iXdk1St+E77b+C3yza/pV1dvJsj/OOIXU4ZMqi7r1Tky8M1O7l6G/H1K yYuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=biajW6tD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mz7-20020a17090b378700b001bafa897aa4si6485019pjb.85.2022.02.21.06.49.08; Mon, 21 Feb 2022 06:49:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=biajW6tD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349203AbiBUJMK (ORCPT + 99 others); Mon, 21 Feb 2022 04:12:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347625AbiBUJIi (ORCPT ); Mon, 21 Feb 2022 04:08:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF9D245AF; Mon, 21 Feb 2022 01:00:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD2196112C; Mon, 21 Feb 2022 09:00:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A28B8C340E9; Mon, 21 Feb 2022 09:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434024; bh=+K0VwmMexA2L3+pqCHBDD2Xt8G4WfkwYOqLZIN+59Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biajW6tDtXnKwLdn3dKoLMeLc3ZA5dB2HtONnLa3qxKk3sf9gwk0ZCOjTI8R6yUsU Bd9mjwxoYdo+T4gB5FYG3zaN4CxWFuSBxZAkMrtNy6FywIDCwFuwA/QFjBGNZm50sz tnc6hK7f185GHy6u8wuMw49DlfrUU6BV836KiG9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown Subject: [PATCH 5.4 49/80] ASoC: ops: Fix stereo change notifications in snd_soc_put_volsw_range() Date: Mon, 21 Feb 2022 09:49:29 +0100 Message-Id: <20220221084917.183135042@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084915.554151737@linuxfoundation.org> References: <20220221084915.554151737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown commit 650204ded3703b5817bd4b6a77fa47d333c4f902 upstream. When writing out a stereo control we discard the change notification from the first channel, meaning that events are only generated based on changes to the second channel. Ensure that we report a change if either channel has changed. Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220201155629.120510-4-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-ops.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -523,7 +523,7 @@ int snd_soc_put_volsw_range(struct snd_k unsigned int mask = (1 << fls(max)) - 1; unsigned int invert = mc->invert; unsigned int val, val_mask; - int ret; + int err, ret; if (invert) val = (max - ucontrol->value.integer.value[0]) & mask; @@ -532,9 +532,10 @@ int snd_soc_put_volsw_range(struct snd_k val_mask = mask << shift; val = val << shift; - ret = snd_soc_component_update_bits(component, reg, val_mask, val); - if (ret < 0) - return ret; + err = snd_soc_component_update_bits(component, reg, val_mask, val); + if (err < 0) + return err; + ret = err; if (snd_soc_volsw_is_stereo(mc)) { if (invert) @@ -544,8 +545,12 @@ int snd_soc_put_volsw_range(struct snd_k val_mask = mask << shift; val = val << shift; - ret = snd_soc_component_update_bits(component, rreg, val_mask, + err = snd_soc_component_update_bits(component, rreg, val_mask, val); + /* Don't discard any error code or drop change flag */ + if (ret == 0 || err < 0) { + ret = err; + } } return ret;