mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
ASoC: samsung: odroid: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260423125646.156599-4-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a54f20fe88
commit
1d4dfb2755
|
|
@ -36,15 +36,12 @@ static int odroid_card_fe_hw_params(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
|
||||
struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
guard(spinlock_irqsave)(&priv->lock);
|
||||
if (priv->be_active && priv->be_sample_rate != params_rate(params))
|
||||
ret = -EINVAL;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
return -EINVAL;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_ops odroid_card_fe_ops = {
|
||||
|
|
@ -58,7 +55,6 @@ static int odroid_card_be_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
|
||||
struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
||||
unsigned int pll_freq, rclk_freq, rfs;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
switch (params_rate(params)) {
|
||||
|
|
@ -105,10 +101,8 @@ static int odroid_card_be_hw_params(struct snd_pcm_substream *substream,
|
|||
return ret;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
priv->be_sample_rate = params_rate(params);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
scoped_guard(spinlock_irqsave, &priv->lock)
|
||||
priv->be_sample_rate = params_rate(params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -116,9 +110,8 @@ static int odroid_card_be_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
|
||||
struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
guard(spinlock_irqsave)(&priv->lock);
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
|
|
@ -134,8 +127,6 @@ static int odroid_card_be_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
break;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user