[alsa-devel] [PATCH 5/9] ASoC: tegra: add Tegra210 based AHUB driver

Jon Hunter jonathanh at nvidia.com
Mon Jan 27 10:45:38 CET 2020


On 24/01/2020 01:18, Dmitry Osipenko wrote:
> 20.01.2020 17:23, Sameer Pujar пишет:
> [snip]
>> +static int tegra_ahub_get_value_enum(struct snd_kcontrol *kctl,
>> +				     struct snd_ctl_elem_value *uctl)
>> +{
>> +	struct snd_soc_component *cmpnt = snd_soc_dapm_kcontrol_component(kctl);
>> +	struct tegra_ahub *ahub = snd_soc_component_get_drvdata(cmpnt);
>> +	struct soc_enum *e = (struct soc_enum *)kctl->private_value;
>> +	unsigned int reg, i, bit_pos = 0;
>> +
>> +	/*
>> +	 * Find the bit position of current MUX input.
>> +	 * If nothing is set, position would be 0 and it corresponds to 'None'.
>> +	 */
>> +	for (i = 0; i < ahub->soc_data->reg_count; i++) {
>> +		unsigned int reg_val;
>> +
>> +		reg = e->reg + (TEGRA210_XBAR_PART1_RX * i);
>> +		snd_soc_component_read(cmpnt, reg, &reg_val);
>> +		reg_val &= ahub->soc_data->mask[i];
>> +
>> +		if (reg_val) {
>> +			bit_pos = ffs(reg_val) +
>> +				  (8 * cmpnt->val_bytes * i);
> 
> Multiplication takes precedence, braces are not needed. Same for all
> other occurrences in the code.

Personally, I prefer the above as it is explicit and helps readability.

Jon

-- 
nvpublic


More information about the Alsa-devel mailing list