Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Tristan Madani <tristmd@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Bard Liao <bardliao@realtek.com>,
	Misael Lopez Cruz <misael.lopez@ti.com>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH v2 0/4] ASoC: cancel pending delayed works on codec removal
Date: Thu, 29 Oct 2026 21:25:00 +0000	[thread overview]
Message-ID: <20261029212504.2997364-1-tristmd@gmail.com> (raw)

Several ASoC codec drivers schedule delayed works for jack detection but
do not cancel them in the component remove callback.  If the device is
unbound while a work is pending or the IRQ fires shortly before removal,
the work handler can execute after resources are freed.

This series adds cancel_delayed_work_sync() calls in the remove (and
where applicable, probe error) paths of four affected codecs:

  1/4 rt5668 - jack_detect_work not cancelled on remove
  2/4 rt5659 - jack_detect_work not cancelled; INIT_DELAYED_WORK is
               conditional on jd_src, so a guard flag is needed
  3/4 twl6040 - hs_jack.work not cancelled before free_irq
  4/4 wm8994 - multiple delayed works (jackdet_bootstrap, mic_work,
               mic_complete_work, open_circuit_work) not cancelled

Changes in v2:
- Resend as unified series per Mark Brown request (previously sent as
  individual patches with inflated version numbers)
- wm8994: cancel mic_work both before and after jackdet_bootstrap to
  handle cyclic re-arming (mic_work -> DAPM -> jackdet_bootstrap ->
  jack detect -> mic_work)
- rt5659: unchanged from prior version (jack_detect_work_inited flag
  per Mark Brown feedback)

Tristan Madani (4):
  ASoC: rt5668: cancel jack_detect_work on component removal
  ASoC: rt5659: cancel jack_detect_work on component removal
  ASoC: twl6040: cancel headset jack work on component removal
  ASoC: wm8994: drain delayed works on remove and probe error

 sound/soc/codecs/rt5659.c  | 20 +++++++++++++++++++-
 sound/soc/codecs/rt5659.h  |  3 +++
 sound/soc/codecs/rt5668.c  |  2 ++
 sound/soc/codecs/twl6040.c |  1 +
 sound/soc/codecs/wm8994.c  | 14 ++++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

-- 
2.47.3

             reply	other threads:[~2026-10-29 21:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 21:25 Tristan Madani [this message]
2026-10-29 21:25 ` [PATCH v2 1/4] ASoC: rt5668: cancel jack_detect_work on component removal Tristan Madani
2026-10-29 21:46   ` sashiko-bot
2026-10-29 21:25 ` [PATCH v2 2/4] ASoC: rt5659: " Tristan Madani
2026-10-29 21:56   ` sashiko-bot
2026-10-29 21:25 ` [PATCH v2 3/4] ASoC: twl6040: cancel headset jack work " Tristan Madani
2026-10-29 21:59   ` sashiko-bot
2026-10-29 21:25 ` [PATCH v2 4/4] ASoC: wm8994: drain delayed works on remove and probe error Tristan Madani
2026-10-29 22:34 ` [PATCH v2 0/4] ASoC: cancel pending delayed works on codec removal Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261029212504.2997364-1-tristmd@gmail.com \
    --to=tristmd@gmail.com \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=misael.lopez@ti.com \
    --cc=oder_chiou@realtek.com \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox