Commit 39a594dc authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

ASoC: cs35l56: Remove quick-cancelling of dsp_work()

Delete the 'removing' flag and don't kick init_completion to make a
quick cancel of dsp_work(). Just let it timeout on the wait for the
completion.

Simplify the code to standard cancelling or flushing of the work.
This avoids introducing corner cases from a layer of custom signalling.
It also avoids potential race conditions when system-suspend handling
is added.

Unless the hardware is broken, the dsp_work() will already have started
and passed the completion before the driver would want to cancel it.
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168122674746.26.16881587647873355224@mailman-core.alsa-project.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f9dc6b87
...@@ -875,7 +875,7 @@ static void cs35l56_dsp_work(struct work_struct *work) ...@@ -875,7 +875,7 @@ static void cs35l56_dsp_work(struct work_struct *work)
goto complete; goto complete;
} }
if (!cs35l56->init_done || cs35l56->removing) if (!cs35l56->init_done)
goto complete; goto complete;
cs35l56->dsp.part = devm_kasprintf(cs35l56->dev, GFP_KERNEL, "cs35l56%s-%02x", cs35l56->dsp.part = devm_kasprintf(cs35l56->dev, GFP_KERNEL, "cs35l56%s-%02x",
...@@ -925,9 +925,6 @@ static void cs35l56_dsp_work(struct work_struct *work) ...@@ -925,9 +925,6 @@ static void cs35l56_dsp_work(struct work_struct *work)
goto err; goto err;
} }
if (cs35l56->removing)
goto err;
mutex_lock(&cs35l56->irq_lock); mutex_lock(&cs35l56->irq_lock);
init_completion(&cs35l56->init_completion); init_completion(&cs35l56->init_completion);
...@@ -975,7 +972,6 @@ static int cs35l56_component_probe(struct snd_soc_component *component) ...@@ -975,7 +972,6 @@ static int cs35l56_component_probe(struct snd_soc_component *component)
BUILD_BUG_ON(ARRAY_SIZE(cs35l56_tx_input_texts) != ARRAY_SIZE(cs35l56_tx_input_values)); BUILD_BUG_ON(ARRAY_SIZE(cs35l56_tx_input_texts) != ARRAY_SIZE(cs35l56_tx_input_values));
cs35l56->removing = false;
cs35l56->component = component; cs35l56->component = component;
wm_adsp2_component_probe(&cs35l56->dsp, component); wm_adsp2_component_probe(&cs35l56->dsp, component);
...@@ -992,8 +988,6 @@ static void cs35l56_component_remove(struct snd_soc_component *component) ...@@ -992,8 +988,6 @@ static void cs35l56_component_remove(struct snd_soc_component *component)
{ {
struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
cs35l56->removing = true;
complete(&cs35l56->init_completion);
cancel_work_sync(&cs35l56->dsp_work); cancel_work_sync(&cs35l56->dsp_work);
} }
......
...@@ -49,7 +49,6 @@ struct cs35l56_private { ...@@ -49,7 +49,6 @@ struct cs35l56_private {
bool soft_resetting; bool soft_resetting;
bool init_done; bool init_done;
bool sdw_attached; bool sdw_attached;
bool removing;
bool fw_patched; bool fw_patched;
bool can_hibernate; bool can_hibernate;
struct completion init_completion; struct completion init_completion;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment