Re: [PATCH 2/4] ASoC: rt5659: cancel jack_detect_work on component remove
From: Mark Brown
Date: Mon Oct 26 2026 - 15:17:18 EST
> Track successful IRQ acquisition with a flag so that disable_irq()
> only quiesces a line this driver actually owns. On component remove,
> disable the IRQ to synchronize with any running handler and prevent
> new enqueues, then drain the residual jack_detect_work synchronously
> before resetting the hardware. On the next component probe (card
> rebind), re-enable the IRQ to restore jack detection.
> @@ -3684,7 +3690,14 @@ static int rt5659_probe(struct snd_soc_component *component)
> static void rt5659_remove(struct snd_soc_component *component)
> {
> struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
> + struct i2c_client *i2c = to_i2c_client(component->dev);
> +
> + if (rt5659->irq_acquired) {
> + disable_irq(i2c->irq);
> + rt5659->irq_disabled = true;
> + }
>
> + cancel_delayed_work_sync(&rt5659->jack_detect_work);
This work isn't unconditionally initialised, cancelling something that
wasn't initialised is an error and will trigger warnings. Either this
needs to be conditional or we should just always initialise.
--
Mark Brown <broonie@xxxxxxxxxx>