All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: rts5208: clean up coding style in rtsx_chip.c
@ 2014-10-03 20:27 Giedrius Statkevicius
  2014-10-03 20:27 ` [PATCH 1/5] Combine ifs into one where possible to avoid unnecessary indentation level increase Giedrius Statkevicius
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Giedrius Statkevicius @ 2014-10-03 20:27 UTC (permalink / raw)
  To: gregkh; +Cc: micky_ching, fabio.falzoi84, devel, linux-kernel

From: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-03 20:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03 20:27 [PATCH 0/5] staging: rts5208: clean up coding style in rtsx_chip.c Giedrius Statkevicius
2014-10-03 20:27 ` [PATCH 1/5] Combine ifs into one where possible to avoid unnecessary indentation level increase Giedrius Statkevicius
2014-10-03 20:34   ` Greg KH
2014-10-03 20:27 ` [PATCH 2/5] Convert Camel Case labels to lower case, remove unnecessary parantheses after a dereference operator and remove empty lines before } Giedrius Statkevicius
2014-10-03 20:27 ` [PATCH 3/5] Align lines of divided lines to the opening paranthesis where possible Giedrius Statkevicius
2014-10-03 20:27 ` [PATCH 4/5] Divide lines to make them less than 80 characters long, align " Giedrius Statkevicius
2014-10-03 20:27 ` [PATCH 5/5] Use ternary operators where possible and sensible to avoid unnecessary increase of indentation level Giedrius Statkevicius

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.