1. 29 Oct, 2013 4 commits
    • Kelley Nielsen's avatar
      staging: ft1000: style issues fixed in write_blk · 74827f8d
      Kelley Nielsen authored
      function write_blk, in ft1000_download.c, contains many coding style
      issues. It has indentations of 3 spaces, long lines, C99 comments, and
      extra whitespace. It also has a return type of u32, and changing the
      returned variable in the function triggers a checkpatch leading spaces
      warning. Indentation should be fixed throughout the file for
      consistency.
      
      This patch fixes those issues, in preparation for correcting the status
      return type throughout the file. The variable Status has been changed
      from u32 to int and renamed status.
      Signed-off-by: default avatarKelley Nielsen <kelleynnn@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74827f8d
    • Kelley Nielsen's avatar
      staging: ft1000: function write_dpram32_and_check extracted from write_blk · eb2ec639
      Kelley Nielsen authored
      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: default avatarKelley Nielsen <kelleynnn@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb2ec639
    • Kelley Nielsen's avatar
      staging: ft1000: duplicate code replaced with call to request_code_segment · e0a223b4
      Kelley Nielsen authored
      function scram_dnldr, in ft1000_download.c, is very long and consists
      mainly of nested switch statements inside a while loop. Some code in one
      of the inner switch cases was almost identical to the code in the
      previously extracted function request_code_segment. The duplicated code
      was replaced with a call to request_code_segment, and
      request_code_segment was slightly modified to work in both cases.
      
      A new parameter was added to request_code_segment, a bool to distinguish
      which case it was replacing. The name of an existing parameter (now
      called endpoint) was changed to reflect the fact that it will be passed
      in from more than one place. Several lines from the case containing the
      duplicated code were moved to request_code_segment, and a test was added
      to determine if these lines or a line from the original function should
      be run.
      
      Finally, an unused variable (tempword) was removed from scram_dnldr.
      Signed-off-by: default avatarKelley Nielsen <kelleynnn@gmail.com>
      Reviewed-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0a223b4
    • Kelley Nielsen's avatar
      staging: ft1000: function request_code_segment extracted · aaeb94c9
      Kelley Nielsen authored
      function scram_dnldr in ft1000_download.c is very long and contains many
      coding style errors and best practice violations. It consists of nested
      switch statements inside a while loop. One of the inner switch cases has
      been extracted as a helper function. Also, some style errors (such as
      C99 comments) have been fixed, an assignment to an unread variable has
      been removed, and break statements inside ifs have been converted to
      returns.
      Signed-off-by: default avatarKelley Nielsen <kelleynnn@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aaeb94c9
  2. 28 Oct, 2013 36 commits