summaryrefslogtreecommitdiff
path: root/drivers/staging/ks7010
AgeCommit message (Collapse)Author
2017-04-18staging: ks7010: create reg_status_type enum typeTobin C. Harding
SDIO header currently defines unused constants READ_STATUS_BUSY and WRITE_STATUS_IDLE. There are reciprocal constants that are used READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a single enumeration type and remove the two that are unused. Add enumeration type containing IDLE/BUSY pair that are currently used within the SDIO source. Change source to use new enum types. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-14staging: ks7010: remove unused spin_lockTobin C. Harding
Driver SDIO private data structure description includes a spin_lock that is never used. This data structure only contains a pointer to the sdio_func and a pointer to the main device private data. A spin_lock is not required here. Remove unused spin_lock. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-14staging: ks7010: remove unused structure descriptionTobin C. Harding
Driver SDIO header describes a structure that is never used. It can be safely removed. Remove unused structure description. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-14staging: ks7010: remove unused read_bufTobin C. Harding
Driver SDIO code allocates memory for a buffer that is never used. It can be safely removed. Remove unused buffer, including allocation and freeing of memory. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-14staging: ks7010: remove unused completionTobin C. Harding
Driver SDIO code initializes a completion that is never used. It can be safely removed. Remove unused completion. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: move check and break to top of loopTobin C. Harding
Function uses an if statement within a for loop to guard a block of code. If 'if' statement conditional evaluates to false, loop breaks. The same logic can be expressed by inverting the conditional and breaking when new conditional evaluates to true. This allows the subsequent code to be indented one level less, aiding readability. Reduced indentation also allows for the code to be laid out more clearly and fixes two checkpatch warnings. Invert if statement conditional, break from for loop if new conditional evaluates to true. Reduce indentation in subsequent code, fix whitespace issues. Do not change program logic. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: remove multi-way decisionTobin C. Harding
Function uses multi-way decision for control flow. Final statement of function is spin_unlock(). Code can be simplified by adding a goto label labelling the call to spin_unlock() and jumping to label instead of using multi-way decision. This allows the code to be indented one level less which adds to the readability. Add goto label. Remove multi-way decision by jumping to label. Reduce indentation in subsequent code. Do not change program logic. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: remove unused macroTobin C. Harding
Macro CHECK_ALINE is defined and never used. Remove unused macro. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix checkpatch MULTILINE_DEREFERENCETobin C. Harding
Checkpatch emits WARNING: Avoid multiple line dereference. Fix up layout of function call, move dereference to single line. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix checkpatch LOGICAL_CONTINUATIONSTobin C. Harding
Checkpatch emits multiple CHECK: Logical continuations should be on the previous line. Move logical continuations to the end of the previous line. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: rename identifier packet to skbTobin C. Harding
Kernel networking code predominately uses the identifier 'skb' for a struct sk_buff pointer. Of 8088 instances of 'struct sk_buff *' within net/ 6670 are named 'skb'. Following the principle of least surprise, new networking code should use the identifier 'skb' for variables of type 'struct sk_buff *'. Rename identifier 'packet' to 'skb'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: add task to TODO fileTobin C. Harding
Driver uses custom Michael MIC implementation. There is already an implementation within the kernel. There is at least one other driver already using the kernel implementation (drivers/net/wireless/intersil/orinoco). Add task to TODO file. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: rename RecvMIC to recv_micTobin C. Harding
Identifier uses camel case, standard kernel style does not use camel case. Rename buffer 'RecvMIC' to 'recv_mic'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix checkpatch UNNECESSARY_ELSETobin C. Harding
Checkpatch emits WARNING: else is not generally useful after a break or return. Two warnings of this type are emitted for this code block, in both cases 'else' statements are unnecessary. Remove unnecessary 'else' statements, reduce indentation in subsequent code. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENTTobin C. Harding
Checkpatch emits CHECK: Alignment should match open parenthesis. Align argument to open parenthesis. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: utilize local variableTobin C. Harding
Function contains a local pointer variable defined to a memory location within a structure. This memory location is later used by dereferencing the struct instead of using the local pointer. The code is cleaner if all references of the same memory location use the local variable. Utilize existing local pointer variable instead of dereferencing struct. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: simplify calls to memcpy()Tobin C. Harding
Function uses overly complex calls to memcpy(). Code may be simplified by the use of a local variable. Code sometimes uses explicit address of initial array element and sometimes does not. Uniformity aids readability. If array pointers are explicit it aids readability further. Simplify calls to memcpy(). Add local pointer variable, define it to the correct memory location. Use newly defined variable in calls to memcpy(). Be uniform in use of explicit address of first element of array (&foo[0]). Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: move null check before dereferenceTobin C. Harding
Function parameter is cast to a local pointer which is then dereferenced before it is checked to be non-NULL. Move pointer null check to be before the pointer is dereferenced. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix multi-way decisionTobin C. Harding
Multi-way decision contains two anomalies. Firstly, a local variable is defined to be the inverse truth variable of a struct member. This local variable is used as the conditional to the multi-way decision. This is unnecessary, the same logic can be expressed using the struct member directly. Secondly, there are four branches in the multi-way decision, two of which can never be executed. This is dead code. Remove unnecessary local variable. Remove two branches of multi-way decision statement that can never be executed. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: factor out send stop requestTobin C. Harding
Function contains compound statement delineated by lone braces. This statement represents a discreet set of functionality and thus can be factored out into a separate function. Using a separate function instead of a compound statement increases readability, reduces code indentation, reduces function length, and generally looks more tidy. Factor compound statement out to separate function. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: fix function return code pathTobin C. Harding
Function has duplicate code clean up sequences; identical function call followed by return. This would be better expressed with the use of a goto statement, as is typical in-tree. One call site places the clean up code within the 'else' branch of an multi-way decision. This can be more clearly expressed by inverting the initial decision conditional and jumping directly to the cleanup code. Subsequent code indentation can then be reduced, aiding readability. Fix function return code execution path. Move clean up code to end of function with a label. Replace duplicate clean up code within function with a jump to label. Invert conditional, jump to label if new conditional evaluates to true, reduce indentation in subsequent code. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: separate dissimilar checksTobin C. Harding
Function contains a list of four checks, for no apparent reason two of them are OR'ed together. Having two OR'ed together and the other two not implies some connection between the two that are combined. It is easier to read this code if the four unrelated checks are done as separate statements. Move dissimilar expressions out of logical continuation and into separate statement. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: change static function return typeTobin C. Harding
Function has return type 'int'. Function has internal linkage. Function returns 0 on all execution paths. Function is called only once in the driver and the return value is not checked. Removal of this return value does not change the program logic. The 'int' return type is not adding any information thus it is better to remove it. Change return type of function with internal linkage from 'int' to 'void'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: invert conditional, reduce indentationTobin C. Harding
A number of functions have blocks of code guarded by an if statement. if (foo) { /* block of code */ } This can, on occasion, more succinctly be expressed as if (!foo) return /* block of code */ This change will mean a number of whitespace issues need to be addressed/fixed. The diff can be a little hard to read when there are multiple lines that are very similar (for example error return code). Splitting the indentation reduction and the whitespace fixes into two separate patches was not found to aid reading the diff. Therefor we fix the whitespace issues at the same time. We need to be very sure to not make any changes to the program logic, this is ensured by only doing what is stated - invert the conditional, fix whitespace. Invert if statement conditionals. Return if new conditional evaluates to true. Reduce level of indentation in subsequent code. Fix white space issues. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: rename identifier retval to retTobin C. Harding
Function uses identifier 'retval' to hold the error return value. The rest of the driver uses 'ret' for this purpose. Being uniform in the choice of identifiers generally adds to the cleanliness of the code, also it is arguably easier to follow the code if one name is used for one task. Rename identifier 'retval' to 'ret'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: rename identifier rc to retTobin C. Harding
Driver uses identifier 'rc' to hold the value for error return code. The rest of the driver predominately uses 'ret' for this purpose. It is easier to follow the code if one name is used for one task. Rename identifier 'rc' to 'ret'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: change length type to unsignedTobin C. Harding
Length undergoes type conversion when passed (indirectly) as an argument for parameter of type 'unsigned int'. If length is negative this is a bug (the value after conversion is large). Declare 'length' to be an unsigned type instead of a signed type. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: remove void * castTobin C. Harding
Functions accept a parameter of type 'void *', this is then cast to a struct ks_wlan_private pointer. All call sites have a struct ks_wlan_private pointer and cast it to 'void *'. We can remove the unnecessary casting by changing the parameter type to match the usage. Functions changed all have internal linkage. Replace parameter of type 'void *' with 'struct ks_wlan_private *'. Remove unnecessary casting to and from 'void *'. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-11staging: ks7010: remove unnecessary function parameterTobin C. Harding
Function ks7010_upload_firmware() takes as parameters, two struct pointers, one of which is a member of the other. This is unnecessary since one can be accessed via the other. Remove function parameter and fix all call sites. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: fixed a coding style issueXiangyang Zhang
Fixed checkpatch.pl CHECK: Logical continuations should be on the previous line Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: invert if statement conditionalsTobin C. Harding
Checkpatch emits WARNING: Avoid multiple line dereference. Function uses if statement blocks to guard the body of the function. If we invert these conditionals and return, then the code becomes more readable and subsequent code is indented less. The checkpatch fix then follows trivially. Invert conditionals, return from function if new conditional evaluates to true. Reduce the level of indentation in subsequent code. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: remove redundant checkTobin C. Harding
Function checks for condition inside a loop that checks the same condition, this is redundant. Fix also removes checkpatch CHECK. Remove redundant check. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: add braces to multi-line indentTobin C. Harding
The addition of curly braces around single statements that span multiple lines makes the code more readable in general. Add curly braces to multi-line indented statement. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: add explicit check to 'size' variablesTobin C. Harding
When checking the value of a variable that holds a 0 an explicit check is good style. i.e - if (!size) + if (size == 0) Update checks on 'numerical' variables to use explicit checks. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: add explicit check to memcmp() callsTobin C. Harding
Calls to functions memcmp() and strcmp() are more clearly readable when the return value is explicitly checked. i.e if (memcmp(foo, bar, size) == 0) Modify driver to use an explicit check on the value returned by memcmp(). Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23staging: ks7010: fix memcmp() bugTobin C. Harding
Call site to memcmp() treats return value as if it were an error code, it is not. If memcmp() finds inputs to be not the same, an error return code should be set explicitly. Correctly handle return value from call to memcmp(), set error code explicitly. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: rename return value identifierTobin C. Harding
Driver uses multiple identifier names for the same task (retval, ret, rc). It would be easier to read the code if a single task is identified with a single name. 'ret' is the most common return value identifier name found in the kernel tree, following the principle of least surprise using 'ret' is a decent choice. Rename rc -> ret Rename retval -> ret Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: remove zero comparisonTobin C. Harding
Comparison, equal to zero, is redundant 'if (foo == 0)' is equal to 'if (!foo)' Typical kernel coding style is to use the shorter form. Remove unnecessary zero comparison. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: remove non-zero comparisonTobin C. Harding
Comparison, does not equal zero, is redundant 'if (foo != 0)' is equal to 'if (foo)' Typical kernel coding style is to use the shorter form. Remove unnecessary non-zero comparison. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: make goto labels uniformTobin C. Harding
Driver uses different label forms for similar purposes. It would be more clear if single use case has uniform label. 'out' is generic and adds no meaning to label. Documentation/process/coding-style.rst: Choose label names which say what the goto does or why the goto exists. Rename labels so as to better describe what they do. If an execution path only exists for the label on an error, prefix the label with 'err_'. If a non-error execution path exist do not use prefix. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: return directly on errorTobin C. Harding
Function uses goto label with no clean up code. In this case we should just return directly. Remove goto statement, return directly on error. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: fix checkpatch MULTIPLE_ASSIGNMENTSTobin C. Harding
Checkpatch emits CHECK: multiple assignments should be avoided. Move multiple line assignment to individual lines. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: fix checkpatch BRACESTobin C. Harding
Checkpatch emits CHECK: Unbalanced braces around else statement. Statements in question are single statements so we do not need braces. Checkpatch also warns about multiple line dereference for this code. Fix if/else/else if statement use of braces. Fix function argument layout at the same time since it is the same statement. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENTTobin C. Harding
Checkpatch emits CHECK: Alignment should match open parenthesis. Fix alignment to open parenthesis in line with kernel coding style. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: fix checkpatch SPACINGTobin C. Harding
Checkpatch emits CHECK: No space is necessary after a cast. Remove unnecessary space after cast. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21staging: ks7010: fix checkpatch LINE_SPACINGTobin C. Harding
Checkpatch emits CHECK: Please use a blank line after function/struct/union/enum declarations. Add blank line after function definition. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENTTobin C. Harding
Checkpatch emits WARNING and CHECK for prototype declarations. WARNING: function definition argument 'void *' should also have an identifier name CHECK: Alignment should match open parenthesis Also prototype parameters wrap more than is necessary. Tidy up function prototypes. Fix 5 error/warning instances. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: ks7010: fix checkpatch BLOCK_COMMENT_STYLETobin C. Harding
Checkpatch emits WARNING: Block comments use a trailing */ on a separate line. Move comments to (kernel doc format) struct comment. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: ks7010: fix checkpatch SPACINGTobin C. Harding
Checkpatch emits WARNING: Unnecessary space before function pointer arguments. Remove unnecessary space before function pointer. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: ks7010: remove dead codeTobin C. Harding
Driver has dead code compiled out using preprocessor directives. TODO file asks for these not to be removed - ignore this. Remove dead code. Remove 'do not remove #if 0/1 ...' from TODO file. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>