ASoC: wm_adsp: Use cs_dsp_coeff_lock_and_[read|write]_ctrl()
Using the cs_dsp_coeff_lock_and_[read|write]_ctrl() wrappers tidies the calling functions as it does not need to manage the DSP pwr_lock. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://msgid.link/r/20240325113127.112783-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4d0333798e
commit
3802a9969b
@ -403,13 +403,8 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,
|
|||||||
struct wm_coeff_ctl *ctl = bytes_ext_to_ctl(bytes_ext);
|
struct wm_coeff_ctl *ctl = bytes_ext_to_ctl(bytes_ext);
|
||||||
struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
|
struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
|
||||||
char *p = ucontrol->value.bytes.data;
|
char *p = ucontrol->value.bytes.data;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
mutex_lock(&cs_ctl->dsp->pwr_lock);
|
return cs_dsp_coeff_lock_and_write_ctrl(cs_ctl, 0, p, cs_ctl->len);
|
||||||
ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, p, cs_ctl->len);
|
|
||||||
mutex_unlock(&cs_ctl->dsp->pwr_lock);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
|
static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
|
||||||
@ -426,13 +421,11 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
|
|||||||
if (!scratch)
|
if (!scratch)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (copy_from_user(scratch, bytes, size)) {
|
if (copy_from_user(scratch, bytes, size))
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
} else {
|
else
|
||||||
mutex_lock(&cs_ctl->dsp->pwr_lock);
|
ret = cs_dsp_coeff_lock_and_write_ctrl(cs_ctl, 0, scratch, size);
|
||||||
ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, scratch, size);
|
|
||||||
mutex_unlock(&cs_ctl->dsp->pwr_lock);
|
|
||||||
}
|
|
||||||
vfree(scratch);
|
vfree(scratch);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -474,13 +467,8 @@ static int wm_coeff_get(struct snd_kcontrol *kctl,
|
|||||||
struct wm_coeff_ctl *ctl = bytes_ext_to_ctl(bytes_ext);
|
struct wm_coeff_ctl *ctl = bytes_ext_to_ctl(bytes_ext);
|
||||||
struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
|
struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
|
||||||
char *p = ucontrol->value.bytes.data;
|
char *p = ucontrol->value.bytes.data;
|
||||||
int ret;
|
|
||||||
|
|
||||||
mutex_lock(&cs_ctl->dsp->pwr_lock);
|
return cs_dsp_coeff_lock_and_read_ctrl(cs_ctl, 0, p, cs_ctl->len);
|
||||||
ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, p, cs_ctl->len);
|
|
||||||
mutex_unlock(&cs_ctl->dsp->pwr_lock);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,
|
static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,
|
||||||
|
Loading…
Reference in New Issue
Block a user