[PATCH 0/5] staging: rts5208: clean up coding style in rtsx_chip.c

From: Giedrius Statkevicius
Date: Fri Oct 03 2014 - 16:27:40 EST


From: Giedrius StatkeviÄius <giedrius.statkevicius@xxxxxxxxx>

Align divided lines to the first line's opening paranthesis
Where two or more if's are in form 'if (a) if (b) { [...] }' convert them into one to lower the indentation level.
Use the ternary operator in places where there is code in format of: 'if (a) { b = foo1; } else { b = foo2; }'
Make the names of labels all lower case to avoid Camel Case.
Remove unnecessary parantheses around variables that are after a dereference operator like this: '&(a) => &a'
Switch the if condition around in 'if (0 == (value & (1 << bit))) {' to make it have the same form as the rest of the code.

After this patch checkpatch.pl without --strict doesn't complain about rtsx_chip.c at all and with --strict it only complains about the unmatched parantheses. I am reluctant to move that code with unmatched parantheses into another function to lower the indentation level because I don't have the hardware needed to test this driver and don't have enough experience to do it properly. Doing so would just probably hide the other problems this code has. My patch is purely about changing the code style without creating more functions and moving code to them.

This patch is against Greg KH's staging-next tree.

Giedrius StatkeviÄius (5):
Combine ifs into one where possible to avoid unnecessary indentation
level increase
Convert Camel Case labels to lower case, remove unnecessary
parantheses after a dereference operator and remove empty lines
before }
Align lines of divided lines to the opening paranthesis where
possible
Divide lines to make them less than 80 characters long, align to the
opening paranthesis where possible
Use ternary operators where possible and sensible to avoid unnecessary
increase of indentation level

drivers/staging/rts5208/rtsx_chip.c | 322 +++++++++++++++---------------------
1 file changed, 136 insertions(+), 186 deletions(-)

--
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/