History log of /linux-master/drivers/staging/ks7010/ks7010_sdio.c
Revision Date Author Comments
# 058cbee5 26-Sep-2023 Chengfeng Ye <dg573847474@gmail.com>

staging: ks7010: disable bh on tx_dev_lock

As &priv->tx_dev.tx_dev_lock is also acquired by xmit callback which
could be call from timer under softirq context, use spin_lock_bh()
on it to prevent potential deadlock.

hostif_sme_work()
--> hostif_sme_set_pmksa()
--> hostif_mib_set_request()
--> ks_wlan_hw_tx()
--> spin_lock(&priv->tx_dev.tx_dev_lock)

ks_wlan_start_xmit()
--> hostif_data_request()
--> ks_wlan_hw_tx()
--> spin_lock(&priv->tx_dev.tx_dev_lock)

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Link: https://lore.kernel.org/r/20230926161323.41928-1-dg573847474@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f89019d4 09-Feb-2022 Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

staging/ks7010: Remove redundant 'flush_workqueue()' calls

'destroy_workqueue()' already drains the queue before destroying it,
so there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220210060411.1607928-1-chi.minghao@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 56315e55 21-Jul-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

staging: ks7010: Fix the initialization of the 'sleep_status' structure

'sleep_status' has 3 atomic_t members. Initialize the 3 of them instead of
initializing only 2 of them and setting 0 twice to the same variable.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/d2e52a33a9beab41879551d0ae2fdfc99970adab.1626856991.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d1e7550a 28-Oct-2020 Qinglang Miao <miaoqinglang@huawei.com>

staging: ks7010: fix missing destroy_workqueue() on error in ks7010_sdio_probe

Add the missing destroy_workqueue() before return from
ks7010_sdio_probe in the error handling case.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20201028091552.136445-1-miaoqinglang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 22f73079 16-Sep-2020 Allen Pais <apais@linux.microsoft.com>

staging: ks7010: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Link: https://lore.kernel.org/r/20200916062553.58532-1-allen.lkml@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a5e7d27e 08-Mar-2020 Payal Kshirsagar <payalskshirsagar1234@gmail.com>

staging: ks7010: remove line over 80 characters

Remove line over 80 characters.

Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://lore.kernel.org/r/20200308123834.3377-1-payalskshirsagar1234@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0fce6660 24-May-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: ks7010: Remove initialisation in ks7010_sdio.c

As the initial value of the return variable result is never used, it can
be removed.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b2d187cc 16-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: avoid casting inside cpu_to_* assignments

cpu_to_*() functions already have a cast to u* built in,
so the cast is never required. Review and remove all of
them along the code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 89467e74 13-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change parameter type in ks_wlan_hw_rx function

The parameter 'size' in function ks_wlan_hw_rx is declared as
uint16_t and can be declared as size_t which makes more sense.
It is being passed to hif_align_size function which also expects
a size_t as parameter so just change its type. Also update two
casts in calls to this function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 83911837 13-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change cast from uint16_t to u16

Header size and event fields of header are declared
as __le16 and being casted using uint16_t in cpu_to_le16.
Change cast to use preferred u16.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 62a37b72 13-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: replace unsigned char type with u8

Variable 'byte' in ks7010_upload_firmware function is declared
as unsigned char and is only being used to read hardware
registers which are expected in sdio_read_byteb function as u8.
Change 'byte' variable type to u8 which is preferred.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 449f9eef 13-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: remove no necessary blank line

There was two blank lines between definitions and statements
in ks7010_upload_firmware function. Remove one of them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c6b7591 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change local variable type in ks_wlan_hw_rx

Local variable event in ks_wlan_hw_rx function is declared
as unsigned short and can be declared as u16 which is preferred
style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f0d5a975 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: refactor ks7010_sme_enqueue_events function

Event to send to init the card are always the same so change
code to be more readable putting them into an array and
enqueuing also using a for loop.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 58f8128e 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change local variable type in ks7010_sdio_init_irqs

Local variable 'byte' in ks7010_sdio_init_irqs is declared as
unsigned char and can be declared as u8 which is preferred.
It is being used in calls to ks7010_sdio_writeb which is already
expected an u8.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 29699193 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change some local variables type in ks_sdio_interrupt

Local variables 'status', 'rsize' and 'byte' are declared as
unsigned char and can be declared as u8 which is preferred.
They are being used in ks7010_sdio_readb calls which is already
expected an u8.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a51333d1 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change local variable type in ks7010_rw_function

Local variable 'byte' in ks7010_rw_function is declared as unsigned
char and can be declared as u8 which is preferred. It is being used
in ks7010_sdio_readb which is already expecting an u8.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9d418fa8 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change local variable type in _ks_wlan_hw_power_save

Local variable 'byte' in _ks_wlan_hw_power_save function is declared
as unsigned char and can be declared as u8 which is preferred. It
is being using with ks7010_sdio_readb which expects u8 already.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 49705f9a 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: use u8 instead of unsigned char in write_to_device function

Parameter buffer in write_to_device function is declared as
a pointer to unsigned char and can be declared as an u8 type
which is preferred. Internally it calls to ks7010_sdio_write
which is using also u8 as parameter type. Update calls to this
function as well.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 832ec535 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change netdev_dbg msg to avoid a long line

This commit avoids a long line changing a bit message in
_ks_wlan_hw_power_save function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 07511629 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: avoid ks_sdio_card dependency in ks_wlan header

ks_wlan_private struct has a pointer to struct ks_sdio_card in its
fields. Because of that a forward declaration in needed in ks_wlan.h
header and also it makes necessary to have ks_sdio_card public in
a ks7010_sdio.h header. Changing this pointer into a void pointer
makes no longer necessary to have ks7010_sdio.h header as well as
removes the forward dependency in ks_wlan.h. Declaration of
ks_sdio_card has been moved to ks7010_sdio.c source file and To make
code cleaner inside this file a new ks7010_to_func function has been
added. The code has been updated to this changes.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 57c6f08d 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: move tx and rx queues definitions into ks_wlan.h header

There are some definitions for rx and tx queues in ks7010_sdio
which is not the best place to put them. Changing them into the
ks_wlan header file there is no need to explicity include ks7010_sdio.h
which makes no sense at all and can be resolved easily using
forward declarations. The functions related with the queues circular
buffers have been moved also into this header.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a0a954b1 03-May-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: add SPDX identifiers to all files

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Fix up the all of the staging ks7010 files to have a proper SPDX
identifier, based on the license text in the file itself. The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.

Extra GPL text wording can be removed as it is no longer needed at all.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 06176b87 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: assign dev_alloc_name() result to variable before check it

This commit assigns dev_alloc_name() call to 'ret' variable to
check it after instead of check directly the call in the if
condition. This improves a bit readability. It also add an empty
line before the new assignment to separate it from the previous
check statement block.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a7360b18 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: use u8 instead of unsigned char for firmware buffers

This commit replaces type unsigned char which is the one which
is being used for firmware buffers with u8 type which is preferred.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0cc053dd 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: fix error paths in ks7010_sdio_remove function

This commit reviews and fixes error paths in ks7010_sdio_remove
driver function. It change logic to handle error directly
after priv dereference to avoid one level indentation. It also
removes a temporal netdev variable which wasn't being used in all
of the function calls. Also if send_stop_request call fails it
was making a direct 'return' instead of doing a properly cleaning.
Because of this a new 'err_free_card' label has been added.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 31d7b1b1 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: check sdio_set_block_size return value

This commit checks sdio_set_block_size function return value.
If it fails abort driver initialization.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4487cf88 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: replace create_workqueue with alloc_workqueue

This commit replaces deprecated create_workqueue call with the
alloc_workqueue one which is the one to be used now for this
purpose.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 78c74a5f 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: move MODULE_DEVICE_TABLE related code

This commit moves MODULE_DEVICE_TABLE related code to the end of
the file. This is not necessary at all but moving it just before
its use improves readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7570d757 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: avoid one extra level indentation in ks_wlan_hw_rx function

This commit use an and operator in a if condition to avoid one
indentation level which is not needed at all.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 156f2703 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: review debug and error messages in ks7010_sdio source

This commit reviews debug and error messages in code located
in ks7010_sdio source file avoiding to use 'error' or 'ks7010'
because this file is using netdev_* functions and has non
sense to repeat information in log messages.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 004e43c2 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: review comment style in ks7010_sdio source file

This commit reviews comment style used in ks7010_sdio source file
in order to be coherent with the rest of the code. Most comments
in this source are before definitions but only two of them have
been written at the right. So, be coherent moving this two to the
top of definitions. Also fix one multiline comment style to use
the normal preferred kernel style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a704a1bc 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: add REG suffix to sdio register definitions

This commit adds REG suffix to register definitions related
with SDIO in order to improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b60f5f06 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: delete not used definitions in ks7010_sdio source

This commit removes two definitions inside ks7010_sdio source file
because they are not being used at all.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 48ecb225 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: move sdio specific register definitions into source file

This commit moves SDIO related register definitions from header
to source file. There is no need to have those into the header
because they are only being used in specific SDIO code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2c54ee54 23-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: move ROM_FILE definition into source file

This commit moves ROM_FILE from header to source file because
there is not being used outside this.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2c3f8945 18-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: init local variables when they are declared in ks7010_sdio_probe

This commit change init point of two variables to forward them to
init time. This variables are just being assigned some lines after
and it is more clear to init them when the init value is known and
in this case this is known when they are declared.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fa3fd846 18-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: review includes of ks7010_sdio file

This commit reviews includes of ks7010_sdio.c source
file removing those which are not being used at all.
Kernel header includes have been ordered alphabetically
also.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 549f625c 18-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: review includes of ks_wlan.h file

This commit reviews includes of ks_wlan.h header file.
It removes those which are not being used at all. It
also reorder remaining ones in alphabetical order.
The linux/module.h include file has been moved to the
correct file which is ks7010_sdio.c in order to be able
to compile the driver without problems.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e6bc5053 15-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

This commit replace current custom implementation of some circular
buffer head and tail logic in favour of the use of macros defined
in linux circ_buf.h header. Queue related inline function names
have been review also.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6adc30b1 06-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: use msecs_to_jiffies in ks7010_rw_function function

This commit replaces custom time calculations done in ks7010_rw_function
with msecs_to_jiffies() function which has the same behaviour.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e0ba53a4 06-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: change sdio related read/write function parameter types

This commit reviews and changes SDIO related read and write
functions parameter types to use the preferred u* kernel types.
Also length parameter which was defined as int has nonsense
because calls to this functions are called useing an unsigned
instead. Because of this length parameters have been changed
also into unsigned int.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7dd51ea1 06-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: fix remaining long line warnings in ks7010_sdio source

This commit fixes remaining checkpatch warnings because of
the use of lines longer than 80 characters in ks7010_sdio
source file. After this clean, this file has no remaining
warnings around.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e4844d6f 06-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: remove nonsense comment

This commit removes a comment which has nonsense because
it is obvious what the code does just reading SET_NETDEV_DEV
declaration. This also fixes a checkpatch warning because a
line longer than 80 characters.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9962d86d 12-Apr-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

staging: ks7010_sdio: fix NULL pointer dereference and memory leak

priv is being explicitly dereferenced when it is still null, when
jumping to goto label err_free_netdev, before it is properly
updated with a valid memory address.

Also, when this happens, memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv)) is not being free'd before
return, hence there is a memory leak.

The current code looks a bit too complicated and can be replaced
by just directly freeing netdev before return.

Notice that card->priv = NULL isn't required because the next thing
we do to card is kfree(card).

Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 95751f19 10-Apr-2018 Jia-Ju Bai <baijiaju1990@gmail.com>

staging: ks7010: Replace mdelay with usleep_range in ks7010_upload_firmware

ks7010_upload_firmware() is never called in atomic context.

The call chain ending up at ks7010_upload_firmware() is:
[1] ks7010_upload_firmware() <- ks7010_sdio_probe()

ks7010_sdio_probe() is set as ".probe" in struct sdio_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, ks7010_upload_firmware()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 47bda74a 05-Apr-2018 Ji-Hun Kim <ji_hun.kim@samsung.com>

staging: ks7010: replace kmalloc() + memcpy() with kmemdup()

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bd6dad98 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: fix some style issues about long lines

This commit just fixes some checkpatch reported issues about
lines longer than 80 characters.

A new blank line has been added also to improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 67082c22 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: ks7010: factor out firmware copy process into ks7010_copy_firmware

This commit extracts firmware copy process into a new function
ks7010_copy_firmware. Because rom_buf is only needed for this
process, memory request for it has been also moved to this new
function so the error handling label release_host_and_free has
been renamed to release_host into ks7010_upload_firmware original
function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6e043704 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: fix error handling in ks7010_upload_firmware

This commit checks missing error code check when checking
if the firmware is running reading General Communication
Register A (GCR_A).

It also set ret to EBUSY if firmware is running before
copying it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6e6156f6 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: factor out initial enqueue process into ks7010_sme_enqueue_events

This commit extract initial enqueue process into a new
ks7010_sme_enqueue_events function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5df835e8 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: factor out ks_wlan_private init process into ks7010_private_init

This commit extract ks_wlan_private initialization process
into a new function ks7010_private_init to improve a bit
readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8d4ab8f7 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: factor out irq setup process to ks7010_sdio_setup_irqs

This commit extract sdio irq setup process into a new
function ks7010_sdio_setup_irqs to improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f4f54056 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: fix label to jump to in error case

This commit fixs the label to jump to when in case
an error occurs disabling interrupts. At this point
of the code sdio_enable_func() function has been
successfully called.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0e80e31a 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: factor out irq enable process to ks7010_sdio_init_irqs

This commit extracts sdio irq enable process to a new function
ks7010_sdio_init_irqs to improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cea78d61 03-Apr-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: remove unnecessary 'out of memory' message

This commit removes unnecessay out of memory message
fixing the following checkpach.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9f2ae0a4 31-Mar-2018 Quytelda Kahja <quytelda@tamalin.org>

staging: ks7010: Remove trailing _t from 'struct hostif_stop_request_t'.

The "_t" suffix is not needed for structure names in this driver, and is a
reflection of an older typedef system that is no longer in place. Replace
all occurences of 'struct hostif_stop_request_t' with 'struct
hostif_stop_request'.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b1e04ba0 29-Mar-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: replace IS_HIF_CONF with inline function

This commit replaces IS_HIF_CONF macro with is_11b_rate inline
function to improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 31ce0d86 20-Mar-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: replace KS_WLAN_DEBUG with DEBUG preprocessor directive

This commit replaces custom KS_WLAN_DEBUG which is not being used anymore
in favour of DEBUG which is the one included when debugging is enabled.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5259b329 15-Mar-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: replace DPRINTK traces in favour of netdev_*

This commit removes custom defined DPRINTK macro and replaces all the
associated debug and other traces for preferred ones netdev_*.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7acf4002 15-Mar-2018 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: remove useless DPRINTK traces

This commit removes some useless traces in some source files

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2ec999e5 19-Feb-2018 Quytelda Kahja <quytelda@tamalin.org>

Staging: ks7010: sdio: Convert RX/TX queue macros into real functions.

Convert the unsafe macros into inline functions.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aef0278e 30-Aug-2017 Jonathan Whitaker <jon.b.whitaker@gmail.com>

staging: ks7010: Fix coding style and remove checkpatch.pl warnings.

Removed printk statements for debugging. The same information can be
acquired via ftrace, so these print statements are uneccessary.

Signed-off-by: Jonathan Whitaker <jon.b.whitaker@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d9d1ffd4 29-Apr-2017 Cezary Gapinski <gapalinux@gmail.com>

staging/ks7010: Fix type assignment for struct hostif_hdr

Sparse spits out a warnings about __le16 and unsigned short assignment.
Change the type of size and event members of struct hostif_hdr
to __le16 and correct conversion to the proper cpu type.

Signed-off-by: Cezary Gapinski <gapalinux@gmail.com>
Reviewed-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8fb8e05c 26-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 0e24eb8a 26-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 7c1c4361 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# f1e79f4b 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# a9d58d9a 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 132f5415 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 0dd30a74 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# e61e73d7 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 18bd6dd1 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 321dabdc 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 055da4f9 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# bfee6a23 17-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 4f22b895 11-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# cf10e78e 11-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# fa125ae4 11-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# 2ab6fd59 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

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>


# f8641485 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: fix function return code path

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>


# 482c03c7 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: separate dissimilar checks

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>


# fa740a9e 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: change static function return type

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>


# 638a75b6 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: invert conditional, reduce indentation

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>


# f7172487 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: rename identifier retval to ret

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>


# 03b02449 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: rename identifier rc to ret

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>


# 881f76b9 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: change length type to unsigned

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>


# 5141e9c6 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove void * cast

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>


# ed246b9e 09-Apr-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove unnecessary function parameter

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>


# ddd10774 22-Mar-2017 Xiangyang Zhang <xyz.sun.ok@gmail.com>

staging: ks7010: fixed a coding style issue

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>


# 310e916f 21-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: add explicit check to 'size' variables

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>


# 58af272b 21-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: fix memcmp() bug

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>


# 1770ae9d 20-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: rename return value identifier

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>


# c133b9bd 20-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove non-zero comparison

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>


# f283dd69 20-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: make goto labels uniform

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>


# 13b05e46 20-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: return directly on error

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>


# 44c3cd5e 20-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT

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>


# 6cdd6538 14-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove dead code

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>


# aa6ca807 14-Mar-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove custom return values

Driver code uses custom return values (often positive) to signal error
condition instead of using standard kernel error codes.

Replace custom return values with standard kernel error codes.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 83e4e8d2 09-Mar-2017 Arushi Singhal <arushisinghal19971997@gmail.com>

staging: ks7010: removed code in comments.

Commenting Code Is a Bad Idea.
Comments are their to explain the code and how the code achieves its
goal and as codes in the comments does not explain what the code is
doing so there is no use of commenting them.
So in this patch codes in the comments are removed.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dad5980e 26-Feb-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: refactor function call parameters

Function call parameters are split over more lines than
necessary. Also assignment statements are split after the '=' sign.
This adds extra lines to the function and may also reduces
readability.

Refactor function call parameters and reduce the number of lines
used. Put assignment statements onto single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3188bc09 26-Feb-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: remove switch statement

Switch statement uses one [trivial] case and a default case holding
bulk of code. We can swap the switch statement with an if/return
statement as replacement for the original switch. This can be done
without changing the program logic.

Remove switch statement. Use original switch parameter as conditional
and return if conditional evaluates to true. Reduce level of
indentation. Do not change the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cf57e659 26-Feb-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: move logic operator to end of line

Logic operator (&&) is place at the start of the line. Kernel
standards suggest that logical operators should be placed at the end
of the line.

Move logical operator 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>


# 9f9d7030 26-Feb-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: fix checkpatch MULTILINE_DEREFERENCE

Checkpatch emits WARNING: Avoid multiple line dereference.

Move dereference onto single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d5f1db31 26-Feb-2017 Tobin C. Harding <me@tobin.cc>

staging: ks7010: invert conditional, reduce indent

Function _ks_wlan_hw_power_save has 5 levels of indentation. Reducing
the amount of indentation may make code clearer to read. Also a number
of other checkpatch warnings may be removed if we first reduce the
level of indentation in this function.

Invert conditional and return from function if new conditional
evaluates to true. Repeat on subsequent conditional. Reduce
indentation without changing the program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d9eb4861 16-Feb-2017 Shiva Kerdel <shiva@exdev.nl>

Staging: ks7010: ks*: Remove redundant blank lines

Multiple blank lines shouldn't be used.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 20358d13 21-Oct-2016 Nick Rosbrook <nrosbrook@mail.smcvt.edu>

staging: ks7010: ks7010_sdio.c: Fixing multiple assignments

Running checkpatch on ks7010_sdio.c shows two locations where
multiple assignment statements are used.

This patch modifies the assignments into single assignments.

Signed-off-by: Nick Rosbrook <nrosbrook@mail.smcvt.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f3f2d351 20-Oct-2016 Nick Rosbrook <nrosbrook@mail.smcvt.edu>

staging: ks7010: Corrected a spelling mistake

This patch corrects the spelling of 'initialize' in ks7010_sdio.c.

The issue was found by checkpatch.

Signed-off-by: Nick Rosbrook <nrosbrook@mail.smcvt.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0966c755 19-Oct-2016 Nick Rosbrook <nrosbrook@mail.smcvt.edu>

staging: ks7010: Add spaces around '*'

Added spaces around a '*' in ks7010_sdio.c. Issue found by checkpatch.

Signed-off-by: Nick Rosbrook <nrosbrook@mail.smcvt.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 71a476e4 09-Oct-2016 Akshay Mariyanna <akmlkcc@gmail.com>

staging: ks7010: fix space related style issues in ks7010_sdio.c

This fixes the following checkpatch warnings:
WARNING: Unnecessary space before function pointer arguments
WARNING: unnecessary whitespace before a quoted newline

Signed-off-by: Akshay Mariyanna <akmlkcc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4fdaa0d7 09-Oct-2016 Akshay Mariyanna <akmlkcc@gmail.com>

staging: ks7010: fix indent style in ks7010_sdio.c

This patch fixes the following checkpatch error:
ERROR: code indent should use tabs where possible

Signed-off-by: Akshay Mariyanna <akmlkcc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0af45479 06-Oct-2016 Pontus Fuchs <pontus.fuchs@gmail.com>

staging: ks7010: Remove unnecessary cast

sdio functions takes unsigned int as address. No need to cast.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 697f9f7f 03-Oct-2016 Muraru Mihaela <mihaela.muraru21@gmail.com>

Staging: ks7010: add blank line after declaration

This patch fixes a coding style WARNING:
Missing a blank line after declaration, found by checkpatch.pl.
By adding a blank line after declaration of a variable.

Signed-off-by: Muraru Mihaela <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4433459a 27-Sep-2016 Sergio Paracuellos <sergio.paracuellos@gmail.com>

staging: ks7010: declare private functions static

Private functions in ks7010_sdio.c can be declared static.

Fixes sparse warnings 'was not declared. Should it be static?'.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9887b5e5 26-Sep-2016 Sabitha George <sabitha.george@gmail.com>

staging: ks7010: Fix warnings on printk() usage

This patch fixes the following warnings on ks7010_sdio.c
1. printk() should include KERN_ facility level
2. Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

Signed-off-by: Sabitha George <sabitha.george@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7d359a84 21-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove unnecessary variable used to store return value

This patch removes an unnecessary variable used to store return values
in order to reduce memory usage.
Done using coccinelle:
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
return
- ret
+ C
;

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d738bd2 20-Sep-2016 Sandhya Bankar <bankarsandhya512@gmail.com>

Staging: ks7010: Use sizeof structure *pointer over sizeof structure in kzalloc()

This issue was found by checkpatch.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cbb351cc 17-Sep-2016 Sandhya Bankar <bankarsandhya512@gmail.com>

Staging: ks7010: Drop memory allocation cast.

Drop cast on the result of kzalloc.

The semantic patch that makes this change is as follows:

@@
type T;
@@
- (T *)
(\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 149ad082 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove extra round braces around expressions/variables

This patch removes excess round braces around expressions/variables.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ca476515 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove the space after a type cast

The patch removes an unnecessary space after a cast, as detected by
checkpatch.pl.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7333c6fd 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove unnecessary blank lines and commented code

The patch removes unnecessary blank lines as detected by checkpatch.pl. Also,
it removes a commented line of unrequired code.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3d4a2cac 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove space after '(' and before ')'

The patch fixes the following errors detected by checkpatch.pl:
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 53638cef 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove braces following single statement blocks

The patch removes braces {} for single statement blocks, as suggested by
checkpatch.pl.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 041c4d75 17-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Use #include <linux/atomic.h> instead of <asm/atomic.h>

This patch replaces <asm/atomic.h> with <linux/atomic.h>, as suggested
by checkpatch.pl.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c8abeaf8 14-Sep-2016 Rehas Sachdeva <aquannie@gmail.com>

staging: ks7010: Remove whitespace before newline

This patch fixes the checkpatch.pl warning:
WARNING: unnecessary whitespace before a quoted newline.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c7e65f4d 12-Sep-2016 sayli karnik <karniksayli1995@gmail.com>

staging: ks7010: Remove the explicit NULL comparison

The patch removes the explicit null comparisons entirely for the ks7010 driver.
This was detected by checkpatch.pl

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f5dc9399 05-Sep-2016 Hariharan R <hariharanrangasamy@gmail.com>

staging: ks7010: fix warning on return for void functions

This patch fixes the checkpatch warning in ks7010_sdio.c
'void function return statements are not generally useful'

Signed-off-by: Hariharan R <hariharanrangasamy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b80cfea2 04-Sep-2016 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

staging: ks7010: fix memory leak

If the firmware request failed we were just returning but we missed
freeing the memory and releasing the MMC Host.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 369e1b69 04-Sep-2016 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

staging: ks7010: return on failure

On failure we were jumping to error_out0 where we were trying
sdio_release_host() but at this point of execution we still have not
done sdio_claim_host() and as a result host->claimed can still be 0.
And if host->claimed is 0 then WARN_ON(!host->claimed) will give
a warning.
Moreover, if it is still not claimed then mmc_host->claim_cnt will be 0
and mmc_release_host() will do "if (--host->claim_cnt)" and thus the
condition will become true.
Lets just return the value on allocation failure instead of trying to
release the host before claiming it.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 803394d0 13-Aug-2016 Colin Ian King <colin.king@canonical.com>

staging: ks7010: do not dereference priv if priv is null

priv is being dereferenced before a check for it being null
is made, so there is a possibililty a null pointer deference
can occur. Instead, only dereference priv if it is non-null.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 695872ea 17-Jul-2016 Markus Elfring <elfring@users.sourceforge.net>

staging: ks7010: Delete a variable in write_to_device()

The local variable "rc" was assigned a zero at one place.
But it was not read within this function. Thus delete it.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# eeed92c0 17-Jul-2016 Markus Elfring <elfring@users.sourceforge.net>

staging: ks7010: Delete unnecessary assignments for buffer variables

A few variables were assigned a null pointer despite of the detail
that they were immediately reassigned by the following statement.
Thus remove such unnecessary assignments.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 58043f25 17-Jul-2016 Markus Elfring <elfring@users.sourceforge.net>

staging: ks7010: Delete unnecessary checks before the function call "kfree"

The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6634cff1 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: report interface as wlan not eth

Until we switch to cfg80211 (if ever), we must do this manually.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3fb54d75 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: bail out when registering netdevice fails

There is no need to continue then. Also, this enables us to remove an
ugly static variable.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4c0d46d2 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: sdio: remove forward declarations

Move read/write functions to the top and driver struct to the end, so we
can remove all forward declarations.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c4730a92 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: unify naming to ks7010

No 79xx anymore, this is confusing. Add a comment saying that old
versions were probably named 7910/79xx.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f9b5bd05 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: export sdio ids

So the module will be loaded automatically on card insertion. Rename the
array while here.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1c013a5c 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

staging: ks7010: collect all includes and sort them

Includes probably need a driver-wide clean up, but for now let's at
least group all includes from the sdio file together.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 30776cf9 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

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>


# 6ee9169b 17-Jun-2016 Wolfram Sang <wsa@kernel.org>

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>


# c5d9a030 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

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>


# 9adca34b 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

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>


# 6b0cb0b0 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: simplify module_init/exit

The printouts are not needed, the driver core has enough debug output
for this if wanted. So, use a helper to save boilerplate code.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e1240140 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: fix module annotations

List all authors, beautify description, match license to what is stated
in file headers, add firmware information.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2801d7a2 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: remove supported card table with one element

There is only this card supported, no need to iterate over the table.
The resulting firmware filename wasn't used anyway, but came from the
config file or hardcoded default.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cdf6ecc5 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: indent ks7010_sdio.c

Unlike the previous patches which are plain indent outcomes, this has
some manual fixups to be not overly strict with the 80 char limit.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# feedcf1a 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

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>


# f8d72df8 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: fix printk format warnings

Use proper type for size_t.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 564efd79 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

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>


# 3215bb1a 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: use kernel helper to print buffer

No need for an open coded one.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e8593a8a 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: avoid workqueue races

My Spectec SDW823 card oopsed when it was already inserted during boot.
When debugging this, I noticed that the card init was done in a seperate
workqueue which was only activated once in probe. After removing the
workqueue and calling the card init directly from probe, the OOPS went
away. It turned out this is the same OOPS which happened when removing
the card, so this seems possible now. Note: There is still a
not-understood card-removed event during boot, but at least it doesn't
crash anymore and the card will be re-probed right away.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c3fe667f 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

staging: ks7010: remove custom firmware loader

FW_LOADER works fine, no need for a open coded fallback.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 13a9930d 30-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

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>