staging/dgap: Use strpbrk() instead of dgap_sindex()
The <linux/string.h> provides strpbrk() function that does
the same that the dgap_sindex(). Let's use already defined
function instead of writing custom.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The return pointer from dgap_getword() is used in strcmp() where it is
dereferenced. But dgap_getword() can return NULL.
Lets put a check there and return 0 as error.
As a result, four global variable causes defined but not used compile warnings.
So just remove unused varialbs g_seqno, g_wid_num, Res_Len and g_oper_mode.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Thu, 10 Sep 2015 09:26:29 +0000 (18:26 +0900)]
staging: wilc1000: remove unused enum
This patch removes a unused enum tenuFrameClass.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Cho [Thu, 10 Sep 2015 09:26:28 +0000 (18:26 +0900)]
staging: wilc1000: remove unused global variables
This patch removes the followings from the driver because they are in
debugging purpose but not used anymore.
- int_clrd
- int_rcvdU
- int_rcvdB
- android_wifi_priv_cmd structure
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Cho [Thu, 10 Sep 2015 09:26:27 +0000 (18:26 +0900)]
staging: wilc1000: remove firmware definition
This patch removes the firmware definitions, STA_FIRMWARE, AP_FIRMWARE, and
P2P_CONCURRENCY_FIRMWARE from the linux_wlan.c file because they are
defined in the Makefile.
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Thu, 10 Sep 2015 03:03:05 +0000 (12:03 +0900)]
staging: wilc1000: delete wilc_memory.c and wilc_memory.h
The macro WILC_MALLOC is not used in the driver anymore, so just
delete files.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Thu, 10 Sep 2015 03:03:04 +0000 (12:03 +0900)]
staging: wilc1000: remove kmalloc wrapper
This patch calls kmalloc() directly. No need to wrap kmalloc().
All is not holding a spin lock or in interrupt context. So use GFP_KERNEL
flag for kmalloc.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)
The values used are stored as dev_addr in net_device (declared in
include/linux/netdevice.h) and sa_data in sockaddr (declared in
include/linux/socket.h). Both these elements are u16 aligned as
shown by using pahole (position must be a multiple of sizeof(u16)):
unsigned char * dev_addr; /* 888 8 */
char sa_data[14]; /* 2 14 */
It is thus safe to use ether_addr_copy() instead of memcpy() for
that call, as it is already done in multiple files in the Linux
kernel sources:
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/ezchip/nps_enet.c
drivers/net/ethernet/ibm/ibmveth.c
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/usb/lan78xx.c
net/8021q/vlan_dev.c
net/batman-adv/soft-interface.c
net/dsa/slave.c
Using strcpy() is a security risk as the destination buffer size is not
checked and we may over-run the buffer. Use strncpy() instead, while
mentioning the buffer size leaving place for the NULL termination.
If lov_sub_get() fails then it returns the error code in ERR_PTR, but
here we were dereferencing sub without checking if lov_sub_get() has
actually succeeded or not. And on error we can directly return the error
code from lov_io_fault_start() as it return 0 on success and the error
code on error.
Staging: lustre: obdclass: Remove typedefs for struct
The Linux kernel coding style guidelines suggest not using typedefs for
structure and enum types. This patch gets rid of the typedefs for
lu_site_stats_t.
The following Coccinelle semantic patch detects the cases for struct type:
Staging: lustre: libcfs: Remove typedefs for struct
The Linux kernel coding style guidelines suggest not using typedefs for
structure and enum types. This patch gets rid of the typedefs for
cfs_wi_sched_t.
The following Coccinelle semantic patch detects the cases for struct type:
Tony Cho [Tue, 8 Sep 2015 08:08:01 +0000 (17:08 +0900)]
staging: wilc1000: add maintainers for Atmel 802.11 driver
This patch adds new maintainers who develops new design for Atmel 802.11
link controller and deletes Dean Lee who cannot maintain the wireless
driver anymore.
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Johnny Kim [Tue, 8 Sep 2015 08:08:00 +0000 (17:08 +0900)]
staging: wilc1000: remove meaningless line
The current driver is calling skb_reserve function to align memory in
frmw_to_linux function. However, the wrong value is used as the input argument.
Besides, the process is not necessary because the address already is algined
in dev_alloc_skb function. So, this patch removes the line for dummy headroom.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds new define, IDLE_MODE to change comparison statement which
is wrong due to typecasting to null.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Cho [Mon, 7 Sep 2015 10:09:31 +0000 (19:09 +0900)]
staging: wilc1000: fix potential memory leak
This patch adds kfree(mgmt_tx) when memory allocation of mgmt_tx->buff
fails in the second calls of kmalloc() to avoid the memory leak from mgmt_tx
first allocated before the second calls of kmalloc().
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Chris Park <chirs.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrapper around usleep_range()
Just call the function directly, no need for the indirection.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If memdup_user() fails then it will return the error code in ERR_PTR. We
were checking it with IS_ERR but then again trying to free it on the
error path.
Johnny Kim [Thu, 20 Aug 2015 07:32:52 +0000 (16:32 +0900)]
staging: wilc1000: use id value as argument
The driver communicates with the chipset via the address of handlers
to distinguish async data frame. The SendConfigPkt function gets the
pointer address indicating the handlers as the last argument, but this
requires redundant typecasting and does not support the 64 bit machine.
This patch adds the function which assigns ID values instead of pointer
representing the driver handler to the address and then uses the ID
instead of pointer as the last argument of SendConfigPkt. The driver
also gets the handler's address from the ID in the data frame when it
receives them.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the spinlock functions directly, no need for the indirection.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrappers around semaphore usage
Just call up/down directly, no need for a wrapper function that hides
what is really happening. Fix up some variable types to be the correct
structure pointers, not void *.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrappers around sema_init()
Just call the function directly. Also remove a pointless "deinit"
function that was empty to match the init function.
This also fixes a bug where txq_add_to_head_cs was a mutex structure
being used as a semaphore. See the fun things that happen when you use
void pointers instead of "real" types? Amazing that this worked at all,
someone got _very_ lucky. Whoever "Amr" is, they really didn't fix
BugID_4720 correctly :(
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrapper around spin_lock_init()
It's only called once, so just call the real function. Also remove the
empty "deinit" function that didn't do anything.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the functions directly. Also fix the variable types to be
correct, not void *, so we have a semblance of type safety happening
now.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the function, no need for a pointer to a function that calls
the function.
turtles, all the way down...
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It isn't needed, and we were checking if a buffer was not NULL multiple
times, no one had ever looked at the code :(
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove another useless kmalloc wrapper
A static function that just calls kmalloc(), and only used in one place.
It's obvious that the wrappers on wrappers in this driver have never
actually been reviewed...
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove another pointless kmalloc wrapper
Call kmalloc directly, don't make a special "atomic" function pointer to
call it instead.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
just call kmalloc directly, don't use an indirect pointer to a wrapper
function.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The config option, CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT, was
never able to be set, so this file was never being built. Also, as
WILC_PREALLOC_AT_BOOT was never being set in the build system, remove
all code framed by that symbol.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>