Commit Graph

259 Commits

Author SHA1 Message Date
Ilia Sergachev ec4d9227d7 staging: ks7010: remove line continuations in quoted strings
Checkpatch emits WARNING: Avoid line continuations in quoted strings.

Remove line continuations - split strings using quotes.

Signed-off-by: Ilia Sergachev <ilia.sergachev@unibas.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 17:51:39 +02:00
Tobin C. Harding 0743ce5904 staging: ks7010: fix enumeration tags
Driver header declares enumeration types without tags. Using
informative tags makes the code easier to understand and
eliminates the need to comment the enum.

Add tags to enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding f730fb19dd staging: ks7010: add enum multicast_filter_type
Driver uses preprocessor directives to define multicast filter
constants. These can be defined using an enumeration type. Doing so
adds to the readability and gives the assists the compiler.

Add enumeration type multicast_filter_type to replace preprocessor
defined constants.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 72f78682da staging: ks7010: clean up macro ps_confirm_wait_inc
Macro includes commented out code. Removing dead code line enables
braces to be removed. Macro is easier to read if the code is clean.

Clean up macro ps_confirm_wait_inc.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding e04f2ec6c3 staging: ks7010: continue from loop on unmatched mac
Inside loop, code block is guarded with an 'if' statement. Instead of
guarding the block we can invert the 'if' statement conditional and
continue the loop. Doing so allows subsequent code indentation to be
reduced and aids the readability of the code.

Invert 'if' statement conditional, continue loop if new conditional
evaluates to true. Reduce subsequent code indentation level. 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-28 11:47:26 +02:00
Tobin C. Harding 2b0d92b265 staging: ks7010: remove cast from netdev_priv()
The returned pointer from netdev_priv() (void *) does not need to be
cast.

Remove unnecessary cast of void * returned by netdev_priv().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 8fb8e05cca staging: ks7010: make abbreviation mgmt uniform
Driver currently uses abbreviations 'mgt' and 'mngmt' for
'management'. Also 'power' is sometimes abbreviated to 'pow' and other
times not. It makes the code easier to read and easier to modify if
one abbreviation is used throughout the driver. 'mgmt' is widely
accepted as an abbreviation of 'management'. 'power' can be spelled
out in full, the extra two characters aids readability without an
excessive cost.

Make abbreviation of 'management' uniform across the driver, function
names, preprocessor defined constants, and enumeration types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 27476f01d3 staging: ks7010: fix checkpatch LINE_SPACING
Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 63c31af3e5 staging: ks7010: add enum sleep_mode_type
Driver uses preprocessor directives to define SLP_ASLEEP and
SLP_ACTIVE. These can be defined using an enumeration type. Doing so
adds to the readability and gives the usual compiler benefits of
having an enum. Functions that currently accept integer types can now
use the new enumeration type, further aiding readability.

Add enumeration type sleep_mode_type. Update code that handles sleep
mode to use the new enumeration type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 0e24eb8abf staging: ks7010: abstract connection status
Host interface connection status is handled using a 32 bit type. Top
byte is used as for FORCE_DISCONNECT status, low bits are used for
connect/disconnect status. Driver masks and checks integers to
ascertain status. If functions are defined to do the masking and
equality check then the details of how the status integer is used are
abstracted away. This makes the code easier to read. Also future
updates to the status handling will be easier because the code is in
one place.

Driver currently uses the CONNECT_STATUS and DISCONNECT_STATUS as
values, as apposed to opaque values. Because of this driver code
checks for equality with CONNECT_STATUS and DISCONNECT_STATUS as
apposed to negating a single check (ie 'foo != CONNECT_STATUS). In
order to maintain the current functionality we define two separate
functions is_connect_status() and is_disconnect_status().

Add functions to abstract the status integer check. Update all sites
that do the check manually to use the newly defined functions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 11ce16da7b staging: ks7010: add hostif_generic_request()
Driver contains duplicate code. Host interface has numerous request
functions which allocate memory for a request header. Each request
header is different but all contain, as the first member, a hostif_hdr
structure. This structure has size and event members which need to be
set. By defining a helper function to allocate the memory and set the
initial hostif_hdr members code duplication is reduced.

Add function to allocate  memory for a host interface request. Set
'size' and 'event' members. Remove duplicate code using newly defined
function.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:47:26 +02:00
Tobin C. Harding 95e72fba95 staging: ks7010: clean memory allocation
Memory allocation code contains unneeded debug statements, failed
kmalloc() calls typically do not require a debug message. Introduction
of a local 'size' variable allows kmalloc() call to be marginally
cleaner, still uses magic numbers but these require a more substantial
fix. Moving the magic numbers onto a single line opens the way for
further refactoring.

Clean memory allocation code, remove debug statements.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 8215fc607f staging: ks7010: remove duplicate code
Current switch statement has duplicate code in branches. This code can
be put after the switch statement so as to remove the duplication.

Move code to after switch statement, remove duplicate code. Make error
branch return so as not to execute the moved code block. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 08484ef419 staging: ks7010: remove magic numbers
Driver includes magic numbers. Defining constants or using existing
constants aids the readability of the code.

Magic number '12' is used for two ethernet addresses (6 bytes
each). ETH_ALEN is already defined within the kernel to 6. We can us
the expression '2 * ETH_ALEN' to make this code explicit.

Magic number '20' refers to the data size, in bytes, of a struct
ether_hdr (described in eap_packet.h). We can define a constant for
this purpose, making the code explicit and easier to read.

Define constant. Remove magic numbers, using newly defined constant
and/or expression using existing kernel constant.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 8cd1dbe1db staging: ks7010: move skb null check near allocation
Currently, after allocating an sk_buff, driver fills the sk_buff
within code block guarded by a NULL check on the sk_buff. If a NULL
check is done immediately after the allocation, and code returns on
error, then the subsequent code need not be guarded and the level of
indentation may be reduced. This aids the readability of the code and
makes explicit the error path.

Check for NULL directly after allocating the sk_buff, return if
allocation fails. Reduce indentation of subsequent code. Do not change
the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 69f3fecc49 staging: ks7010: remove unused local variable eap_key
Code declares and assigns to a local variable that is never used, it
can be safely removed.

Remove unused local variable.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 208c66f2fb staging: ks7010: remove unnecessary address check
Currently source and destination ethernet addresses are checked twice,
once in hostif_data_indication() and then again in
hostif_data_indication_wpa(). The second of these functions is called
from the first right after the address check is done. This check is a
duplicate and is unnecessary.

Remove unnecessary duplicate address check.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 11:45:49 +02:00
Tobin C. Harding 7c1c43615d staging: ks7010: fix checkpatch SPLIT_STRING
Checkpatch emits WARNING: quoted string split across lines.

Concatenate string onto single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding f1e79f4b96 staging: ks7010: refactor SDIO read/write helpers
Driver SDIO code uses helper functions to do IO to the SDIO
device. Current helpers handle IO of a single byte as well as
multi-byte. Driver predominately uses single byte IO. If the
common case is made simple it simplifies the whole driver. The common
case can be made simple by splitting the multi-byte and single byte
calls into separate functions, i.e 4 functions in total, read single
byte, read multi-byte, write single byte, write multi-byte.

Also, we need to handle the debug code. Currently debug calls after
read/write fail access the IO buffer. This buffer, at best, does not hold
useful data on the error path, at worst is uninitialized and holds
garbage.

Split read/write helper functions into two functions each, one for
single byte IO and one for multi-byte IO. Fix all call sites. Do not
change the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding a9d58d9ad8 staging: ks7010: fix checkpatch LINE_SPACING
Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding 132f541532 staging: ks7010: fix checkpatch SPACE_BEFORE_TAB
Checkpatch emits WARNING: please, no space before tabs.

Remove space before tabs.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding 0dd30a74b9 staging: ks7010: remove err_ from non-error path label
goto label includes 'err_' suffix but is executed on non-error paths.

Remove err_ suffix from goto label.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding e61e73d71b staging: ks7010: clean up SDIO source comments
SDIO code currently has a number of unneeded comments. Following
kernel coding style we do not need extraneous comments, especially on
code where it is clear what is being done. Spelling typos can be
fixed.

Remove unnecessary comments, fix typos in comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding 3dfb942f03 staging: ks7010: add struct comment to ks_sdio_card
ks_sdio_card structure description does not have a kernel doc format
comment.

Add kernel doc format comment to struct ks_sdio_card.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding 18bd6dd1f8 staging: ks7010: move hw info into dev private data
Currently driver uses a hardware information struct description to
group some SDIO related functionality (work, work queue, sdio private
data pointer). This structure is then embedded in the device private
data structure. Having nested structures described in different header
files means that to view the device private data programmers must open
two header files. This structure could be embedded anonymously in the
device private data and achieve the same result (grouping of function
specific to SDIO) without the need to open multiple headers. However,
the SDIO private data structure already has various different data and
pointers, adding the embedded structure adds little extra meaning and
lengthens all the dereferences throughout the driver, often meaning
addition line breaks and braces. We can increase readability and
reduce code complexity by moving the hardware information data and
pointers to directly be within the device private data structure
description.

While preparing for this refactoring it was noted that the identifier
currently used for the delayed work is 'rw_wq', this is confusing
since the 'wq' suffix typically means 'work queue'. This identifier
would be more meaningful if it used the suffix 'dwork' as does the
declaration of queue_delayed_work() (include/linux/workqueue.h).

The identifier for the work queue is currently 'ks7010sdio_wq'. This
identifier can be shortened without loss of meaning because there is
only one work queue within the driver. Identifier 'wq' is typical
within in-tree driver code and aptly describes the pointer.

Current pointer to the SDIO private data is identified by 'sdio_card',
this is sufficiently meaningful from within the hw_info structure but
once the hw_info_t structure is removed the pointer would be better to
have a prefix appended to it to retain the prior level of meaning.

Move members from struct hw_info_t to struct ks_wlan_private.

Rename identifiers;
struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
struct ks_sdio_card  pointer 'sdio_card' to 'ks_sdio_card'.

Remove structure description hw_info_t. Fix init/destroy calls. Fix
all call sites, SDIO private data access calls, and queuing calls.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:47:31 +02:00
Tobin C. Harding 321dabdc74 staging: ks7010: move tasklet_struct to ks_wlan_private
Currently a pointer to the tasklet_struct used for bottom half
processing on the receive path is within the hw_info_t structure. This
structure is then embedded in the device private data
structure. Having the tasklet_struct nested does not add meaning to
the device private data, device private data already (and typically)
has various data relating to the device, there is no real need to
separate the tasklet_struct to a SDIO specific structure. While not
adding allot of extra meaning having the nested structure means the
programmer must open two header files to read the description of the
device private data, the code would be easier to read if the device
private data struct description was not spread over two files.

Move tasklet_struct out of sdio header file and into the device
private data structure description.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:33:17 +02:00
Tobin C. Harding 07e483c14b staging: ks7010: rename wakeup work struct
struct work_struct uses identifier ks_wlan_wakeup_task, this is
confusing because the 'task' suffix implies that this is a
tasklet_struct instead of a work struct. Suffix 'work' would be more
clear. The code would be easier to read if it followed the principle
of least surprise and used the 'work' suffix for a work_struct
identifier.

Rename work_struct structure 'ks_wlan_wakeup_task' to 'wakeup_work'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:33:17 +02:00
Tobin C. Harding b9ca8bb4e4 staging: ks7010: clean up SDIO header comments
SDIO header file does not use kernel doc format struct
comments. Adding them aids readability and enables documentation to be
built from the source code. Other comments may be tidied up as we do this.

Add kernel format struct comments. Tidy up comments.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:33:17 +02:00
Tobin C. Harding 055da4f9b9 staging: ks7010: fix complete_handler
complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.

Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.

The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.

Remove unnecessary parameters, unnecessary casting to/from 'void
*'. Fix all call sites involving complete_handler().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:33:17 +02:00
Tobin C. Harding 68711cebcb staging: ks7010: replace defines with enum types
Header has multiple constants defined using preprocessor
directive. In the cases where these are an integer progression an
enumeration type can be used. Doing so adds documentation to the code
and makes the usage explicit. Maintain original constant value, this
value is returned by the device.

Replace (integer progression) preprocessor constants with enumeration
type.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18 13:33:17 +02:00
Tobin C. Harding bfee6a2319 staging: ks7010: create reg_status_type enum type
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-18 13:33:17 +02:00
Tobin C. Harding 4f22b8954b staging: ks7010: remove unused spin_lock
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-14 10:22:03 +02:00
Tobin C. Harding d2729c6e94 staging: ks7010: remove unused structure description
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-14 10:22:03 +02:00
Tobin C. Harding cf10e78e1b staging: ks7010: remove unused read_buf
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-14 10:22:03 +02:00
Tobin C. Harding fa125ae482 staging: ks7010: remove unused completion
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-14 10:22:03 +02:00
Tobin C. Harding d317d054b1 staging: ks7010: move check and break to top of loop
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-11 16:14:33 +02:00
Tobin C. Harding eb8c4e5469 staging: ks7010: remove multi-way decision
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-11 16:14:33 +02:00
Tobin C. Harding 1e0aa795da staging: ks7010: remove unused macro
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-11 16:14:33 +02:00
Tobin C. Harding 4906be2486 staging: ks7010: fix checkpatch MULTILINE_DEREFERENCE
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-11 16:14:33 +02:00
Tobin C. Harding 331454f438 staging: ks7010: fix checkpatch LOGICAL_CONTINUATIONS
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-11 16:14:33 +02:00
Tobin C. Harding 78037ef122 staging: ks7010: rename identifier packet to skb
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-11 16:14:33 +02:00
Tobin C. Harding dd85d7120f staging: ks7010: add task to TODO file
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-11 16:05:51 +02:00
Tobin C. Harding 37ab542e9a staging: ks7010: rename RecvMIC to recv_mic
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-11 16:05:50 +02:00
Tobin C. Harding ba9328768b staging: ks7010: fix checkpatch UNNECESSARY_ELSE
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-11 16:05:50 +02:00
Tobin C. Harding 8f0ef774b8 staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT
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-11 16:05:50 +02:00
Tobin C. Harding 3da1b2371e staging: ks7010: utilize local variable
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-11 16:05:50 +02:00
Tobin C. Harding b121d84882 staging: ks7010: simplify calls to memcpy()
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-11 16:05:50 +02:00
Tobin C. Harding 9ff19a6e35 staging: ks7010: move null check before dereference
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-11 16:05:50 +02:00
Tobin C. Harding dc59ef2af2 staging: ks7010: fix multi-way decision
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-11 16:05:50 +02:00
Tobin C. Harding 2ab6fd5963 staging: ks7010: factor out send stop request
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-11 16:03:36 +02:00