Commit Graph

29 Commits

Author SHA1 Message Date
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 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 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
Chetan Sethi 483b10084d staging: ks7010: fix coding style issue of aligning comments properly
This patch fixes coding style issue of having block comments using a
trailing */ on a separate line, warning as issued by checkpatch

Signed-off-by: Chetan Sethi <cpsethi369@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Chetan Sethi d670333e80 staging: ks7010: fix coding style issue of using __func__ instead of __FUNCTION__
This patch fixes coding style issue of using __func__ instead of gcc
specific __FUNCTION__, warning as issued by checkpatch

Signed-off-by: Chetan Sethi <cpsethi369@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Chetan Sethi 1227d76968 staging: ks7010: fix coding style issue of using pr_notice instead of printk
Signed-off-by: Chetan Sethi <cpsethi369@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Chetan Sethi 05be989d98 staging: ks7010: fix coding style issue of enclosing complex macro value in parentheses
This patch fixes error of enclosing complex macro value in parentheses,
error as issued by checkpatch

Signed-off-by: Chetan Sethi <cpsethi369@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Chetan Sethi 01d9de8071 staging: ks7010: fixed warning of avoiding line over 80 characters
This patch fixes warning of line over 80 characters, as issued by
checkpatch.pl

Signed-off-by: Chetan Sethi <cpsethi369@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Shiva Kerdel f3f45c734e Staging: ks7010: ks_*: Use the BIT macro for bitwise checks
Changed bit swifting operators to BIT macros (preferred),
This change will also solve the preferred space surrounding
the operator checks.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:00 +01:00
Shiva Kerdel db224d31bb Staging: ks7010: Add required and preferred spaces around operators
Spaces should be added around operators to improve readability
and are required in some cases.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16 10:28:27 -08:00
Shiva Kerdel 38fb746872 Staging: ks7010: ks*: Add missing blank lines after declarations
A blank line should be added after function/struct/union/enum
declarations.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16 10:28:27 -08:00
Shiva Kerdel fac103e0ab Staging: ks7010: ks_*: Removed blank lines before and after braces.
Removing unnecessary blank lines around braces to solve CHECKS.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:26:15 +01:00
Punit Vara 81710951fb Staging: ks7010: Use preffered kernel types
Replace uint8_t, uint16_t and uint32_t with preferred kernel types
u8, u16 and u32 respectively suggested by checkpatch.pl

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-16 08:23:23 +01:00
Wei Yongjun 5e935b782a staging: ks7010: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25 09:59:48 +02:00
Sabitha George 592c61165b staging: ks7010: Replace header files
This patch replaces inclusion of asm/atomic.h with linux/atomic.h and
asm/io.h with linux/io.h to fix checkpatch warning in ks_wlan.h

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:25:00 +02:00
Matt Kilgore 2460563fb4 staging: ks7010: Use __packed over __attribute__((packed))
This replaces uses of __attribute__((packed)) with __packed, which is
recommended to be used over the direct __attribute__.  This patch then
includes <linux/compiler.h> as necessary to use __packed.

Signed-off-by: Matthew Kilgore <mattkilgore12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 13:03:58 +02:00
Bhumika Goyal 2751bc918e Staging: ks7010: Remove extern keyword from function declaration
Remove extern specifier from function declaration as they have
it by default. Also move extern declaration from .c files to
their respective header file 'ks_hostif.h'. Coccinelle was used
to remove extern and other changes were done by hand.
Script:
@@
identifier func;
type T;
@@
- extern
T func(...);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-17 23:36:53 +02:00
Wolfram Sang 30776cf921 staging: ks7010: function declaration should be in a header file
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18 19:45:55 -07:00
Wolfram Sang 6ee9169b40 staging: ks7010: remove cfg file handling
I verified that all but two settings from the config file can be set up
also via 'iwconfig' or 'iwpriv'. The two missing are ROM_FILE and
PhyInformationTimer. ROM_FILE can be easily dropped. There is only one
known firmware floating on the net, so, the name is fix and we can make
this constant. Frankly, I don't know when PhyInformationTimer needs to
be set to non-zero. But if we need it somewhen, there is already
(currently commented out) code to add this as another private method, so
we could use that. Summa summarum: We can remove the config file
handling and the example config file. The only useful action,
initialization of the configuration struct, is now moved to the sdio
main file.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18 19:45:55 -07:00
Wolfram Sang c5d9a03031 staging: ks7010: cleanup file headers
Remove svn-ids and fix typos in the licence declaration. Add my
copyright to the sdio code which I worked on mainly.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang 9adca34b7e staging: ks7010: drop counting sd errors
They were counted but never really used anywhere. Also change the printk
to a debug print, since it mostly shows on the expected -ENOMEDIUM on
card removal.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang d6e25e7048 staging: ks7010: indent ks_wlan.h
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang feedcf1a5f staging: ks7010: remove unecessary typedef
Let's simply specify the struct to keep in sync with kernel coding
style.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang 564efd7935 staging: ks7010: delete seperate debug header
Move the one debug macro to the generic wlan header.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang 72bf750007 staging: ks7010: remove code for old kernel versions
No need to be backwards compatible.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang 021873f650 staging: ks7010: remove non-SDIO code and #ifdefs
I couldn't find any trace of code or even products using ks7010 with
something else than SDIO. So, remove the conditionals.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00
Wolfram Sang 13a9930d15 staging: ks7010: add driver from Nanonote extra-repository
See the TODO for details where this driver came from. Only a few minor
changes were made to make the driver suitable for staging:

* updated Kconfig help text and dependencies
* added TODO
* removed two __DATE__ and __TIME__ printouts to allow reproducible builds
* added to staging main Kconfig + Makefile

Tested on a Renesas Salvator-X board with a Spectec SDW-823 card. I
could connect to a WPA-protected network.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-07 22:42:53 -07:00