lkml.org 
[lkml]   [2014]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] staging: panel: (coding style) Matching braces
Hi Dominique,

On Wed, May 21, 2014 at 02:09:59PM +0200, Dominique van den Broeck wrote:
> Style-only modifications to comply with checkpatch.pl --strict --file.
> . Adds every missing brace in condition statements.
>
> Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
> ---
> Apply on linux-next tree, above:
> commit 4151fa6adc65da14673ece623bbb2acc6936f8be
> "Add linux-next specific files for 20140516"
>
> diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
> index 136671a..1ac5e25 100644
> --- a/drivers/staging/panel/panel.c
> +++ b/drivers/staging/panel/panel.c
> @@ -711,10 +711,9 @@ static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val)
> /* sleeps that many milliseconds with a reschedule */
> static void long_sleep(int ms)
> {
> -
> - if (in_interrupt())
> + if (in_interrupt()) {
> mdelay(ms);
> - else {
> + } else {

I don't want to be nit-picking, but since we're talking about style...
for me these "} else {" statements are harder to parse than having them
on two lines this way :

}
else {

That's especially more true with "else if" as below :

} else if (*esc >= 'A' && *esc <= 'Z') {
value |= (*esc - 'A' + 10) << shift;
} else if (*esc >= 'a' && *esc <= 'z') {
value |= (*esc - 'a' + 10) << shift;
} else {

I believe that most of the kernel code prefers the two-line format resluting
in this instead :

}
else if (*esc >= 'A' && *esc <= 'Z') {
value |= (*esc - 'A' + 10) << shift;
}
else if (*esc >= 'a' && *esc <= 'z') {
value |= (*esc - 'a' + 10) << shift;
}
else {

It's just a matter of taste I know, but for me they read easier, probably
because the braces do not affect alignment and the lines appear exactly
similar with or without the braces.

Thanks,
Willy



\
 
 \ /
  Last update: 2014-05-26 17:01    [W:0.082 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site