Re: [PATCH v4 3/6] ASoC: tas2781: Add tas2781 driver

From: Christophe JAILLET
Date: Sun May 28 2023 - 04:05:16 EST


Le 28/05/2023 à 00:35, Shenghao Ding a écrit :
Create tas2781 driver.

Signed-off-by: Shenghao Ding <13916275206-7R9yAhoRP9E@xxxxxxxxxxxxxxxx>

---
Changes in v4:
- fixed issue| Reported-by: kernel test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@xxxxxxxxxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305192322.gBZ4JIyr-lkp-ral2JQCrhuEAvxtiuMwx3w@xxxxxxxxxxxxxxxx/
Changes to be committed:
modified: sound/soc/codecs/Kconfig
modified: sound/soc/codecs/Makefile
new file: sound/soc/codecs/tas2781-comlib.c
new file: sound/soc/codecs/tas2781-i2c.c
---
sound/soc/codecs/Kconfig | 25 +
sound/soc/codecs/Makefile | 6 +
sound/soc/codecs/tas2781-comlib.c | 581 +++++++++++++++++++++++
sound/soc/codecs/tas2781-i2c.c | 736 ++++++++++++++++++++++++++++++
4 files changed, 1348 insertions(+)
create mode 100644 sound/soc/codecs/tas2781-comlib.c
create mode 100644 sound/soc/codecs/tas2781-i2c.c

[...]

+static void tasdev_dsp_prog_blk_remove(struct tasdevice_prog *prog)
+{
+ struct tasdevice_data *im;
+ struct tasdev_blk *blk;
+ unsigned int nr_blk;

Purely a mater of style, but 'i' is more common, and less verbose.
(same in tasdev_dsp_cfg_blk_remove() below)

+
+ if (!prog)
+ return;
+
+ im = &(prog->dev_data);
+
+ if (!im->dev_blks)
+ return;
+
+ for (nr_blk = 0; nr_blk < im->nr_blk; nr_blk++) {
+ blk = &(im->dev_blks[nr_blk]);
+ kfree(blk->data);
+ }
+ kfree(im->dev_blks);
+}

[...]

+static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+ struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
+ int ret = 0;
+
+ if (tas_priv->rcabin.profile_cfg_id !=
+ ucontrol->value.integer.value[0]) {
+ tas_priv->rcabin.profile_cfg_id =
+ ucontrol->value.integer.value[0];
+ ret = 0;

So 'ret' is always 0?
Is it what is expected?
If so, removing 'ret' and having return 0; below, looks fine.

Stop reading here. There seems to be a mix-up with patch 4/6.

CJ