27 Jan
2020
27 Jan
'20
10:45 a.m.
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, ®_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