Re: [alsa-devel] [PATCH 7/9] ASoC: tegra: add Tegra210 based ADMAIF driver

From: Dmitry Osipenko
Date: Thu Jan 23 2020 - 23:25:18 EST


24.01.2020 06:27, Sameer Pujar ÐÐÑÐÑ:
>
>
> On 1/24/2020 6:58 AM, Dmitry Osipenko wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> 20.01.2020 17:23, Sameer Pujar ÐÐÑÐÑ:
>> [snip]
>>> +static bool tegra_admaif_wr_reg(struct device *dev, unsigned int reg)
>>> +{
>>> +ÂÂÂÂ struct tegra_admaif *admaif = dev_get_drvdata(dev);
>>> +ÂÂÂÂ unsigned int ch_stride = TEGRA_ADMAIF_CHANNEL_REG_STRIDE;
>>> +ÂÂÂÂ unsigned int num_ch = admaif->soc_data->num_ch;
>>> +ÂÂÂÂ unsigned int rx_base = admaif->soc_data->rx_base;
>>> +ÂÂÂÂ unsigned int tx_base = admaif->soc_data->tx_base;
>>> +ÂÂÂÂ unsigned int global_base = admaif->soc_data->global_base;
>>> +ÂÂÂÂ unsigned int reg_max =
>>> admaif->soc_data->regmap_conf->max_register;
>>> +ÂÂÂÂ unsigned int rx_max = rx_base + (num_ch * ch_stride);
>>> +ÂÂÂÂ unsigned int tx_max = tx_base + (num_ch * ch_stride);
>>> +
>>> +ÂÂÂÂ if ((reg >= rx_base) && (reg < rx_max)) {
>> The braces are not needed around the comparisons because they precede
>> the AND. Same for all other similar occurrences in the code.
>
> While that is true, some prefer to use explicit braces to make it more
> readable.
> In the past I was told to use explicitly in such cases.

At least most of code in kernel (I've seen) doesn't have superfluous
parens (the curvy thingies actually should be the braces). Readability
is arguable in this case, I'm finding such code a bit more difficult to
read, although in some cases parens and spacing may help to read more
complex constructions.