20 Oct
2020
20 Oct
'20
2:19 p.m.
On Tue, Oct 20, 2020 at 11:04:57AM +0200, Olivier Moysan wrote:
+static int mclk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
+{
- struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
- struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp);
- if (SND_SOC_DAPM_EVENT_ON(event))
return clk_prepare_enable(cs42l51->mclk_handle);
- /* Delay mclk shutdown to fulfill power-down sequence requirements */
- msleep(20);
- clk_disable_unprepare(cs42l51->mclk_handle);
Why not use a switch statement here? The control flow is a bit odd with what's basically an if/else done with only one branch in the if - this isn't idiomatic for DAPM stuff apart from anything else.