Re: [PATCH v8 1/4] ASoc: PCM6240: Create PCM6240 Family driver code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux