Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2118921pxp; Fri, 18 Mar 2022 03:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwO71eeKVWkdWVikdqXSNU/DYeSIp6sAY1dy71p4IdEPoMNuxIDehn0VXCjDosgch5APiF X-Received: by 2002:a17:902:e5c9:b0:154:16a2:e61d with SMTP id u9-20020a170902e5c900b0015416a2e61dmr1300254plf.34.1647600515515; Fri, 18 Mar 2022 03:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647600515; cv=none; d=google.com; s=arc-20160816; b=IFLcwR8xXNmkiKMu2mbuS1XrCGBgG5iVnxqha3RThiYodhX6hrdTdpvSE7aCZQcer9 oOqg0PUeFDaZqU373DIt9RnZu9NTA9jMTUHnvoANB/y2RDb333jIizelys/bYyhEeNrH Ywibpj1N5uBZ1xo7XyyI+1wNO82pO9OdqRF8W7i8BVCB6UMEsod758UEccuTxnoCheG+ 4VxqK90OsuH8oQtWZ67wR4ipFOimcqYuplOk7V8dF1QHZDinNydhY8hqb0CDIBsiJCBp hXnIZ4Gq1AEQR8gyxS/ELpbnTrhGpZjO9/Uk/EbVGVni5r19qI9+dZUtOweQ5ZvgpZUC 5pOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=xUi+tAyMTSN/4H30DP3xVbd8mPmU4IaPkckT/mpc/6w=; b=Quv9h70Olg6g0shZqv+M7MN4ix2/DlEGeqiwBRrZRz+p2DsJRY4HZR6d5FRDKx6Vyi WvY4Ru5bd675TRiQGbKwQl6xsHhRnsyBLWQ+/hxbFDXcRWUWuhF3eEb9rwGPZAIiu2aS 5fSoOEINVDdWqweVjscAhBr8QwD/Bc1ehme/etqpZpPT2oY5xDAa72iSOuinUq9Q8gMT WKektbLhDp7lrEFXX3VB51FYEdEDNajFbQ8AkXyCpH4WFK2Jt/9rCxTcA0xABIDTUCzP YO3EZXWd5HUKN6fUO2b1NslCxPCgyo3HfhEZfNKkH0mF5zb9GkF0R6tWR15xirBT6uYM BjLw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k127-20020a628485000000b004fa201a62f4si7066035pfd.208.2022.03.18.03.48.22; Fri, 18 Mar 2022 03:48:35 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbiCRJhN (ORCPT + 99 others); Fri, 18 Mar 2022 05:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbiCRJhL (ORCPT ); Fri, 18 Mar 2022 05:37:11 -0400 Received: from smtpproxy21.qq.com (smtpbg701.qq.com [203.205.195.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A842EA921 for ; Fri, 18 Mar 2022 02:35:52 -0700 (PDT) X-QQ-mid: bizesmtp86t1647596144tkbrhvl5 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 18 Mar 2022 17:35:38 +0800 (CST) X-QQ-SSF: 01400000002000D0I000000A0000000 X-QQ-FEAT: 1vYwxPNStGlVdhmjjLS+53k4INM9GjyQdIqJJMrCR+pb1LYHnR4/aqzBpqnWV ueiDrL0E4KPMqka9Lw7vwy/XCn///iYN9ih43KoU1HwOdjHxGQIEN6LgBHLEH0JECrFK3RL dGoMa4fMbFbetSbqw9V3WYJ9vtrhXmaYvIT6xqaTpLjUrsNCQhdzovFEa9Am1JbwsavFN3I 833ohGKSAeYcDIcL0P5znSvBEEv2dCuaM2FoXncuRXVRlhkz3VGYI4LgjDsC9HsX3BmImBq YmeEnOeyGTxMf8Tpa7w+ainnytBx8VUOd0FhSPjKdSY4LLosOXXR89lldHfzWvtuCgakdck KYQKGSYEzaMKyeG99h+MoSuQOYqVPN6f04H7YKy7alSwSm1HKk= X-QQ-GoodBg: 1 From: Meng Tang To: nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, shengjiu.wang@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Meng Tang Subject: [PATCH] ASoC: fsl-asoc-card: Fix jack_event() always return 0 Date: Fri, 18 Mar 2022 17:35:36 +0800 Message-Id: <20220318093536.15385-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 Today, hp_jack_event and mic_jack_event always return 0. However, snd_soc_dapm_disable_pin and snd_soc_dapm_enable_pin may return a non-zero value, this will cause the user who calling hp_jack_event and mic_jack_event don't know whether the operation was really successfully. This patch corrects the behavior by properly returning 1 when the value gets updated. Signed-off-by: Meng Tang --- sound/soc/fsl/fsl-asoc-card.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 370bc790c6ba..f2641c2cb047 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -457,16 +457,18 @@ static int fsl_asoc_card_audmux_init(struct device_node *np, static int hp_jack_event(struct notifier_block *nb, unsigned long event, void *data) { + int ret; + struct snd_soc_jack *jack = (struct snd_soc_jack *)data; struct snd_soc_dapm_context *dapm = &jack->card->dapm; if (event & SND_JACK_HEADPHONE) /* Disable speaker if headphone is plugged in */ - snd_soc_dapm_disable_pin(dapm, "Ext Spk"); + ret = snd_soc_dapm_disable_pin(dapm, "Ext Spk"); else - snd_soc_dapm_enable_pin(dapm, "Ext Spk"); + ret = snd_soc_dapm_enable_pin(dapm, "Ext Spk"); - return 0; + return ret; } static struct notifier_block hp_jack_nb = { @@ -476,16 +478,18 @@ static struct notifier_block hp_jack_nb = { static int mic_jack_event(struct notifier_block *nb, unsigned long event, void *data) { + int ret; + struct snd_soc_jack *jack = (struct snd_soc_jack *)data; struct snd_soc_dapm_context *dapm = &jack->card->dapm; if (event & SND_JACK_MICROPHONE) /* Disable dmic if microphone is plugged in */ - snd_soc_dapm_disable_pin(dapm, "DMIC"); + ret = snd_soc_dapm_disable_pin(dapm, "DMIC"); else - snd_soc_dapm_enable_pin(dapm, "DMIC"); + ret = snd_soc_dapm_enable_pin(dapm, "DMIC"); - return 0; + return ret; } static struct notifier_block mic_jack_nb = { -- 2.20.1