20 Mar, 2014

1 commit


17 Mar, 2014

1 commit


08 Mar, 2014

1 commit


18 Dec, 2013

1 commit


09 Dec, 2013

1 commit


04 Dec, 2013

1 commit

  • …user() in ft1000_ioctl()

    get_user() may fail and cause 'msgsz' uninitialized, so need give a
    check. The related warning (with allmodconfig under hexagon):

    CC [M] drivers/staging/ft1000/ft1000-usb/ft1000_debug.o
    drivers/staging/ft1000/ft1000-usb/ft1000_debug.c: In function 'ft1000_ioctl':
    include/uapi/linux/swab.h:53:9: warning: 'msgsz' may be used uninitialized in this function [-Wuninitialized]
    drivers/staging/ft1000/ft1000-usb/ft1000_debug.c:533:17: note: 'msgsz' was declared here

    Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    Chen Gang
     

03 Dec, 2013

1 commit


26 Nov, 2013

2 commits


20 Nov, 2013

1 commit


12 Nov, 2013

2 commits

  • Fixed the following coding style issues:

    Lines 84-91,99-106,275,514: Replaced spaces at the start of the lines
    with tabs.

    Lines 205,271: Inserted spaces after the commas.
    Lines 275,1060,1065: Indented the code with tabs instead of spaces.

    Line 275: Inserted spaces around '=' and '
    Signed-off-by: Greg Kroah-Hartman

    Aldo Iljazi
     
  • Fixed the following styling issues:

    Line 30:
    Removed space before open square bracket '['

    Lines 31 to 155:
    Moved the commas that were in the start of the lines, to the end of the lines.
    Inserted spaces after the commas.
    Inserted a one tab indentation to each line.

    Signed-off-by: Aldo Iljazi
    Reviewed-by: Dan Carpenter
    Signed-off-by: Greg Kroah-Hartman

    Aldo Iljazi
     

10 Nov, 2013

10 commits

  • The file ft1000_hw.c is still full of coding style problems that make it
    challenging to read and understand. The lines inside the switch cases
    in ft1000_proc_drvmsg() are indented too deeply, so remove one leading
    tab. Join lines that are now able to fit in the 80 character limit.
    This will take care of the "too many leading tabs" issue. Run
    checkpatch.pl on the file, and correct all other issues it reports
    (except lines with user visible strings over 80 chars).

    Signed-off-by: Kelley Nielsen
    Suggested-by: Waskiewicz Jr, Peter P
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The function dsp_broadcast_msg_id() has four levels of nesting. Move the
    handling for failed allocation for *dpram_blk from the else block at the
    end to the block immediately following the test, reverse the sense of the
    test, and exit with an error code if the allocation fails. This eliminates
    descending into an if block if the allocation is successful. Move all
    lines inside the removed block one tab to the left, and join lines
    that will fall under the 80 char limit.

    Signed-off-by: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The function ft1000_poll(), in ft1000_hw.c, has many miscellaneous
    coding style issues, such as improper indentation, C99 comments, use of
    msleep(), and lines over 80 characters. Changes all spaces at the start
    of lines to the proper number of tabs. Convert C99 comments to standard
    /* */ style. Change calls to msleep(10) to usleep_range(9000, 11000).
    Break lines over 80 characters, unless they are user visible strings.
    Remove space before open paren in function calls. Fix any other issues
    that checkpatch finds.

    Signed-off-by: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The newly extracted function handle_misc_portid still has several
    unnecessary levels of nesting, having inherited its logic from the
    original extracted lines. Move handling for failed memory allocation
    (of *pdpram_blk) to the top of the function, and return -1 from within
    it. This eliminates the if statement around the body of the function.
    Change two levels of nested if/else to an if/else-if/else. Create a
    label, exit_failure, at the end of the function with the cleanup code,
    and goto it at all points of failure. Also, goto it if the call to
    ft1000_receive_cmd() fails, instead of descending into an if block if
    it succeeds. Pull all lines from inside the former if blocks to the
    left, and rejoin lines to take advantage of reclaimed horizontal space.

    Signed-off-by: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The function ft1000_poll, in ft1000_hw.c, is complex, with deep levels
    of nesting, unnecessary variables, and style issues. Extract the default
    case of the switch statement to its own function, handle_misc_portid.
    Make the variable struct dpram_blk *pdpram_blk local to the new function
    and remove it from the old. The variable struct pseudo_hdr *ppseudo_hdr is
    used only once, to access a member of another struct, so eliminate it
    and access the member directly. Return -1 in all the places where the
    code fails, and 0 on successful completion. Fix coding style errors.

    Signed-off-by: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The function ft1000_poll, in ft1000_hw.c, is overly complex, with at
    least five levels of nesting. Extract the lines in switch case
    DSPBCMSGID into their own function, called dsp_broadcast_msg_id(). Pass
    one parameter, struct ft1000_usb *dev. Make a copy of struct dpram_blk
    *pdpram_blk local to the new function, since it is initialized at the
    top of each case in which it appears. Make unsigned long flags local to
    the new function. Remove the assignment to struct pseudo_hdr
    *ppseudo_hdr, which is otherwise unused in the switch case, and receives
    the same assignment at the top of each case in which it appears. Return
    an int, 0 for success and -1 for error. Correct style issues in the
    extracted lines.

    Signed-off-by: Kelley Nielsen
    Reviewed-by: Peter P Waskiewicz Jr
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The function ft1000_poll, in ft1000_hw.c, is overly complex, with at
    least five different levels of nesting. While preparing to extract one
    of the cases to its own function, I discovered that the variable nxtph
    is not used. It is declared and assigned a value in ft1000_poll(), then
    passed by reference to the helper function ft1000_receive_command(),
    which receives it as parameter. pnxtph does not appear in the body of
    this function. Remove all occurrences of nxtph and pnxtph.

    Signed-off-by: Kelley Nielsen
    Reviewed-by: Peter P Waskiewicz Jr
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The ft1000 driver ignores the normal Linux error codes, using its
    own macros, STATUS, STATUS_SUCCESS, and STATUS_FAILURE, instead.
    Unsigned variables (u16 and u32) are sometimes used to hold them.
    This patch converts all occurences of these macros to 0, 0 and -1,
    respectively. It also changes the last remaining status variables
    (mostly called status and ret) to ints, and removes the declarations
    of the macros. This patch does not correct the whitespace issues
    in the lines where the changes were made.

    Signed-off-by: Kelley Nielsen
    Suggested-by: Greg Kroah-Hartman
    Reviewed-by: Josh Triplett
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The file ft1000_hw.c contains formal C99 style function headers that
    waste space and convey little to no useful information. This patch
    converts the headers to either one line standard /* */ style comments
    or shorter standard style headers with parameter lists (if the parameter
    list seemed helpful), or eliminates them entirely. Besides needing to be
    made of its own accord, this change is in preparation to eliminate the
    nonstandard STATUS_* #defines from the driver since they were cited in most
    of the headers.

    Signed-off-by: Kelley Nielsen
    Reviewed-by: Josh Triplett
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • Two files in the ft1000 usb driver ignore expected Linux error codes,
    and instead use two STATUS_SUCCESS 0, and STATUS_FAILURE
    0x1001. This patch removes all remaining occurrences of these from the
    file ft1000_download.c. All occurrences of STATUS_SUCCESS have been
    replaced by 0, and occurrences of STATUS_FAILURE have been replaced by
    -1. One occurence of STATUS_FAILURE has been completely removed:
    get_handshake collects either a local #define or 0 from its helper
    function, check_usb_db, and immediately sets the collecting variable to
    STATUS_FAILURE if the #define is returned. check_usb_db has been
    modified to return -1 instead of the #define.

    Signed-off-by: Kelley Nielsen
    Suggested-by: Greg Kroah-Hartman
    Reviewed-by: Josh Triplett
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     

30 Oct, 2013

2 commits

  • The ft1000 usb driver ignores expected Linux error codes, and uses two
    values defined in ft1000_usb.h: STATUS_SUCCESS 0, and STATUS_FAILURE
    0x1001; and sometimes -1. This patch changes the return values of the
    function scram_start_dwnld to match the status of the handshake returned
    by its helper functions, get_handshake and get_handshake_usb. If the
    handshake fails, -ENETRESET is returned instead of the inappropriate
    STATUS_FAILURE. Also, a new test has been added to differentiate failure
    due to timeout from failure due to net reset (the default). -ETIMEDOUT
    is returned in this case. Finally, 0 is returned on success instead of
    STATUS_SUCCESS.

    Signed-off-by: Kelley Nielsen
    Suggested-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • The ft1000 usb driver ignores expected Linux error codes, and uses two
    values defined in ft1000_usb.h: STATUS_SUCCESS 0, and STATUS_FAILURE
    0x1001; and sometimes -1. This patch changes the return value of the
    function write_dpram_32_and check to 0 or -EREMOTEIO, respectively. The
    relevant change was made in the helper function check_buffers (which is
    only called from write_dpram32_and_check); it now returns 0 on success
    and -EREMOTEIO on failure, and this is allowed to propagate through
    write_dpram32_and_check. Assignments to the return variable status that
    are no longer needed were removed as well. In one function up the call
    chain, dsp_reload in ft1000_hw.c, the status variable was changed from
    u16 to int to avoid collecting a signed value in an unsigned variable.

    Signed-off-by: Kelley Nielsen
    Suggested-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     

29 Oct, 2013

11 commits

  • Linux uses a return type of int for status codes. The file
    ft1000_download.c uses a mixture of u16 and u32. This patch changes all
    variables called status or Status to ints, whether they are returned
    from the function or not. It also changes the return type of all
    functions returning one of the variables to correspond. Also, the
    declaration of scram_dnldr has been changed in ft1000_usb.h.

    Signed-off-by: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • 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: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • 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
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • 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: Kelley Nielsen
    Reviewed-by: Peter P Waskiewicz Jr
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • 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: Kelley Nielsen
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • function scram_dnldr is over 500 lines long, with deep indents that
    trigger checkpatch warnings for too many tabs. It mainly consists of a
    switch statement with long, complicated cases. The first case has been
    extracted to form the helper function scram_start_dwnld. Some style
    issues in the extracted lines have been corrected as well.

    Signed-off-by: Kelley Nielsen
    Reviewed-by: Peter P Waskiewicz Jr
    Signed-off-by: Greg Kroah-Hartman

    Kelley Nielsen
     
  • This patch fixes the following warning in ft1000-pcmcia/ft1000_dnld.c-

    drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c:307:6-18: WARNING: Assignment of bool to 0/1

    Signed-off-by: Rashika Kheria
    Reviewed-by: Lisa Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Rashika Kheria
     
  • This patch fixes the following coccinelle warning in ft1000-usb/ft1000_hw.c -

    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1924:9-25: WARNING: Comparison of bool to 0/1

    Signed-off-by: Rashika Kheria
    Reviewed-by: Lisa Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Rashika Kheria
     
  • This patch fixes the following coccinelle warning in ft1000-usb/ft1000_hw.c-

    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1444:1-19: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1937:16-34: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1938:16-35: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1570:4-22: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:1575:4-22: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:636:1-26: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:638:1-25: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:669:1-26: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:755:1-23: WARNING: Assignment of bool to 0/1
    drivers/staging/ft1000/ft1000-usb/ft1000_hw.c:756:1-26: WARNING: Assignment of bool to 0/1

    Signed-off-by: Rashika Kheria
    Reviewed-by: Lisa Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Rashika Kheria
     
  • This patch fixes the following coccinelle error in ft1000-usb/ft1000_download.c -

    drivers/staging/ft1000/ft1000-usb/ft1000_download.c:615:1-16: ERROR: Assignment of bool to non-0/1 constant
    drivers/staging/ft1000/ft1000-usb/ft1000_download.c:926:5-20: ERROR: Assignment of bool to non-0/1 constant
    drivers/staging/ft1000/ft1000-usb/ft1000_download.c:943:7-22: ERROR: Assignment of bool to non-0/1 constant

    Signed-off-by: Rashika Kheria
    Reviewed-by: Lisa Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Rashika Kheria
     
  • This patch fixes the following coccinelle error in ft1000-usb/ft1000_usb.c-
    drivers/staging/ft1000/ft1000-usb/ft1000_usb.c:50:4-18: ERROR: Assignment of bool to non-0/1 constant
    drivers/staging/ft1000/ft1000-usb/ft1000_usb.c:174:1-15: ERROR: Assignment of bool to non-0/1 constant
    drivers/staging/ft1000/ft1000-usb/ft1000_usb.c:39:12-26: ERROR: Assignment of bool to non-0/1 constant

    Signed-off-by: Rashika Kheria
    Reviewed-by: Lisa Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Rashika Kheria
     

27 Oct, 2013

3 commits


20 Oct, 2013

1 commit


17 Oct, 2013

1 commit