Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2288895pxp; Mon, 21 Mar 2022 16:00:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPD2cOso2zAwtvA7PBjIcUDoZnA1dGoccxs8fSAUmlMxrkmBRunj39ih82c9q4tp0T8PoQ X-Received: by 2002:a17:902:e54f:b0:154:1b5d:1ac7 with SMTP id n15-20020a170902e54f00b001541b5d1ac7mr15351167plf.60.1647903643101; Mon, 21 Mar 2022 16:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647903643; cv=none; d=google.com; s=arc-20160816; b=rHTv1Yr8vivYi7dTtvBZj/NlxjE1L+YgdN1THMhia/8AeWAY8z29es726GC4ir33So VR+tZIDna+IzxU3tulb/OWLe0LLkCI+ZHfeHgL2KphBe53jVe3bxHY+7elLAlXrsDnU0 FVEdbkM+IHqyfruBIWvYk7lWf43deSdOnZ4psCaivv52Mhv6vscUduIZFIC3X8a49gJX TwtTTqTRXaJY7WdjzRTPeF0C0wHp4MgNIY3+beOuXRD34tBRtPDBNKrPq/Yd9bZgsK8y EP58LUp2yhRhiKJ+T6YEjcqqWnyZKBOnTUU0X8PA6Fo2B/p6sI+LDABnxOKAwhYv+DfR fAEw== 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=80SgjNPocpjxjEVBYxOuGi6or8/ka9UszwVWcjcfp1E=; b=zu/S0hsOOu4Lyz4YsQlxLdEItznVCIxkXjKo2870crQ90HyhQv01afvlSBYQQ9h9ts 0cgw7K4o+l4NSCww3OyGm5ju6YLj79o+usnWSwUTgMXxJoahbWXztroZWNXQKl/aztFE TvrAMTTxa+jCnRmyrE1vqQXVeax3hiuZ5qU4FluhY3LcBJc3SeOPSX50oQl5WwnDuCuz iGrUN9/vkc62OspcHJvq7IjdPGVRAI0sGNGVVAqITZ4w/O/hsTAnhzGSEj7FqSFm0LPE 5uo2CDSzUIYRKQUSk9n+dd9vywkqXyZnPyYHMq9cNhE/KV7kiYmOyFIuhMUGzxm0WpfV 4mRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q38-20020a63f966000000b003816043f03csi14443401pgk.561.2022.03.21.16.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:00:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62F6A3E06D0; Mon, 21 Mar 2022 14:59:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344657AbiCUG7u (ORCPT + 99 others); Mon, 21 Mar 2022 02:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234445AbiCUG7p (ORCPT ); Mon, 21 Mar 2022 02:59:45 -0400 Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B78A83F8AB for ; Sun, 20 Mar 2022 23:58:16 -0700 (PDT) X-QQ-mid: bizesmtp82t1647845884t804rf5r Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 21 Mar 2022 14:57:57 +0800 (CST) X-QQ-SSF: 01400000002000D0I000000A0000000 X-QQ-FEAT: geCjBjpTnm5MCuhbl7WYFcVXtSlLYe9nC1Ht/79OMySzfSxUeFWMlEVlP+knM OezqIH5y7A/rfELeaajZVCAAx4GrtoyySSDJmz7ddbkXeiUfWifuSxk/Bi9creqz6xIm/Jm Uu2MMJxb28nTNTn8X70dH7T5IYaZk9lBtgzED1Ka/XyEVb6eqQN4t7L914gqT01Yzk7hw6r S42MAr0xF076OqnTq2umNB9bzMI1NIMvSfWdJKMDjmiBsRMEX2aW1VC38gydlWoIJsYmYQF 6CJjxuUTdWSnPaojt+XOZgN7dpg0tmUTH+g0KM/fHg9zn9nAyVwFJkrsz/DshH06pVsMVOZ 8lJ+UsPbx8dPh1DVoEcN2sD3aXON/Z9fhYrV5we 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 v2] ASoC: fsl-asoc-card: Fix jack_event() always return 0 Date: Mon, 21 Mar 2022 14:57:54 +0800 Message-Id: <20220321065754.18307-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:qybgforeign8 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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. Signed-off-by: Meng Tang --- sound/soc/fsl/fsl-asoc-card.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 370bc790c6ba..d9a0d4768c4d 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -462,11 +462,9 @@ static int hp_jack_event(struct notifier_block *nb, unsigned long event, if (event & SND_JACK_HEADPHONE) /* Disable speaker if headphone is plugged in */ - snd_soc_dapm_disable_pin(dapm, "Ext Spk"); + return snd_soc_dapm_disable_pin(dapm, "Ext Spk"); else - snd_soc_dapm_enable_pin(dapm, "Ext Spk"); - - return 0; + return snd_soc_dapm_enable_pin(dapm, "Ext Spk"); } static struct notifier_block hp_jack_nb = { @@ -481,11 +479,9 @@ static int mic_jack_event(struct notifier_block *nb, unsigned long event, if (event & SND_JACK_MICROPHONE) /* Disable dmic if microphone is plugged in */ - snd_soc_dapm_disable_pin(dapm, "DMIC"); + return snd_soc_dapm_disable_pin(dapm, "DMIC"); else - snd_soc_dapm_enable_pin(dapm, "DMIC"); - - return 0; + return snd_soc_dapm_enable_pin(dapm, "DMIC"); } static struct notifier_block mic_jack_nb = { -- 2.20.1