ASoC: codecs: Modify the transmission method of parameters

Change the transmission mode of the "aw88395_dev_get_prof_name"
function parameter, Instead of using return values for data
transfer, parameters are used

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230928105727.47273-6-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Weidong Wang 2023-09-28 18:57:22 +08:00 committed by Mark Brown
parent 74ff4f22d8
commit e83219c94a
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
3 changed files with 13 additions and 10 deletions

View file

@ -175,9 +175,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol,
{
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
const char *prof_name;
char *name;
int count;
char *prof_name, *name;
int count, ret;
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
@ -196,8 +195,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol,
name = uinfo->value.enumerated.name;
count = uinfo->value.enumerated.item;
prof_name = aw88395_dev_get_prof_name(aw88395->aw_pa, count);
if (!prof_name) {
ret = aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name);
if (ret) {
strscpy(uinfo->value.enumerated.name, "null",
strlen("null") + 1);
return 0;

View file

@ -1296,7 +1296,9 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc
return -EPERM;
}
prof_name = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index);
ret = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name);
if (ret)
return ret;
dev_dbg(aw_dev->dev, "start update %s", prof_name);
@ -1644,7 +1646,7 @@ int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index)
}
EXPORT_SYMBOL_GPL(aw88395_dev_set_profile_index);
char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index)
int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name)
{
struct aw_prof_info *prof_info = &aw_dev->prof_info;
struct aw_prof_desc *prof_desc;
@ -1652,12 +1654,14 @@ char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index)
if ((index >= aw_dev->prof_info.count) || (index < 0)) {
dev_err(aw_dev->dev, "index[%d] overflow count[%d]",
index, aw_dev->prof_info.count);
return NULL;
return -EINVAL;
}
prof_desc = &aw_dev->prof_info.prof_desc[index];
return prof_info->prof_name_list[prof_desc->id];
*prof_name = prof_info->prof_name_list[prof_desc->id];
return 0;
}
EXPORT_SYMBOL_GPL(aw88395_dev_get_prof_name);

View file

@ -181,7 +181,7 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc
void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_vol);
int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index,
struct aw_prof_desc **prof_desc);
char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index);
int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name);
int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index);
int aw88395_dev_get_profile_index(struct aw_device *aw_dev);
int aw88395_dev_get_profile_count(struct aw_device *aw_dev);