--- Begin Message ---
- To: Amadeusz Slawinski <amadeuszx.slawinski@xxxxxxxxxxxxxxx>, Shenghao Ding <13916275206@xxxxxxx>, "broonie@xxxxxxxxxx" <broonie@xxxxxxxxxx>, "lgirdwood@xxxxxxxxx" <lgirdwood@xxxxxxxxx>, "perex@xxxxxxxx" <perex@xxxxxxxx>, "pierre-louis.bossart@xxxxxxxxxxxxxxx" <pierre-louis.bossart@xxxxxxxxxxxxxxx>
- Subject: RE: [EXTERNAL] Re: [PATCH v10] ASoC: tas2781: Add tas2781 driver
- From: "Ding, Shenghao" <shenghao-ding@xxxxxx>
- Date: Fri, 31 Mar 2023 02:19:42 +0000
- Cc: "Lu, Kevin" <kevin-lu@xxxxxx>, "alsa-devel@xxxxxxxxxxxxxxxx" <alsa-devel@xxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "Xu, Baojun" <x1077012@xxxxxx>, "Gupta, Peeyush" <peeyush@xxxxxx>, "Navada Kanyana, Mukund" <navada@xxxxxx>
- In-reply-to: <8d0d0478-1e45-ea52-f1b7-910b747d6282@linux.intel.com>
- References: <20230329100107.8181-1-13916275206@139.com> <8d0d0478-1e45-ea52-f1b7-910b747d6282@linux.intel.com>
Hi Amadeusz Sławiński
Thanks for your comment.
Answer inline.
-----Original Message-----
From: Amadeusz Sławiński <amadeuszx.slawinski@xxxxxxxxxxxxxxx>
Sent: Thursday, March 30, 2023 7:54 PM
To: Shenghao Ding <13916275206@xxxxxxx>; broonie@xxxxxxxxxx; lgirdwood@xxxxxxxxx; perex@xxxxxxxx; pierre-louis.bossart@xxxxxxxxxxxxxxx
Cc: Lu, Kevin <kevin-lu@xxxxxx>; Ding, Shenghao <shenghao-ding@xxxxxx>; alsa-devel@xxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Xu, Baojun <x1077012@xxxxxx>; Gupta, Peeyush <peeyush@xxxxxx>; Navada Kanyana, Mukund <navada@xxxxxx>
Subject: [EXTERNAL] Re: [PATCH v10] ASoC: tas2781: Add tas2781 driver
On 3/29/2023 12:01 PM, Shenghao Ding wrote:
> Create tas2781 driver.
>
> Signed-off-by: Shenghao Ding <13916275206@xxxxxxx>
>
> ---
> Changes in v10:
> - using be16_to_cpu and be32_to_cpu instead of SMS_HTONS and SMS_HTONL
> - optimize and reduce the boundary checks
> - Add comments on some kmemdup instead of kzalloc+memcpy
> Changes to be committed:
> modified: sound/soc/codecs/Kconfig
> modified: sound/soc/codecs/Makefile
> new file: sound/soc/codecs/tas2781-dsp.c
> new file: sound/soc/codecs/tas2781-dsp.h
> new file: sound/soc/codecs/tas2781-i2c.c
> new file: sound/soc/codecs/tas2781.h
> ---
...
> +
> +static int fw_parse_block_data_kernel(struct tasdevice_fw *tas_fmw,
> + struct tasdev_blk *block, const struct firmware *fmw, int offset) {
> + const unsigned char *data = fmw->data;
> +
> + if (offset + 16 > fmw->size) {
> + dev_err(tas_fmw->dev, "%s: File Size error\n", __func__);
> + offset = -EINVAL;
> + goto out;
> + }
> + block->type = be32_to_cpup((__be32 *)&data[offset]);
Wouldn't just be32_to_cpu(data[offset]) work instead of be32_to_cpup?
Same in other cases.
[DING] data[] is a char array, the code will convert data[offset], data[offset + 1],
data[offset + 2] and data[offset + 3] into host instead of data[offset] only.
--- End Message ---