[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dc5dad72-09cc-4001-afdc-1cd92cac312e@sirena.org.uk>
Date: Fri, 5 Apr 2024 15:09:46 +0100
From: Mark Brown <broonie@...nel.org>
To: Shenghao Ding <shenghao-ding@...com>
Cc: linux-kernel@...r.kernel.org, lgirdwood@...il.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
perex@...ex.cz, tiwai@...e.com, 13916275206@....com,
mohit.chawla@...com, soyer@....hu, jkhuang3@...com, tiwai@...e.de,
pdjuandi@...com, manisha.agrawal@...com, aviel@...com,
hnagalla@...com, praneeth@...com, Baojun.Xu@....com
Subject: Re: [PATCH v8 1/4] ASoc: PCM6240: Create PCM6240 Family driver code
On Wed, Apr 03, 2024 at 08:31:55AM +0800, Shenghao Ding wrote:
> +static const char *const pcmdev_ctrl_name[] = {
> + "%s-i2c-%d-dev%d-ch%d-ana-gain",
> + "%s-i2c-%d-dev%d-ch%d-digi-gain",
> + "%s-i2c-%d-dev%d-ch%d-fine-gain",
> +};
> +
> +static const char *const pcmdev_ctrl_name_with_prefix[] = {
> + "%s-dev%d-ch%d-ana-gain",
> + "%s-dev%d-ch%d-digi-gain",
> + "%s-dev%d-ch%d-fine-gain",
> +};
These still don't look like idiomatic ALSA control names, if nothing
else volume controls should end with Volume but the whole all lower case
with -s thing really isn't idiomatic.
> +static int pcmdev_put_volsw(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol, int vol_ctrl_type)
> +{
> + err = pcmdev_dev_update_bits(pcm_dev, dev_no, reg, val_mask, val);
> + if (err) {
> + dev_err(pcm_dev->dev, "%s: update_bits err = %d\n",
> + __func__, err);
> + err = 0;
> + }
Why don't we report errors to users?
> + case PCMDEVICE_CMD_DELAY: {
> + unsigned int delay_time = 0;
> +
> + if (subblk_offset + 2 > sublocksize) {
> + dev_err(pcm_dev->dev,
> + "%s: deley out of boundary\n",
> + __func__);
> + break;
> + }
> + delay_time = get_unaligned_be16(&data[2]) * 1000;
> + usleep_range(delay_time, delay_time + 50);
> + subblk_offset += 2;
> + }
> + break;
> + case PCMDEVICE_CMD_FIELD_W:
> + if (subblk_offset + 6 > sublocksize) {
> + dev_err(pcm_dev->dev,
> + "%s: bit write out of memory\n", __func__);
> + break;
> + }
> + ret = pcmdev_dev_update_bits(pcm_dev, chn,
> + PCMDEVICE_REG(data[subblk_offset + 3],
> + data[subblk_offset + 4]), data[subblk_offset + 1],
> + data[subblk_offset + 5]);
The indentation here is all messed up, things not indented for the case
blocks and so on.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists