staging: ft1000: function write_dpram32_and_check extracted from write_blk
authorKelley Nielsen <kelleynnn@gmail.com>
Tue, 29 Oct 2013 15:06:56 +0000 (08:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2013 15:36:17 +0000 (08:36 -0700)
commiteb2ec63979702f04d45f608f635b0533defefa16
tree5bdb99ca8f757d6581266bd17cc69c70f5782297
parente0a223b465c609e2d03bea3551183e9a8ad2be81
staging: ft1000: function write_dpram32_and_check extracted from write_blk

function write_blk is long and overly complex, consisting of a triply
nested loop. It also has improper indentation and line lengths
throughout, and has return type of u32 rather than int. Some of the
lines, when converted to proper indentation, create checkpatch warnings
for too many leading tabs.

This patch extracts the innermost loop into its own function,
write_dpram32_and_check. This removes several levels of indentation from
the extracted lines and makes the original function simpler. Two local
variables from the original function, u16 resultbuffer[] and a loop
counter, have been made local variables of the new function. Two calls
to msleep() have been replaced with usleep_range() as per Documentation/
timers/timers-howto.txt (which was referred to in a checkpatch warning).
Several other style issues in the extracted code have been corrected as
well.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ft1000/ft1000-usb/ft1000_download.c