Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E063FCA0EC3 for ; Tue, 12 Sep 2023 11:36:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E5126EEB; Tue, 12 Sep 2023 13:35:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E5126EEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1694518591; bh=W+ZoDz3IVISlr8l4dEX1tQJJy20XDM5riBwBaLAy7KI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FmaT9y3njjkors59V52VcWPIJuLMq37LwfNWmdJLMy7s6LJAw3u0t3ToBaPby/XDy ZdLJteo0hIhSHlAODgnY6GDa5+lcSh6pFimpx1cc6phmMzB112uh+6PTPsUNHjpfia /H9VrXrh+sLquMjDnbz5IoI0krrJjTWaKSrk4fg0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C4B3F80568; Tue, 12 Sep 2023 13:35:34 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 34CBCF80567; Tue, 12 Sep 2023 13:35:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 41EE6F80425; Tue, 12 Sep 2023 13:35:30 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9A0BAF80537 for ; Tue, 12 Sep 2023 13:33:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9A0BAF80537 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZcBHjplw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694518389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wziPrUTQEZ53r7QLkQqii7GVp1XqsmQR7RJXjoCnR8I=; b=ZcBHjplwGhHKeEYXI7GcxoWZB3CFDQ/RqDkMC1hCx1Q+KgYNtewK5bRPd9aZy73HLKMGvS pRD2N/usOQ/KzK9ZjLsGzU17oR4dAmwOvqzjAtz+iqoDbVdLYrh9ZOvWVuCfaAaPFS9/9L h0ENm1OGwnvhfMBg+IeR43nRvWu418A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-TB-xh3yLM16MJkfKUay23A-1; Tue, 12 Sep 2023 07:33:04 -0400 X-MC-Unique: TB-xh3yLM16MJkfKUay23A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 33CB929AB3E3; Tue, 12 Sep 2023 11:33:04 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18FE82026D4B; Tue, 12 Sep 2023 11:33:02 +0000 (UTC) From: Hans de Goede To: Oder Chiou , Liam Girdwood , Mark Brown Cc: Hans de Goede , Sameer Pujar , Cezary Rojewski , Pierre-Louis Bossart , alsa-devel@alsa-project.org Subject: [PATCH 6/6] ASoC: rt5640: Only cancel jack-detect work on suspend if active Date: Tue, 12 Sep 2023 13:32:45 +0200 Message-ID: <20230912113245.320159-7-hdegoede@redhat.com> In-Reply-To: <20230912113245.320159-1-hdegoede@redhat.com> References: <20230912113245.320159-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: CQNEOO7G2RF4W5LJ4QUTWCBX3MPHQIJS X-Message-ID-Hash: CQNEOO7G2RF4W5LJ4QUTWCBX3MPHQIJS X-MailFrom: hdegoede@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If jack-detection is not used; or has already been disabled then there is no need to call rt5640_cancel_work(). Move the rt5640_cancel_work() inside the "if (rt5640->jack) {}" block, grouping it together with the disabling of the IRQ which queues the work in the first place. This also makes suspend() symetrical with resume() which re-queues the work in an "if (rt5640->jack) {}" block. Cc: Oder Chiou Signed-off-by: Hans de Goede --- sound/soc/codecs/rt5640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index a4a11407ab10..e8cdc166bdaa 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2801,9 +2801,9 @@ static int rt5640_suspend(struct snd_soc_component *component) if (rt5640->jack) { /* disable jack interrupts during system suspend */ disable_irq(rt5640->irq); + rt5640_cancel_work(rt5640); } - rt5640_cancel_work(rt5640); snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); rt5640_reset(component); regcache_cache_only(rt5640->regmap, true); -- 2.41.0