Commit graph

84 commits

Author SHA1 Message Date
Muraru Mihaela
6315bbdb59 Staging : ks7010 : Fix block comments warninig
Move final */ to a new line, to conform to
the kernel coding style for block comments.

Issue found by checkpatch.

Signed-off-by: Muraru Mihaela <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 17:29:11 +02:00
Sergio Paracuellos
4433459a49 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>
2016-09-28 11:33:52 +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
Sabitha George
9887b5e51f 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>
2016-09-27 13:03:58 +02:00
Georgiana Rodica Chelu
03806ab307 staging: ks7010: ks_wlan_net: Use netdev_info instead of printk
Pass the net_device structure to print_hif_event function
in order to use netdev_info instead of printk.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 13:03:57 +02:00
Georgiana Rodica Chelu
c8be646105 staging: ks7010: ks_wlan_net: Use netdev_ instead of printk
The checkpatch.pl script found the following warning:

WARNING: printk() should include KERN_ facility level

After adding the KERN_ facility level to printk(), the script showed
another warning:

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...

The warning is similar for KERN_ERR and KERN_DEBUG. In conclusion,
use netdev_info(), netdev_err() or netdev_dbg() when there is
a netdev device.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 13:03:57 +02:00
Georgiana Rodica Chelu
7a4abee97f staging: ks7010: ks_wlan_net: Remove return statement from void function
Remove the return statement from the end of a void function
to clean up the code.

Issue found by checkpatch.pl script.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-25 12:37:14 +02:00
Georgiana Rodica Chelu
55adb7bf5a staging: ks7010: ks_wlan_net: Remove unnecessary variable used to store return value
Remove unneeded code in order to make clear
that the function returns 0(success) in all cases.

Done using returnvar.cocci script.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-25 12:37:14 +02:00
Baoyou Xie
e4e8d968a3 Staging: ks7010: remove unused function in ks_wlan_net.c
We get 1 warning when building kernel with W=1:
drivers/staging/ks7010/ks_wlan_net.c:3520:5: warning: no previous prototype for 'ks_wlan_reset' [-Wmissing-prototypes]

In fact, these functions are unused in
ks_wlan_net.c, but should be removed.

So this patch removes the unused function.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-23 19:00:59 +02:00
Johan Svensson
d30924a032 staging: ks7010: add blank line after variable declarations
Fixes warnings found by checkpatch
Missing a blank line after declarations

Signed-off-by: Johan Svensson <johan.svensson692@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-23 14:14:01 +02:00
sayli karnik
7d359a847c 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>
2016-09-22 11:54:48 +02:00
Sandhya Bankar
7e935f181c Staging: ks7010: michael_mic: Use "foo *bar" instead of "foo * bar".
This issue was found by checkpatch.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:56:17 +02:00
Sandhya Bankar
d14d3557cb Staging: ks7010: Use "foo *bar" instead of "foo * bar".
This issue was found by checkpatch.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:56:17 +02:00
Sandhya Bankar
55d6aacd43 Staging: ks7010: Use "foo *bar" instead of "foo * bar"
This patch was found by checkpatch.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:56:17 +02:00
Sandhya Bankar
2d738bd28c 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>
2016-09-20 13:56:17 +02:00
sayli karnik
0525a57b18 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>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:56:17 +02:00
Hariharan R
197cc86e8e staging: ks7010: fixes typo in ks_hostif.c
Fixes typo,
FAILUER -> FAILURE
Recieve -> Receive

Signed-off-by: Hariharan R <hariharanrangasamy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:53:57 +02:00
Sandhya Bankar
cbb351ccdf 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>
2016-09-18 12:38:27 +02:00
sayli karnik
149ad082a2 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>
2016-09-18 12:36:04 +02:00
sayli karnik
ca4765152e 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>
2016-09-18 12:36:04 +02:00
sayli karnik
7333c6fd43 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>
2016-09-18 12:36:03 +02:00
sayli karnik
3d4a2cacc4 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>
2016-09-18 12:36:03 +02:00
sayli karnik
53638cef86 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>
2016-09-18 12:36:03 +02:00
sayli karnik
041c4d754a 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>
2016-09-18 12:36:03 +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
Bhumika Goyal
30b48e2dbe Staging: ks7010: Replace memset with eth_zero_addr
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Coccinelle was used to do the replacement and add the
header file linux/etherdevice.h if not already present.
Script:
@header@
@@
#include <linux/etherdevice.h>

@r1@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@includeheader depends on r1 && !header@
@@
+ #include <linux/etherdevice.h>
#include <...>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-17 23:32:13 +02:00
Wei Yongjun
e30ed33d19 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-09-16 09:58:50 +02:00
sayli karnik
a1a736df3a staging: ks7010: Remove the explicit cast on kmalloc
The assignment operator implicitly converts a void pointer to the type of the
pointer it is assigned to. Hence an explicit cast on the result of the kmalloc
function is not required.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-16 09:58:50 +02:00
Rehas Sachdeva
c8abeaf802 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>
2016-09-16 09:58:49 +02:00
sayli karnik
c7e65f4d2f 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>
2016-09-13 15:01:29 +02:00
Colin Ian King
aeaf5d86fa staging: ks7010: fix two memory leaks on error return path
On the error case where there is an invalid MAC address there is
memory leak on packet and pp on the error return. Free these first
before returning to fix the leak.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12 11:19:42 +02:00
Colin Ian King
8defffb208 staging: ks7010: avoid dereferencing packet if it is null
Updating tx_bytes from packet->len if packet is null will cause
a null pointer dereference, so only update tx_bytes if it packet
is not null.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12 11:18:15 +02:00
Hariharan R
f5dc9399c0 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>
2016-09-12 11:18:15 +02:00
Sudip Mukherjee
b80cfea24b 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>
2016-09-12 11:01:52 +02:00
Sudip Mukherjee
369e1b69c1 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>
2016-09-12 11:01:52 +02:00
Colin Ian King
95d2a32466 staging: ks7010: don't print skb->dev->name if skb is null
A null pointer dereference will occur when skb is null and
skb->dev->name is printed.  Replace the skb->dev->name with
plain text "ks_wlan" to fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:12:57 +02:00
Nicholas Mc Guire
9afe11e956 staging: ks7010: declare private functions static
Private functions in ks_hostif.c can be declared static.

Fixes: 13a9930d15 ("staging: ks7010: add driver from Nanonote extra-repository")

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:12:57 +02:00
Nicholas Mc Guire
9d29f14db1 staging: ks7010: fix wait_for_completion_interruptible_timeout return handling
wait_for_completion_interruptible_timeout return 0 on timeout and
-ERESTARTSYS if interrupted. The check for
!wait_for_completion_interruptible_timeout() would report an interrupt
as timeout. Further, while HZ/50 will work most of the time it could
fail for HZ < 50, so this is switched to msecs_to_jiffies(20).

Fixes: 13a9930d15 ("staging: ks7010: add driver from Nanonote extra-repository")

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:12:57 +02:00
Colin Ian King
803394d03b 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>
2016-08-15 16:35:13 +02:00
Bing Sun
6bef3f0139 Staging: ks7010: michael_mic: fixed macros coding style issue
Fixed coding style issue:
Enclose multiple statements macros definition in a do while loop.
Use one space around binary operators.

Signed-off-by: Bing Sun <sunbing@redflag-linux.com>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15 16:35:13 +02:00
Markus Elfring
695872eae5 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>
2016-08-15 16:34:18 +02:00
Markus Elfring
eeed92c0c0 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>
2016-08-15 16:34:18 +02:00
Markus Elfring
58043f2527 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>
2016-08-15 16:34:18 +02:00
Dan Carpenter
453e102db5 staging: ks7010: remove bogus NULL checks
enc->rx_seq[] and enc->key[] are arrays, not pointers and they can't be
NULL.  Let's remove these NULL checks.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18 19:47:00 -07:00
Wolfram Sang
516a4f04a3 staging: ks7010: drop private handler for driver version
We are upstream now, we don't need seperate driver versioning.

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
6634cff1b5 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>
2016-06-18 19:45:55 -07:00
Wolfram Sang
3fb54d7590 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>
2016-06-18 19:45:55 -07:00
Wolfram Sang
4c0d46d2cf 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>
2016-06-18 19:45:55 -07:00
Wolfram Sang
c4730a9276 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>
2016-06-18 19:45:55 -07:00
Wolfram Sang
f9b5bd05a1 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>
2016-06-18 19:45:55 -07:00