[PATCH] ASoC: Clean up coding style issues in GTA02

pHilipp Zabel philipp.zabel at gmail.com
Fri Apr 3 18:43:37 CEST 2009


On Fri, Apr 3, 2009 at 6:30 PM, Werner Almesberger <werner at openmoko.org> wrote:
> Mark Brown wrote:
>> I think you're reading the patch the wrong way round :)
>
> Am I ? Before:
>
> |        if(val) {
> |                lm4853_state |= LM4853_AMP;
> |        } else {
> |                lm4853_state &= ~LM4853_AMP;
> |        }
>
> after
>
> |        if (val)
> |                lm4853_state |= LM4853_AMP;
> |        else
> |                lm4853_state &= ~LM4853_AMP;
>
> yet line 172 of Documentation/CodingStyle says
>
> | Use braces in both branches.

Context :) Previous sentence, emphasis mine:

| This does not apply if ONE branch of a conditional statement is a single
| statement. Use braces in both branches.

I read this as meaning that if BOTH branches of a conditional
statement are a single statement, not using braces is still preferred.

> I agree with you preferring the style used in your patch, but I
> wonder how to resolve the apparent disagree with CodingStyle.
>
> K&R 2nd ed. also seems to agree with us and even condones braceless
> single-statement else, e.g., on page 125.
>
> - Werner
>
>

regards
Philipp



More information about the openmoko-kernel mailing list