Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13368884ybl; Sun, 29 Dec 2019 10:14:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwRGCShRlwZO+zq84vlN6ICHVM0cRejri26/ica55yWdKBmvPfDvoqLyw+1ty04Eh5ulxzM X-Received: by 2002:a9d:588d:: with SMTP id x13mr66047435otg.6.1577643268942; Sun, 29 Dec 2019 10:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643268; cv=none; d=google.com; s=arc-20160816; b=n5R/gULOUA7XJg8kgHT3goDzAWI/FbW1BLfvrSZfAwsHxVwwGNtUAiPfasZK2JUM8C DWc5MqiPv0/rQaEd5j2ifwVPMxBAri3mlENAcPka1SpCgAoQpk6eUrR5FAEIP9lt/D4j 9FRUvHrcpYIa83AC67y3i5JGnwpcTr7qHXGhyY1YEo00IAScdyDodthiZf5ICCJIzrb6 g9v1XlT8Ax43qKYXWle5ty6Iz//0ms2ONBGUXnArpLSPakIcauwZFEXgbwrrulSN+IYT 650OM25l7GtppUo137OCsJkJDrF0BNF4wbGkxU22KhseYcpJnjRdMVIjWSgD56y9WZzB PnuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PwkYYghZRVwzCX9O0IwI/IUAAAfeth02jhpmEqFl27s=; b=WZ3/Ugu80zTjZ2QYT3ZmhMDymuFcNArNNF+kpITLyHpoXgYh6fib1M4wgFPR6iyTu4 M1Pkej+WJHQZKv+08BmZKO40CGSujz9ybwDehreEZ002rvdGEjwiELW4NtWTqjXl+hv2 nNCW+sALtFqDIUraSzlyTQ/TFal56jJAixPKu1US04ojLQ4CXHb0AvCVoAcX/4zIuJXo 6hUH25nwDWyvWHsHsmHXAqG7jM9Cmr4bOp69C67321/TKSnuYNhtyEsLUMH2KJwJ1EB2 TeJE4xRu9TJw/zINIiY3KieelcD7CpKCbFbKxpP3d53znQkqupFyIR98pc6kwLcrqltX mvfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IoE0BInq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si26154131otg.248.2019.12.29.10.14.17; Sun, 29 Dec 2019 10:14:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IoE0BInq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730412AbfL2SNP (ORCPT + 99 others); Sun, 29 Dec 2019 13:13:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:52072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728611AbfL2R2d (ORCPT ); Sun, 29 Dec 2019 12:28:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6632720409; Sun, 29 Dec 2019 17:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640512; bh=LwtmkIgA39GSvV8zVmLxiAG9nBKUFUEetSRTfTnyHRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoE0BInqDPdmxT0O8Lg6IQAYIid3dNbEYG7LiAfrEMAWl0/XcpKb1f1HlFGIx7QN1 SxqAtM1waPPfVw5TbegrIbEbTkST+SAPR7KHqyG7ligkHqsIVWXFYgwKB1oycikiEy Jsi6dSqnLUl5sarOqsxxN1SDPn5ZE0Pp0u2eUiCc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 026/219] ALSA: hda/ca0132 - Fix work handling in delayed HP detection Date: Sun, 29 Dec 2019 18:17:08 +0100 Message-Id: <20191229162512.737476923@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 42fb6b1d41eb5905d77c06cad2e87b70289bdb76 upstream. CA0132 has the delayed HP jack detection code that is invoked from the unsol handler, but it does a few weird things: it contains the cancel of a work inside the work handler, and yet it misses the cancel-sync call at (runtime-)suspend. This patch addresses those issues. Fixes: 15c2b3cc09a3 ("ALSA: hda/ca0132 - Fix possible workqueue stall") Cc: Link: https://lore.kernel.org/r/20191213085111.22855-4-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_ca0132.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -6773,11 +6773,10 @@ static void hp_callback(struct hda_codec /* Delay enabling the HP amp, to let the mic-detection * state machine run. */ - cancel_delayed_work(&spec->unsol_hp_work); - schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); tbl = snd_hda_jack_tbl_get(codec, cb->nid); if (tbl) tbl->block_report = 1; + schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); } static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) @@ -7411,12 +7410,25 @@ static void ca0132_reboot_notify(struct codec->patch_ops.free(codec); } +#ifdef CONFIG_PM +static int ca0132_suspend(struct hda_codec *codec) +{ + struct ca0132_spec *spec = codec->spec; + + cancel_delayed_work_sync(&spec->unsol_hp_work); + return 0; +} +#endif + static const struct hda_codec_ops ca0132_patch_ops = { .build_controls = ca0132_build_controls, .build_pcms = ca0132_build_pcms, .init = ca0132_init, .free = ca0132_free, .unsol_event = snd_hda_jack_unsol_event, +#ifdef CONFIG_PM + .suspend = ca0132_suspend, +#endif .reboot_notify = ca0132_reboot_notify, };