[PATCH] staging: wilc1000: wilc_wlan_if.h: remove unused functions

2016-02-29 Thread Tony Cho
This patch removes the unused functions anymore related to the configuration
of the bus interface clock speed.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan_if.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index fbe34eb..f19ecb5 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -918,8 +918,6 @@ typedef enum {
 
 struct wilc;
 int wilc_wlan_init(struct net_device *dev);
-void wilc_bus_set_max_speed(void);
-void wilc_bus_set_default_speed(void);
 u32 wilc_get_chipid(struct wilc *wilc, bool update);
 
 #endif
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: wilc1000: wilc_wlan.c: remove multiple blank line

2016-02-24 Thread Tony Cho
This patch removes the multiple blank line reported by checkpatch.pl.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index f142e61..17e39cc 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -139,7 +139,6 @@ struct pending_acks_info {
struct txq_entry_t  *txqe;
 };
 
-
 #define NOT_TCP_ACK(-1)
 
 #define MAX_TCP_SESSION25
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: wilc1000: wilc_wlan.c: remove unnecessary blank lines

2016-02-24 Thread Tony Cho
This patch removes unnecessary blank lines found by checkpatch.pl.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index d50ddc6..f142e61 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -21,7 +21,6 @@ static inline void release_bus(struct wilc *wilc, 
BUS_RELEASE_T release)
 
 static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
 {
-
if (tqe == wilc->txq_head) {
wilc->txq_head = tqe->next;
if (wilc->txq_head)
@@ -248,7 +247,6 @@ static inline void tcp_process(struct net_device *dev, 
struct txq_entry_t *tqe)
 
add_tcp_pending_ack(ack_no, i, tqe);
}
-
}
}
spin_unlock_irqrestore(>txq_spinlock, flags);
@@ -429,7 +427,6 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct 
wilc *wilc,
 
 static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
 {
-
if (wilc->quit)
return 0;
 
@@ -450,7 +447,6 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct 
rxq_entry_t *rqe)
 
 static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 {
-
if (wilc->rxq_head) {
struct rxq_entry_t *rqe;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: whitespace error in some of commits

2016-02-15 Thread Tony Cho

Hi Janani,
Please refer to the commit numbers again in the wilc1000 driver:
c611d48e65e25af2dc0176e9ac135116095ed03d
24c6c29d85af3748b2d79b46f72188b335566340

Thanks,
Tony.

On 2016년 02월 16일 15:47, Tony Cho wrote:

Hi Janani,

I can find the whitespace errors in your commits which is already 
accepted in staging-testing branch.


The commit number is c611d48e65e25af2dc0176e9ac135116095ed03d and 
c611d48e65e25af2dc0176e9ac135116095ed03d.


I don't know why I couldn't find your patch emails from the community. 
Please cc the linux-wireless and devel.


Would you fix these patch or I can make it if you don't mind.


Thanks,

Tony.




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


whitespace error in some of commits

2016-02-15 Thread Tony Cho

Hi Janani,

I can find the whitespace errors in your commits which is already accepted in 
staging-testing branch.

The commit number is c611d48e65e25af2dc0176e9ac135116095ed03d and 
c611d48e65e25af2dc0176e9ac135116095ed03d.

I don't know why I couldn't find your patch emails from the community. Please 
cc the linux-wireless and devel.

Would you fix these patch or I can make it if you don't mind.


Thanks,

Tony.


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wilc1000: change MAINTAINERS

2015-10-28 Thread Tony Cho
This patch removes Rachel Kim from the MAINTAINERS list because she
retires from her position and adds Austin shin as new MAINTAINER for
the Atmel wireless link controller: WILC1000 and WILC3000.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8492117..cc27aef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10014,7 +10014,7 @@ F:  drivers/staging/vt665?/
 
 STAGING - WILC1000 WIFI DRIVER
 M: Johnny Kim <johnny@atmel.com>
-M: Rachel Kim <rachel@atmel.com>
+M: Austin Shin <austin.s...@atmel.com>
 M: Chris Park <chris.p...@atmel.com>
 M: Tony Cho <tony@atmel.com>
 M: Glen Lee <glen@atmel.com>
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/19] staging/wilc1000 cleanups

2015-10-27 Thread Tony Cho

Hi Arnd,
I expect your opinion but I would like to make the patch to revert
the commit bcc43a4b5ed75285aeacf2cf8d9b96d6379fb429 if you don't mind
because the WILC1000 in staging still has compile errors.
Then, we had better make patch for your concerns.

I always appreciate your review and contribution.

Thanks,
Tony.

On 2015년 10월 23일 16:51, Tony Cho wrote:

Hi Arnd,
First of all, I would like to say "thank you" for your efforts and 
contributions.
We are updating the driver because new revision came up and making new 
patches
to make it stable and elegant as Linux driver. In these days, we are 
sending big changes

while testing such patches and also doing updates at once.

As you did, we are scheduled to provide the patches making device tree 
and delete all of platform
dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other 
things. So, I would like to

discuss with you for your series of patch.

In this time, I think it's important to make the driver to be compiled 
even if the link problem
happens as you reported. So, how about deleting all of SPI related 
files from source tree and
even from Kconfig for the time being because new bus driver will come 
or revert

the Kconfig and then can we expect the best patch in the near feature?

I respect your efforts and patches, so your opinion is very important 
to me.


Thanks,
Tony.

On 2015년 10월 23일 10:37, glen lee wrote:


On 2015년 10월 22일 21:23, Arnd Bergmann wrote:

On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl 
instead of wilc1000.


And the global variable g_linux_wlan will be placed in netdevice 
private data
and finally it will be removed. I already posted some of those 
patches.

I couldn't find the patches anywhere, but I've updated my series now
to rename the symbols to wilc_* and to remove most but not all 
references to
g_linux_wlan (or wilc_dev after my rename). Do you want me to post 
those
so you can integrate them, or should I have a look at what you sent 
first

(please send me a copy then).


Hi arnd,

I have tested with all the patches you have posted but it does not 
works. firmware start timed out

in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, 
but it shows

Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help 
us.


The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data 
structure

and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
( The patches posted by tony@atmel.com )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but 
not yet accepted.


Thank you.
Glen.


Arnd






___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/19] staging/wilc1000 cleanups

2015-10-23 Thread Tony Cho

Hi Arnd,
First of all, I would like to say "thank you" for your efforts and 
contributions.
We are updating the driver because new revision came up and making new 
patches
to make it stable and elegant as Linux driver. In these days, we are 
sending big changes

while testing such patches and also doing updates at once.

As you did, we are scheduled to provide the patches making device tree 
and delete all of platform
dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other things. 
So, I would like to

discuss with you for your series of patch.

In this time, I think it's important to make the driver to be compiled 
even if the link problem
happens as you reported. So, how about deleting all of SPI related files 
from source tree and
even from Kconfig for the time being because new bus driver will come or 
revert

the Kconfig and then can we expect the best patch in the near feature?

I respect your efforts and patches, so your opinion is very important to me.

Thanks,
Tony.

On 2015년 10월 23일 10:37, glen lee wrote:


On 2015년 10월 22일 21:23, Arnd Bergmann wrote:

On Wednesday 21 October 2015 19:06:52 glen lee wrote:

Hi arnd,

Thanks for the all the patches.
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl 
instead of wilc1000.


And the global variable g_linux_wlan will be placed in netdevice 
private data

and finally it will be removed. I already posted some of those patches.

I couldn't find the patches anywhere, but I've updated my series now
to rename the symbols to wilc_* and to remove most but not all 
references to

g_linux_wlan (or wilc_dev after my rename). Do you want me to post those
so you can integrate them, or should I have a look at what you sent 
first

(please send me a copy then).


Hi arnd,

I have tested with all the patches you have posted but it does not 
works. firmware start timed out

in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, 
but it shows

Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data 
structure

and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
( The patches posted by tony@atmel.com )

By the way, deleting feature COMPLEMENT_BOOT patch already posted but 
not yet accepted.


Thank you.
Glen.


Arnd




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 05/28] staging: wilc1000: wilc_handle_isr: add argument wilc to wilc_handle_isr

2015-10-23 Thread Tony Cho



On 2015년 10월 23일 16:52, Dan Carpenter wrote:

On Fri, Oct 23, 2015 at 04:36:07PM +0900, Tony Cho wrote:

In addition, the function parameter names will be wilc
for the variable of struct wilc.

The "wl" is local variable naming as well.

So if it is a parameter it is wilc but if it is a local variable then it
is wl?  That seems like an arbitrary meaningless distinction.  It just
makes searching harder and complicates things for no reason.


I will be on the business trip for the time being so let me ask Glen to

reconsider your concerns to apply your opinion to coming patches.

I always appreciate your guide and reviews because learning valuable things 
from you.

Thanks,

Tony.



regards,
dan carpenter



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/13] staging: wilc1000: chage_virtual_intf: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 85 ---
 1 file changed, 45 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 264fcb9..422d462 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2534,9 +2534,11 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
u8 interface_type;
u16 TID = 0;
u8 i;
+   struct wilc *wl;
 
nic = netdev_priv(dev);
priv = wiphy_priv(wiphy);
+   wl = nic->wilc;
 
PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n");
PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name);
@@ -2571,30 +2573,31 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
 
-   if (g_linux_wlan->initialized) {
-   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].bssid, TID);
+   if (wl->initialized) {
+   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
 
/*Eliminate host interface blocking state*/
-   up(_linux_wlan->cfg_event);
+   up(>cfg_event);
 
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wilc1000_wlan_deinit(wl);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
nic->iftype = interface_type;
 
/*Setting interface 1 drv handler and mac address in 
newly downloaded FW*/
-   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv);
-   host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv,
-   g_linux_wlan->vif[0].src_addr);
+   host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+   host_int_set_MacAddress(wl->vif[0].hif_drv,
+   wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
+   host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
+   host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2612,22 +2615,22 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", 
g_key_gtk_params.key[0],
g_key_gtk_params.key[1],
g_key_gtk_params.key[2]);
-   
add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
-   g_linux_wlan->vif[0].ndev,
+   add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy,
+   wl->vif[0].ndev,
g_add_ptk_key_params.key_idx,
g_add_ptk_key_params.pairwise,
g_add_ptk_key_params.mac_addr,
(struct key_params 
*)(_key_ptk_params));
 
-   
add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
-   g_linux_wlan->vif[0].ndev,
+   add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy,
+   wl->vif[0].ndev,
g_

[PATCH 04/13] staging: wilc1000: mac_open: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5fcbfac..ebedffa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1167,9 +1167,13 @@ int mac_open(struct net_device *ndev)
int ret = 0;
int i = 0;
struct wilc_priv *priv;
+   struct wilc *wl;
+
+   nic = netdev_priv(ndev);
+   wl = nic->wilc;
 
 #ifdef WILC_SPI
-   if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
+   if (!wl|| !wl->wilc_spidev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
@@ -1200,16 +1204,16 @@ int mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
 
/* loop through the NUM of supported devices and set the MAC address */
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (ndev == g_linux_wlan->vif[i].ndev) {
-   memcpy(g_linux_wlan->vif[i].src_addr, mac_add, 
ETH_ALEN);
-   g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
+   for (i = 0; i < wl->vif_num; i++) {
+   if (ndev == wl->vif[i].ndev) {
+   memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN);
+   wl->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
}
 
/* TODO: get MAC address whenever the source is EPROM - hardcoded and 
copy it to ndev*/
-   memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN);
+   memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN);
 
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
@@ -1222,13 +1226,13 @@ int mac_open(struct net_device *ndev)
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, 
nic->wilc_netdev->ieee80211_ptr,
 nic->g_struct_frame_reg[1].frame_type, 
nic->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
-   g_linux_wlan->open_ifcs++;
+   wl->open_ifcs++;
nic->mac_opened = 1;
return 0;
 
 _err_:
wilc_deinit_host_int(ndev);
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wilc1000_wlan_deinit(wl);
return ret;
 }
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/13] staging: wilc1000: wilc1000_wlan_init: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch use netdev private data member wilc instead of global variable
g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8fa6b7c..39341a8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1027,14 +1027,15 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
+   struct wilc *wl = nic->wilc;
 
-   if (!g_linux_wlan->initialized) {
-   g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
-   g_linux_wlan->close = 0;
+   if (!wl->initialized) {
+   wl->mac_status = WILC_MAC_STATUS_INIT;
+   wl->close = 0;
 
-   wlan_init_locks(g_linux_wlan);
+   wlan_init_locks(wl);
 
-   linux_to_wlan(, g_linux_wlan);
+   linux_to_wlan(, wl);
 
ret = wilc_wlan_init();
if (ret < 0) {
@@ -1044,7 +1045,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   if (init_irq(g_linux_wlan)) {
+   if (init_irq(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
@@ -1073,7 +1074,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
/*Download firmware*/
-   ret = linux_wlan_firmware_download(g_linux_wlan);
+   ret = linux_wlan_firmware_download(wl);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1101,7 +1102,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
PRINT_D(INIT_DBG, "* Firmware Ver = %s  ***\n", 
Firmware_ver);
}
/* Initialize firmware with default configuration */
-   ret = linux_wlan_init_test_config(dev, g_linux_wlan);
+   ret = linux_wlan_init_test_config(dev, wl);
 
if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
@@ -1109,7 +1110,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
 
-   g_linux_wlan->initialized = true;
+   wl->initialized = true;
return 0; /*success*/
 
 _fail_fw_start_:
@@ -1121,14 +1122,14 @@ _fail_irq_enable_:
 _fail_irq_init_:
 #endif
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   deinit_irq(g_linux_wlan);
+   deinit_irq(wl);
 
 #endif
-   wlan_deinitialize_threads(g_linux_wlan);
+   wlan_deinitialize_threads(wl);
 _fail_wilc_wlan_:
wilc_wlan_cleanup();
 _fail_locks_:
-   wlan_deinit_locks(g_linux_wlan);
+   wlan_deinit_locks(wl);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/13] staging: wilc1000: wlan_init_locks: change parameter and use wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch changes function parameter type wilc with net_device and use netdev
private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 39341a8..5fcbfac 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -920,23 +920,28 @@ void wilc1000_wlan_deinit(struct wilc *nic)
}
 }
 
-int wlan_init_locks(struct wilc *p_nic)
+int wlan_init_locks(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
PRINT_D(INIT_DBG, "Initializing Locks ...\n");
 
-   mutex_init(_linux_wlan->hif_cs);
-   mutex_init(_linux_wlan->rxq_cs);
+   mutex_init(>hif_cs);
+   mutex_init(>rxq_cs);
 
-   spin_lock_init(_linux_wlan->txq_spinlock);
-   sema_init(_linux_wlan->txq_add_to_head_cs, 1);
+   spin_lock_init(>txq_spinlock);
+   sema_init(>txq_add_to_head_cs, 1);
 
-   sema_init(_linux_wlan->txq_event, 0);
+   sema_init(>txq_event, 0);
 
-   sema_init(_linux_wlan->cfg_event, 0);
-   sema_init(_linux_wlan->sync_event, 0);
+   sema_init(>cfg_event, 0);
+   sema_init(>sync_event, 0);
 
-   sema_init(_linux_wlan->txq_thread_started, 0);
+   sema_init(>txq_thread_started, 0);
 
return 0;
 }
@@ -1033,7 +1038,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
 
-   wlan_init_locks(wl);
+   wlan_init_locks(dev);
 
linux_to_wlan(, wl);
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/13] staging: wilc1000: add_key: use netdev private wilc instead of g_linux_wlan

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1533804..8aea4b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1086,8 +1086,12 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(netdev);
+   wl = nic->wilc;
 
PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", 
params->cipher);
 
@@ -1259,7 +1263,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
}
 
/*save keys only on interface 0 (wifi 
interface)*/
-   if (!g_gtk_keys_saved && netdev == 
g_linux_wlan->vif[0].ndev) {
+   if (!g_gtk_keys_saved && netdev == 
wl->vif[0].ndev) {
g_add_gtk_key_params.key_idx = 
key_index;
g_add_gtk_key_params.pairwise = 
pairwise;
if (!mac_addr) {
@@ -1295,7 +1299,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
}
 
/*save keys only on interface 0 (wifi 
interface)*/
-   if (!g_ptk_keys_saved && netdev == 
g_linux_wlan->vif[0].ndev) {
+   if (!g_ptk_keys_saved && netdev == 
wl->vif[0].ndev) {
g_add_ptk_key_params.key_idx = 
key_index;
g_add_ptk_key_params.pairwise = 
pairwise;
if (!mac_addr) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/13] staging: wilc1000: wilc_mgmt_frame_register: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index eea7f3b..59db1d5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2397,12 +2397,11 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, 
struct wireless_dev *wdev,
 
struct wilc_priv *priv;
perInterface_wlan_t *nic;
-
+   struct wilc *wl;
 
priv = wiphy_priv(wiphy);
nic = netdev_priv(priv->wdev->netdev);
-
-
+   wl = nic->wilc;
 
if (!frame_type)
return;
@@ -2430,7 +2429,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 
}
/*If mac is closed, then return*/
-   if (!g_linux_wlan->initialized) {
+   if (!wl->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/13] staging: wilc1000: wilc1000_wlan_deinit: change argument and use wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch changes function argument wilc with net_device and use nic->wilc
instead of global variable g_linux_wlan. The null check codes should be placed
before it is used so move it.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 45 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  7 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 93475aa..2c4673c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -49,7 +49,6 @@ extern bool g_obtainingIP;
 extern u16 Set_machw_change_vir_if(bool bValue);
 extern void resolve_disconnect_aberration(void *drvHandler);
 extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
 extern struct timer_list hDuringIpTimer;
 
 static int linux_wlan_device_power(int on_off)
@@ -860,15 +859,21 @@ _fail_:
 }
 
 /**/
-void wilc1000_wlan_deinit(struct wilc *nic)
+void wilc1000_wlan_deinit(struct net_device *dev)
 {
-   if (g_linux_wlan->initialized)  {
-   printk("Deinitializing wilc1000  ...\n");
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
 
-   if (nic == NULL) {
-   PRINT_ER("nic is NULL\n");
-   return;
-   }
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
+   if (!wl) {
+   netdev_err(dev, "wl is NULL\n");
+   return;
+   }
+
+   if (wl->initialized){
+   netdev_info(dev, "Deinitializing wilc1000...\n");
 
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
/* johnny : remove */
@@ -879,18 +884,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
 #ifdef WILC_SDIO
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
disable_sdio_interrupt();
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
 #endif
-   if (_linux_wlan->txq_event != NULL)
-   up(_linux_wlan->txq_event);
+   if (>txq_event != NULL)
+   up(>txq_event);
 
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
-   wlan_deinitialize_threads(nic);
+   wlan_deinitialize_threads(wl);
 
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
-   deinit_irq(g_linux_wlan);
+   deinit_irq(wl);
 
wilc_wlan_stop();
 
@@ -900,18 +905,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
   #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
disable_sdio_interrupt();
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
   #endif
 #endif
 
/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
-   wlan_deinit_locks(g_linux_wlan);
+   wlan_deinit_locks(wl);
 
/* announce that wilc1000 is not initialized */
-   g_linux_wlan->initialized = false;
+   wl->initialized = false;
 
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
 
@@ -1232,7 +1237,7 @@ int mac_open(struct net_device *ndev)
 
 _err_:
wilc_deinit_host_int(ndev);
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
return ret;
 }
 
@@ -1431,7 +1436,7 @@ int mac_close(struct net_device *ndev)
if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
wl->close = 1;
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
WILC_WFI_deinit_mon_interface();
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 422d462..33a082f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2523,7 +2523,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-void wilc1000_wlan_deinit(struct wilc *nic);
 int wilc1000_wlan_init(struct net_devic

[PATCH 08/13] staging: wilc1000: CfgConnectResult: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 33a082f..1533804 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -537,11 +537,15 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
struct net_device *dev;
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
connecting = 0;
 
priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
 
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
@@ -624,12 +628,12 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
u8WLANChannel = INVALID_CHANNEL;
/*Incase "P2P CLIENT Connected" send deauthentication reason by 
3 to force the WPA_SUPPLICANT to directly change
 *  virtual interface to station*/
-   if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].ndev)) 
{
+   if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 3;
}
/*Incase "P2P CLIENT during connection(not connected)" send 
deauthentication reason by 1 to force the WPA_SUPPLICANT
 *  to scan again and retry the connection*/
-   else if ((!pstrWFIDrv->IFC_UP) && (dev == 
g_linux_wlan->vif[1].ndev)) {
+   else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, 
pstrDisconnectNotifInfo->ie,
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/13] staging: wilc1000: mac_close: use netdev private wilc instead of g_linux_wlan

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ebedffa..93475aa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1383,6 +1383,7 @@ int mac_close(struct net_device *ndev)
struct wilc_priv *priv;
perInterface_wlan_t *nic;
struct host_if_drv *pstrWFIDrv;
+   struct wilc *wl;
 
nic = netdev_priv(ndev);
 
@@ -1392,6 +1393,7 @@ int mac_close(struct net_device *ndev)
}
 
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
+   wl = nic->wilc;
 
if (priv == NULL) {
PRINT_ER("priv = NULL\n");
@@ -1402,8 +1404,8 @@ int mac_close(struct net_device *ndev)
 
PRINT_D(GENERIC_DBG, "Mac close\n");
 
-   if (g_linux_wlan == NULL) {
-   PRINT_ER("g_linux_wlan = NULL\n");
+   if (!wl) {
+   PRINT_ER("wl = NULL\n");
return 0;
}
 
@@ -1412,8 +1414,8 @@ int mac_close(struct net_device *ndev)
return 0;
}
 
-   if ((g_linux_wlan->open_ifcs) > 0) {
-   g_linux_wlan->open_ifcs--;
+   if ((wl->open_ifcs) > 0) {
+   wl->open_ifcs--;
} else {
PRINT_ER("ERROR: MAC close called while number of opened 
interfaces is zero\n");
return 0;
@@ -1426,10 +1428,10 @@ int mac_close(struct net_device *ndev)
wilc_deinit_host_int(nic->wilc_netdev);
}
 
-   if (g_linux_wlan->open_ifcs == 0) {
+   if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
-   g_linux_wlan->close = 1;
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wl->close = 1;
+   wilc1000_wlan_deinit(wl);
WILC_WFI_deinit_mon_interface();
}
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch add wilc to struct perInterface_wlan_t which is netdev private
data to access wilc via netdev_priv function. Assign wilc to nic->wilc.
The global variable g_linux_wlan will be replaced with netdev private data
member wilc step by step.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 1 +
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5701e58..8fa6b7c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1662,6 +1662,7 @@ int wilc_netdev_init(struct wilc **wilc)
 
nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
+   nic->wilc = *wilc;
g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
g_linux_wlan->vif_num++;
ndev->netdev_ops = _netdev_ops;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index e0c66bc..40a44f8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -199,7 +199,7 @@ typedef struct {
struct_frame_reg g_struct_frame_reg[num_reg_frame];
struct net_device *wilc_netdev;
struct net_device_stats netstats;
-
+   struct wilc *wilc;
 } perInterface_wlan_t;
 
 struct WILC_WFI_mon_priv {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/13] staging: wilc1000: init_irq: change argument and use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch changes function argument type wilc with net_device and use
netdev private data member wilc instead of p_nic.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2c4673c..bb5bd81 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -259,10 +259,14 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
 }
 
 #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-static int init_irq(struct wilc *p_nic)
+static int init_irq(struct net_device *dev)
 {
int ret = 0;
-   struct wilc *nic = p_nic;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
/*initialize GPIO and register IRQ num*/
/*GPIO request*/
@@ -275,23 +279,23 @@ static int init_irq(struct wilc *p_nic)
  * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
  */
 #else
-   nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+   wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
 #endif
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
}
 
-   if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, 
isr_uh_routine, isr_bh_routine,
+   if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, 
isr_uh_routine, isr_bh_routine,
  IRQF_TRIGGER_LOW | 
IRQF_ONESHOT,   /*Without IRQF_ONESHOT the uh will remain kicked in 
and dont gave a chance to bh*/
- "WILC_IRQ", nic)) < 0) {
+ "WILC_IRQ", wl)) < 0) {
 
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
} else {
 
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   nic->dev_irq_num, GPIO_NUM);
+   wl->dev_irq_num, GPIO_NUM);
}
 
return ret;
@@ -1055,7 +1059,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   if (init_irq(wl)) {
+   if (init_irq(dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/13] staging: wilc1000: start_ap: use netdev private data wilc

2015-10-20 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 59db1d5..5559aa6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2891,8 +2891,12 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
struct cfg80211_beacon_data *beacon = &(settings->beacon);
struct wilc_priv *priv;
s32 s32Error = 0;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
 
PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = 
%zu Tail length = %zu\n",
@@ -2903,7 +2907,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
 
-   linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].src_addr);
+   linux_wlan_set_bssid(dev, wl->vif[0].src_addr);
 
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/wilc: fix Kconfig dependencies, second try

2015-10-19 Thread Tony Cho

Hi Arnd Bergmann,

When I apply this patch, I cannot make WILC1000 module (wilc1000.ko) because 
CONFIG_WILC1000 is y and also I can see some link errors for the cfg80211 APIs.

Can you consider this patch?

Thanks,

Tony.


On 2015년 10월 17일 05:45, Arnd Bergmann wrote:

My first attempt to fix the Kconfig logic for wilc1000 was incomplete,
as it missed the case where SPI is built-in while SDIO is modular
and wilc1000 is configured as built-in in SPI mode (or vice versa),
which would still lead to a link failure.

This works around the problem by adding an intermediate Kconfig
symbol "WILC1000_DRIVER" that controls visibility of the SDIO and
SPI sub-drivers, so we can control the dependencies better.

Signed-off-by: Arnd Bergmann 
Fixes: 9535ebc5e9cc ("staging/wilc1000: fix Kconfig dependencies")

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index 59ccecc316df..ee51b4278088 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,14 +1,16 @@
-config WILC1000
-   tristate "WILC1000 support (WiFi only)"
-   depends on !S390
+config WILC1000_DRIVER
+   bool "WILC1000 support (WiFi only)"
depends on CFG80211 && WEXT_CORE && INET
-   depends on MMC || SPI
---help---
  This module only support IEEE 802.11n WiFi.
  
+if WILC1000_DRIVER

+
+config WILC1000
+   tristate
+
  choice
  prompt "Memory Allocation"
-depends on WILC1000
  default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
  
  config WILC1000_PREALLOCATE_AT_LOADING_DRIVER

@@ -29,12 +31,12 @@ endchoice
  
  choice

prompt "Bus Type"
-   depends on WILC1000
default WILC1000_SDIO
  
-	config WILC1000_SDIO

+config WILC1000_SDIO
bool "SDIO support"
depends on MMC
+   select WILC1000
---help---
  This module adds support for the SDIO interface of adapters using
  WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
@@ -45,8 +47,9 @@ choice
  To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
  this if your platform is using the SDIO bus.
  
-	config WILC1000_SPI

+config WILC1000_SPI
depends on SPI
+   select WILC1000
bool "SPI support"
---help---
  This module adds support for the SPI interface of adapters using
@@ -60,7 +63,7 @@ endchoice
  
  config WILC1000_HW_OOB_INTR

bool "Use out of band interrupt"
-   depends on WILC1000 && WILC1000_SDIO
+   depends on WILC1000_SDIO
default n
---help---
  This option enables out-of-band interrupt support for the WILC1000
@@ -68,3 +71,5 @@ config WILC1000_HW_OOB_INTR
  mechanism for SDIO host controllers that don't support SDIO interrupt.
  Select this option If the SDIO host controller in your platform
  doesn't support SDIO time devision interrupt.
+
+endif

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RESEND 5/6] staging: wilc1000: fixes alignment should match open parenthesis

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch fixes the checks reported by checkpatch.pl
for alignment should match open parenthesis.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 153 +++---
 1 file changed, 78 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b1bfd9e..9ee2d86 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -337,7 +337,7 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to set channel\n");
@@ -359,7 +359,7 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
strWID.size = sizeof(u32);
 
result = send_config_pkt(SET_CFG, , 1,
-  pstrHostIfSetDrvHandler->u32Address);
+pstrHostIfSetDrvHandler->u32Address);
 
if (!hif_drv)
up(_sema_driver);
@@ -384,7 +384,7 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
strWID.size = sizeof(u32);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
up(_sema_driver);
@@ -416,7 +416,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.size = IP_ALEN;
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
 
@@ -441,7 +441,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.size = IP_ALEN;
 
result = send_config_pkt(GET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
 
@@ -484,7 +484,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.val);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to set mac address\n");
result = -EFAULT;
@@ -506,7 +506,7 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
strWID.size = ETH_ALEN;
 
result = send_config_pkt(GET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to get mac address\n");
@@ -791,7 +791,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
}
 
result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result)
PRINT_ER("Error in setting CFG params\n");
@@ -912,7 +912,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
scan_while_connected = false;
 
result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -957,7 +957,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
strWID.size = sizeof(char);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to set abort running scan\n");
@@ -1014,16 +1014,18 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssid_len;
if (pstrHostIFconnectAttr->ssid != NULL) {
hif_drv->strWILC_UsrConnReq.pu8ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
-   memcpy(hif_drv->strWILC

[PATCH RESEND 6/6] staging: wilc1000: fixes comparison to NULL could be written

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch fixes the checks reported by checkpatch.pl
for comparison to NULL could be written.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 181 ++
 1 file changed, 87 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9ee2d86..646e7e9 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -470,8 +470,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid strWID;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
-
-   if (mac_buf == NULL) {
+   if (!mac_buf) {
PRINT_ER("No buffer to send mac address\n");
return -EFAULT;
}
@@ -851,7 +850,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
valuesize += 
((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1);
pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL);
strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal;
-   if (strWIDList[u32WidsCount].val != NULL) {
+   if (strWIDList[u32WidsCount].val) {
pu8Buffer = strWIDList[u32WidsCount].val;
 
*pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum;
@@ -887,7 +886,8 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
 
-   if (pstrHostIFscanAttr->ch_freq_list != NULL && 
pstrHostIFscanAttr->ch_list_len > 0) {
+   if (pstrHostIFscanAttr->ch_freq_list &&
+   pstrHostIFscanAttr->ch_list_len > 0) {
int i;
 
for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++)   {
@@ -1000,19 +1000,19 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global 
structure\n");
 
ptstrJoinBssParam = (struct join_bss_param 
*)pstrHostIFconnectAttr->params;
-   if (ptstrJoinBssParam == NULL) {
+   if (!ptstrJoinBssParam) {
PRINT_ER("Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
}
 
-   if (pstrHostIFconnectAttr->bssid != NULL) {
+   if (pstrHostIFconnectAttr->bssid) {
hif_drv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8bssid, 
pstrHostIFconnectAttr->bssid, 6);
}
 
hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssid_len;
-   if (pstrHostIFconnectAttr->ssid != NULL) {
+   if (pstrHostIFconnectAttr->ssid) {
hif_drv->strWILC_UsrConnReq.pu8ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8ssid,
   pstrHostIFconnectAttr->ssid,
@@ -1021,7 +1021,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
}
 
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 
pstrHostIFconnectAttr->ies_len;
-   if (pstrHostIFconnectAttr->ies != NULL) {
+   if (pstrHostIFconnectAttr->ies) {
hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs = 
kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
   pstrHostIFconnectAttr->ies,
@@ -1099,15 +1099,14 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
join_req_size = strWIDList[u32WidsCount].size;
join_req = kmalloc(join_req_size, GFP_KERNEL);
}
-   if (strWIDList[u32WidsCount].val == NULL) {
+   if (!strWIDList[u32WidsCount].val) {
result = -EFAULT;
goto ERRORHANDLER;
}
 
pu8CurrByte = strWIDList[u32WidsCount].val;
 
-
-   if (pstrHostIFconnectAttr->ssid != NULL) {
+   if (pstrHostIFconnectAttr->ssid) {
memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, 
pstrHostIFconnectAttr->ssid_len);
pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0';
}
@@ -1124,7 +1123,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
*(pu8CurrByte++)  = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | 
((*(pu8CurrByte - 1)) << 8)));
 
-   if (pstrHostIFconnectAttr->bssid != NULL)
+   if (pstrHostIFconnectAttr->bssid)
memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
pu8CurrByte += 6;
 
@@ -1202,7 +1201,7 @@ stat

[PATCH RESEND 2/6] staging: wilc1000: move variable clients_count

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch moves static variable clients_count to around where the local
variables are togther.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 066123f..c61042e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -254,6 +254,7 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 inactive_time;
 static u8 del_beacon;
+static u32 clients_count;
 
 static u8 *join_req;
 u8 *info_element;
@@ -4138,8 +4139,6 @@ void host_int_send_network_info_to_host
 {
 }
 
-static u32 clients_count;
-
 s32 host_int_init(struct host_if_drv **hif_drv_handler)
 {
s32 result = 0;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/6] WILC1000 rebase and resend some of patch series

2015-10-19 Thread Tony Cho
This series of patches are resent after some of 40 patches are rebased.

Leo Kim (6):
  staging: wilc1000: rename variable s32Error
  staging: wilc1000: move variable clients_count
  staging: wilc1000: move variable FALSE_FRMWR_CHANNEL
  staging: wilc1000: fixes unnecessary variable replacement
  staging: wilc1000: fixes alignment should match open parenthesis
  staging: wilc1000: fixes comparison to NULL could be written

 drivers/staging/wilc1000/host_interface.c | 1116 ++---
 1 file changed, 530 insertions(+), 586 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RESEND 3/6] staging: wilc1000: move variable FALSE_FRMWR_CHANNEL

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch moves the variable 'FALSE_FRMWR_CHANNEL' to where local definitions
are.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c61042e..948b986 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -60,6 +60,7 @@ extern u8 g_wilc_initialized;
 #define BA_SESSION_DEFAULT_BUFFER_SIZE  16
 #define BA_SESSION_DEFAULT_TIMEOUT  1000
 #define BLOCK_ACK_REQ_SIZE  0x14
+#define FALSE_FRMWR_CHANNEL100
 
 struct cfg_param_attr {
struct cfg_param_val cfg_attr_info;
@@ -2623,7 +2624,6 @@ static int Handle_RegisterFrame(struct host_if_drv 
*hif_drv,
return result;
 }
 
-#define FALSE_FRMWR_CHANNEL 100
 static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
 struct remain_ch *pstrHostIfRemainOnChan)
 {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RESEND 4/6] staging: wilc1000: fixes unnecessary variable replacement

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch removes an unnecessary variable use for the errors and
returns errors directly without a result variable.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 28 +---
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 948b986..b1bfd9e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3167,9 +3167,8 @@ s32 host_int_add_wep_key_bss_sta(struct host_if_drv 
*hif_drv,
struct host_if_msg msg;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3204,9 +3203,8 @@ s32 host_int_add_wep_key_bss_ap(struct host_if_drv 
*hif_drv,
u8 i;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3246,9 +3244,8 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const 
u8 *pu8Ptk,
u32 i;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
if (pu8RxMic != NULL)
u8KeyLen += RX_MIC_KEY_LEN;
@@ -3311,9 +3308,8 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, 
const u8 *pu8RxGtk,
u8 u8KeyLen = u8GtkKeylen;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
memset(, 0, sizeof(struct host_if_msg));
 
@@ -3370,9 +3366,8 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, 
struct host_if_pmkid_at
 
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3514,9 +3509,8 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 
*pu8bssid,
struct host_if_msg msg;
 
if (!hif_drv || pfConnectResult == NULL) {
-   result = -EFAULT;
PRINT_ER("Driver is null\n");
-   return result;
+   return -EFAULT;
}
 
if (pJoinParams == NULL) {
@@ -3575,16 +3569,12 @@ s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
s32 result = 0;
struct host_if_msg msg;
 
-   if (!join_req) {
-   result = -EFAULT;
-   return result;
-   }
-
+   if (!join_req)
+   return -EFAULT;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("Driver is null\n");
-   return result;
+   return -EFAULT;
}
 
msg.id = HOST_IF_MSG_FLUSH_CONNECT;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH RESEND 1/6] staging: wilc1000: rename variable s32Error

2015-10-19 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable s32Error to result
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 781 ++
 1 file changed, 370 insertions(+), 411 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 38fead4..066123f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -324,8 +324,7 @@ static struct host_if_drv *get_handler_from_id(int id)
 static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 struct channel_attr *pstrHostIFSetChan)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_CURRENT_CHANNEL;
@@ -335,21 +334,21 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
-   if (s32Error) {
+
+   if (result) {
PRINT_ER("Failed to set channel\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv,
   struct drv_handler *pstrHostIfSetDrvHandler)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_SET_DRV_HANDLER;
@@ -357,25 +356,24 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
strWID.val = (s8 *)&(pstrHostIfSetDrvHandler->u32Address);
strWID.size = sizeof(u32);
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   pstrHostIfSetDrvHandler->u32Address);
 
if (!hif_drv)
up(_sema_driver);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set driver handler\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
   struct op_mode *pstrHostIfSetOperationMode)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_SET_OPERATION_MODE;
@@ -383,25 +381,23 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
strWID.val = (s8 *)&(pstrHostIfSetOperationMode->u32Mode);
strWID.size = sizeof(u32);
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
-
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
up(_sema_driver);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set driver handler\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
char firmwareIPAddress[4] = {0};
 
@@ -417,26 +413,24 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.val = (u8 *)pu8IPAddr;
strWID.size = IP_ALEN;
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
-
host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set IP address\n");
return -EINVAL;
}
 
PRINT_INFO(HOSTINF_DBG, "IP address set\n");
 
-   return s32Error;
+   return result;
 }
 
 s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_IP_ADDRESS;
@@ -444,7 +438,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.val = kmalloc(IP_ALEN, GFP_KERNEL);
strWID.size = IP_ALEN;
 
-   s32Error = send_config_pkt(GET_CFG, , 1,
+   result = send_config_pkt(GET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
@@ -456,7 +450,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
   

[PATCH V2 11/12] staging: wilc1000: introduce struct wilc_sdio for sdio data

2015-10-19 Thread Tony Cho
This patch introduces struct wilc_sdio for sdio driver data. The wilc_sdio is
allocated and set as driver data when the sdio is probed and deallocated when
the sdio is removed.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1bd7f9b..9a45871 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -21,6 +21,10 @@
  #define MAX_SPEED (6 * 100) /* Max 50M */
 #endif
 
+struct wilc_sdio {
+   struct sdio_func *func;
+   struct wilc *wilc;
+};
 
 struct sdio_func *local_sdio_func;
 extern int wilc_netdev_init(void);
@@ -112,14 +116,22 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
 static int linux_sdio_probe(struct sdio_func *func, const struct 
sdio_device_id *id)
 {
+   struct wilc_sdio *wl_sdio;
+
PRINT_D(INIT_DBG, "probe function\n");
+   wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
+   if (!wl_sdio)
+   return -ENOMEM;
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
if (wilc_netdev_init()) {
PRINT_ER("Couldn't initialize netdev\n");
+   kfree(wl_sdio);
return -1;
}
+   wl_sdio->func = func;
+   sdio_set_drvdata(func, wl_sdio);
 
printk("Driver Initializing success\n");
return 0;
@@ -127,7 +139,11 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
 static void linux_sdio_remove(struct sdio_func *func)
 {
+   struct wilc_sdio *wl_sdio;
+
+   wl_sdio = sdio_get_drvdata(func);
wl_wlan_cleanup();
+   kfree(wl_sdio);
 }
 
 struct sdio_driver wilc_bus = {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 09/12] staging: wilc1000: rename wilc_firmware in the struct wilc

2015-10-19 Thread Tony Cho
This patch renames wilc_firmware in the struct wilc to the firmware. In
addition, null assignments to the wl->firmware after release_firmware
are removed because it is not necessary.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 15 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 74b7cc0..16b1d80 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -537,7 +537,7 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
goto _fail_;
}
 #endif
-   g_linux_wlan->wilc_firmware = wilc_firmware;
+   g_linux_wlan->firmware = wilc_firmware;
 
 _fail_:
 
@@ -594,7 +594,7 @@ static int linux_wlan_firmware_download(struct wilc *p_nic)
 
int ret = 0;
 
-   if (g_linux_wlan->wilc_firmware == NULL) {
+   if (!g_linux_wlan->firmware) {
PRINT_ER("Firmware buffer is NULL\n");
ret = -ENOBUFS;
goto _FAIL_;
@@ -603,16 +603,15 @@ static int linux_wlan_firmware_download(struct wilc 
*p_nic)
 *  do the firmware download
 **/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
-   ret = wilc_wlan_firmware_download(g_linux_wlan->wilc_firmware->data,
- g_linux_wlan->wilc_firmware->size);
+   ret = wilc_wlan_firmware_download(g_linux_wlan->firmware->data,
+ g_linux_wlan->firmware->size);
if (ret < 0)
goto _FAIL_;
 
/* Freeing FW buffer */
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
-   release_firmware(g_linux_wlan->wilc_firmware);
-   g_linux_wlan->wilc_firmware = NULL;
+   release_firmware(g_linux_wlan->firmware);
 
PRINT_D(INIT_DBG, "Download Succeeded\n");
 
@@ -1709,8 +1708,8 @@ void wl_wlan_cleanup(void)
nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
}
 
-   if (g_linux_wlan && g_linux_wlan->wilc_firmware)
-   release_firmware(g_linux_wlan->wilc_firmware);
+   if (g_linux_wlan && g_linux_wlan->firmware)
+   release_firmware(g_linux_wlan->firmware);
 
if (g_linux_wlan &&
   (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index b410424..74eb7b6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -182,7 +182,7 @@ struct wilc {
 
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
-   const struct firmware *wilc_firmware;
+   const struct firmware *firmware;
 
 #ifdef WILC_SDIO
struct sdio_func *wilc_sdio_func;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 12/12] staging: wilc1000: assign pointer of g_linux_wlan to sdio device data

2015-10-19 Thread Tony Cho
This patch assigns wl pointer to sdio device data. The global variable
g_linux_wlan will be removed finally.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 5 +++--
 drivers/staging/wilc1000/linux_wlan_sdio.c| 5 +++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3cad5b6..5701e58 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1620,9 +1620,8 @@ void wl_wlan_cleanup(void)
linux_wlan_device_power(0);
 }
 
-int wilc_netdev_init(void)
+int wilc_netdev_init(struct wilc **wilc)
 {
-
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
@@ -1634,6 +1633,8 @@ int wilc_netdev_init(void)
if (!g_linux_wlan)
return -ENOMEM;
 
+   *wilc = g_linux_wlan;
+
register_inetaddr_notifier(_dev_notifier);
 
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 9a45871..1f8d874 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -27,7 +27,6 @@ struct wilc_sdio {
 };
 
 struct sdio_func *local_sdio_func;
-extern int wilc_netdev_init(void);
 extern void wilc_handle_isr(void);
 
 static unsigned int sdio_default_speed;
@@ -117,6 +116,7 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 static int linux_sdio_probe(struct sdio_func *func, const struct 
sdio_device_id *id)
 {
struct wilc_sdio *wl_sdio;
+   struct wilc *wilc;
 
PRINT_D(INIT_DBG, "probe function\n");
wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
@@ -125,12 +125,13 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
-   if (wilc_netdev_init()) {
+   if (wilc_netdev_init()) {
PRINT_ER("Couldn't initialize netdev\n");
kfree(wl_sdio);
return -1;
}
wl_sdio->func = func;
+   wl_sdio->wilc = wilc;
sdio_set_drvdata(func, wl_sdio);
 
printk("Driver Initializing success\n");
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 74eb7b6..e0c66bc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -214,4 +214,5 @@ void linux_wlan_rx_complete(void);
 void linux_wlan_dbg(u8 *buff);
 int linux_wlan_lock_timeout(void *vp, u32 timeout);
 void wl_wlan_cleanup(void);
+int wilc_netdev_init(struct wilc **wilc);
 #endif
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 10/12] staging: wilc1000: remove COMPLEMENT_BOOT

2015-10-19 Thread Tony Cho
This patch removes a preprocessor definition, COMPLEMENT_BOOT which is not used
anymore. This is just workaround to avoid weird issue, which is that 11b core
is not ready after the power is givin to the chip. However, this issue happened
only in the unstable hardware a long time ago and no more seen. In addition,
this patch removes _fail_threads_ statement to avoid the build warning after
removing COMPLEMENT_BOOT conditionals.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c  | 132 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.c |   9 --
 drivers/staging/wilc1000/wilc_wlan.c   |  18 
 3 files changed, 8 insertions(+), 151 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 16b1d80..3cad5b6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -545,10 +545,6 @@ _fail_:
 
 }
 
-#ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
 static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 {
 
@@ -565,18 +561,6 @@ static int linux_wlan_start_firmware(perInterface_wlan_t 
*nic)
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = linux_wlan_lock_timeout(_linux_wlan->sync_event, 5000);
if (ret) {
-#ifdef COMPLEMENT_BOOT
-   static int timeout = 5;
-
-   if (timeout--) {
-   PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
-   ret = repeat_power_cycle(nic);
-   } else {
-   timeout = 5;
-   ret = -1;
-   goto _fail_;
-   }
-#endif
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
}
@@ -1038,97 +1022,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
}
 }
 
-#ifdef COMPLEMENT_BOOT
-
-extern volatile int probe;
-extern u8 core_11b_ready(void);
-
-#define READY_CHECK_THRESHOLD  30
-extern void wilc_wlan_global_reset(void);
-u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-   u8 trials = 0;
-
-   while ((core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++ {
-   PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
-   wilc_wlan_cleanup();
-   wilc_wlan_global_reset();
-   sdio_unregister_driver(_bus);
-
-   linux_wlan_device_detection(0);
-
-   mdelay(100);
-
-   linux_wlan_device_detection(1);
-
-   sdio_register_driver(_bus);
-
-   while (!probe)
-   msleep(100);
-   probe = 0;
-   g_linux_wlan->wilc_sdio_func = local_sdio_func;
-   linux_to_wlan(nwi, nic);
-   wilc_wlan_init(nwi);
-   }
-
-   if (READY_CHECK_THRESHOLD <= trials)
-   return 1;
-   else
-   return 0;
-
-}
-
-int repeat_power_cycle(perInterface_wlan_t *nic)
-{
-   int ret = 0;
-   wilc_wlan_inp_t nwi;
-
-   sdio_unregister_driver(_bus);
-
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
-   msleep(100);
-   linux_wlan_device_power(1);
-   msleep(80);
-   linux_wlan_device_detection(1);
-   msleep(20);
-
-   sdio_register_driver(_bus);
-
-   /* msleep(1000); */
-   while (!probe)
-   msleep(100);
-   probe = 0;
-   g_linux_wlan->wilc_sdio_func = local_sdio_func;
-   linux_to_wlan(, g_linux_wlan);
-   ret = wilc_wlan_init();
-
-   g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
-   #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-   enable_sdio_interrupt();
-   #endif
-
-   if (linux_wlan_get_firmware(nic)) {
-   PRINT_ER("Can't get firmware\n");
-   ret = -1;
-   goto __fail__;
-   }
-
-   /*Download firmware*/
-   ret = linux_wlan_firmware_download(g_linux_wlan);
-   if (ret < 0) {
-   PRINT_ER("Failed to download firmware\n");
-   goto __fail__;
-   }
-   /* Start firmware*/
-   ret = linux_wlan_start_firmware(nic);
-   if (ret < 0)
-   PRINT_ER("Failed to start firmware\n");
-__fail__:
-   return ret;
-}
-#endif
-
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
wilc_wlan_inp_t nwi;
@@ -1150,29 +1043,21 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_locks_;
}
 
-   ret = wlan_initialize_threads(nic);
-   if (ret < 0) {
-   PRINT_ER("Initializing Threads FAILED\n");
-   re

[PATCH V2 02/12] staging: wilc1000: rename u8NoIfcs in the struct wilc

2015-10-19 Thread Tony Cho
This patch renames u8NoIfcs of the struct wilc to the vif_num to avoid
CamelCase naming convention.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 18 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 191851b..2bea103 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -366,7 +366,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid  = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
 
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN)) {
return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
@@ -377,7 +377,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid  = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN)) {
PRINT_D(INIT_DBG, "Ctx [%p]\n", 
g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
@@ -394,7 +394,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 
*pBSSID)
int ret = -1;
 
PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == 
wilc_netdev) {
PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", 
pBSSID[0], pBSSID[1], pBSSID[2]);
memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, 
pBSSID, 6);
@@ -412,7 +412,7 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 null_bssid[6] = {0};
u8 ret_val = 0;
 
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, 
null_bssid, 6))
ret_val++;
}
@@ -1316,7 +1316,7 @@ int mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
 
/* loop through the NUM of supported devices and set the MAC address */
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) {
memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, 
mac_add, ETH_ALEN);
g_linux_wlan->strInterfaceInfo[i].drvHandler = 
priv->hWILCWFIDrv;
@@ -1687,7 +1687,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
 
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
-   for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
+   for (i = 0; i < g_linux_wlan->vif_num; i++) {
nic = 
netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
@@ -1740,10 +1740,10 @@ int wilc_netdev_init(void)
} else
strcpy(ndev->name, "p2p%d");
 
-   nic->u8IfIdx = g_linux_wlan->u8NoIfcs;
+   nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
-   
g_linux_wlan->strInterfaceInfo[g_linux_wlan->u8NoIfcs].wilc_netdev = ndev;
-   g_linux_wlan->u8NoIfcs++;
+   
g_linux_wlan->strInterfaceInfo[g_linux_wlan->vif_num].wilc_netdev = ndev;
+   g_linux_wlan->vif_num++;
ndev->netdev_ops = _netdev_ops;
 
{
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 863571a..a3f18b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -162,7 +162,7 @@ struct wilc {
unsigned short dev_irq_num;
#endif
int close;
-   u8 u8NoIfcs;
+   u8 vif_num;
struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
u8 open_ifcs;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 07/12] staging: wilc1000: rename wilc_netdev in the struct wilc_vif

2015-10-19 Thread Tony Cho
This patch renames wilc_netdev in the struct wilc_vif to the ndev.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 50 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 34 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 11e26fb..41a2f09 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -369,7 +369,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
-   return g_linux_wlan->vif[i].wilc_netdev;
+   return g_linux_wlan->vif[i].ndev;
 
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
@@ -379,7 +379,7 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
!memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
-   return g_linux_wlan->vif[i].wilc_netdev;
+   return g_linux_wlan->vif[i].ndev;
 
PRINT_INFO(INIT_DBG, "\n");
return NULL;
@@ -391,7 +391,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 
*pBSSID)
int ret = -1;
 
for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
+   if (g_linux_wlan->vif[i].ndev == wilc_netdev) {
memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
@@ -457,10 +457,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && 
netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
-   if 
(netif_queue_stopped(g_linux_wlan->vif[0].wilc_netdev))
-   
netif_wake_queue(g_linux_wlan->vif[0].wilc_netdev);
-   if 
(netif_queue_stopped(g_linux_wlan->vif[1].wilc_netdev))
-   
netif_wake_queue(g_linux_wlan->vif[1].wilc_netdev);
+   if 
(netif_queue_stopped(g_linux_wlan->vif[0].ndev))
+   
netif_wake_queue(g_linux_wlan->vif[0].ndev);
+   if 
(netif_queue_stopped(g_linux_wlan->vif[1].ndev))
+   
netif_wake_queue(g_linux_wlan->vif[1].ndev);
}
 
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate 
buffers in chip. */
@@ -1312,7 +1312,7 @@ int mac_open(struct net_device *ndev)
 
/* loop through the NUM of supported devices and set the MAC address */
for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (ndev == g_linux_wlan->vif[i].wilc_netdev) {
+   if (ndev == g_linux_wlan->vif[i].ndev) {
memcpy(g_linux_wlan->vif[i].src_addr, mac_add, 
ETH_ALEN);
g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
@@ -1478,8 +1478,8 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
   linux_wlan_tx_complete);
 
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
-   netif_stop_queue(g_linux_wlan->vif[0].wilc_netdev);
-   netif_stop_queue(g_linux_wlan->vif[1].wilc_netdev);
+   netif_stop_queue(g_linux_wlan->vif[0].ndev);
+   netif_stop_queue(g_linux_wlan->vif[1].ndev);
}
 
return 0;
@@ -1683,17 +1683,17 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   nic = netdev_priv(g_linux_wlan->vif[i].wilc_netdev);
+   nic = netdev_priv(g_linux_wlan->vif[i].ndev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
 
-   nic = netdev_priv(g_linux_wlan->vif[1].wilc_netdev); /* p2p0 */
+   nic = netdev_priv(g_linux_wlan->vif[1].ndev); /* p2p0 */

[PATCH V2 05/12] staging: wilc1000: rename aBSSID in the sturct wilc_vif

2015-10-19 Thread Tony Cho
This patch renames aBSSID in the struct wilc_vif to the bssid.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 14 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9d57962..493e02c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -367,8 +367,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid1 = pMacHeader + 4;
 
for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+   if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
return g_linux_wlan->vif[i].wilc_netdev;
 
PRINT_INFO(INIT_DBG, "Invalide handle\n");
@@ -377,8 +377,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid  = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+   if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
return g_linux_wlan->vif[i].wilc_netdev;
 
PRINT_INFO(INIT_DBG, "\n");
@@ -392,7 +392,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 
*pBSSID)
 
for (i = 0; i < g_linux_wlan->vif_num; i++)
if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
-   memcpy(g_linux_wlan->vif[i].aBSSID, pBSSID, 6);
+   memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
@@ -408,7 +408,7 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 ret_val = 0;
 
for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (memcmp(g_linux_wlan->vif[i].aBSSID, null_bssid, 6))
+   if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
ret_val++;
 
return ret_val;
@@ -1472,7 +1472,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
-   tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].aBSSID;
+   tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].bssid;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
   tx_data->size,
   linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b39ea18..c166d3f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2572,7 +2572,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
nic->iftype = STATION_MODE;
 
if (g_linux_wlan->initialized) {
-   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].aBSSID, TID);
+   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].bssid, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
 
@@ -2648,7 +2648,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = 
NL80211_IFTYPE_P2P_CLIENT\n");
 
-   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].aBSSID, TID);
+   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].bssid, TID);
 
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2760,7 +2760,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/*sent before downloading new FW. This is because it blocks on*/
/*hWaitResponse semaphore, which allows previous config*/
/*packets to actually take action on old FW*/
-   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan

[PATCH V2 08/12] staging: wilc1000: move clean up codes into wl_wlan_cleanup function

2015-10-19 Thread Tony Cho
This patch moves clean up codes from exit_wilc_driver into the wl_wlan_cleanup
newly introduced in this patch. In addition, it is called by linux_sdio_remove
function.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 95 ---
 drivers/staging/wilc1000/linux_wlan_sdio.c|  5 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 43 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 41a2f09..74b7cc0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1696,6 +1696,47 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(g_linux_wlan->vif[1].ndev, buff, size);
 }
 
+void wl_wlan_cleanup(void)
+{
+   int i = 0;
+   perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
+
+   if (g_linux_wlan &&
+  (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+   unregister_inetaddr_notifier(_dev_notifier);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+   nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
+   }
+
+   if (g_linux_wlan && g_linux_wlan->wilc_firmware)
+   release_firmware(g_linux_wlan->wilc_firmware);
+
+   if (g_linux_wlan &&
+  (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+   linux_wlan_lock_timeout(_exit_sync, 12 * 1000);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+   if (g_linux_wlan->vif[i].ndev)
+   if (nic[i]->mac_opened)
+   mac_close(g_linux_wlan->vif[i].ndev);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+   unregister_netdev(g_linux_wlan->vif[i].ndev);
+   wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
+   free_netdev(g_linux_wlan->vif[i].ndev);
+   }
+   }
+
+   kfree(g_linux_wlan);
+
+#if defined(WILC_DEBUGFS)
+   wilc_debugfs_remove();
+#endif
+   linux_wlan_device_detection(0);
+   linux_wlan_device_power(0);
+}
+
 int wilc_netdev_init(void)
 {
 
@@ -1828,49 +1869,6 @@ late_initcall(init_wilc_driver);
 
 static void __exit exit_wilc_driver(void)
 {
-   int i = 0;
-   perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
-   #define CLOSE_TIMEOUT (12 * 1000)
-
-   if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
-  || ((g_linux_wlan->vif[1].ndev) != 
NULL))) {
-   unregister_inetaddr_notifier(_dev_notifier);
-
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
-   nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
-   }
-
-   if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
-   release_firmware(g_linux_wlan->wilc_firmware);
-   g_linux_wlan->wilc_firmware = NULL;
-   }
-
-   if ((g_linux_wlan != NULL) && (((g_linux_wlan->vif[0].ndev) != NULL)
-  || ((g_linux_wlan->vif[1].ndev) != 
NULL))) {
-   PRINT_D(INIT_DBG, "Waiting for mac_close \n");
-
-   if (linux_wlan_lock_timeout(_exit_sync, CLOSE_TIMEOUT) < 
0)
-   PRINT_D(INIT_DBG, "Closed TimedOUT\n");
-   else
-   PRINT_D(INIT_DBG, "mac_closed\n");
-
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
-   /* close all opened interfaces */
-   if (g_linux_wlan->vif[i].ndev != NULL) {
-   if (nic[i]->mac_opened)
-   mac_close(g_linux_wlan->vif[i].ndev);
-   }
-   }
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
-   PRINT_D(INIT_DBG, "Unregistering netdev %p\n", 
g_linux_wlan->vif[i].ndev);
-   unregister_netdev(g_linux_wlan->vif[i].ndev);
-   PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
-   wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
-   PRINT_D(INIT_DBG, "Freeing netdev...\n");
-   free_netdev(g_linux_wlan->vif[i].ndev);
-   }
-   }
-
 #ifndef WILC_SDIO
PRINT_D(INIT_DBG, "SPI unregsiter...\n");
spi_unregister_driver(_bus);
@@ -1878,17 +1876,6 @@ static void __exit exit_wilc_driver(void)
PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
sdio_unregister_driver(_bus);
 #endif
-
-   kfree(g_linux_wlan);
-   g_linux_wlan = NULL;
-   printk(&q

[PATCH V2 04/12] staging: wilc1000: rename aSrcAddress in the struct wilc_vif

2015-10-19 Thread Tony Cho
This patch renames aSrcAddress in the struct wilc_vif to the src_addr.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 971b99a..9d57962 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1313,14 +1313,14 @@ int mac_open(struct net_device *ndev)
/* loop through the NUM of supported devices and set the MAC address */
for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->vif[i].wilc_netdev) {
-   memcpy(g_linux_wlan->vif[i].aSrcAddress, mac_add, 
ETH_ALEN);
+   memcpy(g_linux_wlan->vif[i].src_addr, mac_add, 
ETH_ALEN);
g_linux_wlan->vif[i].drvHandler = priv->hWILCWFIDrv;
break;
}
}
 
/* TODO: get MAC address whenever the source is EPROM - hardcoded and 
copy it to ndev*/
-   memcpy(ndev->dev_addr, g_linux_wlan->vif[i].aSrcAddress, ETH_ALEN);
+   memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN);
 
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f2c8a45..b39ea18 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2587,7 +2587,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/*Setting interface 1 drv handler and mac address in 
newly downloaded FW*/

host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
-   
g_linux_wlan->vif[0].aSrcAddress);
+   g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
@@ -2668,7 +2668,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 

host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
-   
g_linux_wlan->vif[0].aSrcAddress);
+   g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
@@ -2783,7 +2783,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/*Setting interface 1 drv handler and mac address in newly 
downloaded FW*/
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
-   g_linux_wlan->vif[0].aSrcAddress);
+   g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
 
/*Add saved WEP keys, if any*/
@@ -2888,7 +2888,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
 
-   linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].aSrcAddress);
+   linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].src_addr);
 
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 71cd3de..3089129 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -149,7 +149,7 @@ typedef struct {
 } struct_frame_reg;
 
 struct wilc_vif {
-   u8 aSrcAddress[ETH_ALEN];
+   u8 src_addr[ETH_ALEN];
u8 aBSSID[ETH_ALEN];
struct host_if_drv *drvHandler;
struct net_device *wilc_netdev;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 03/12] staging: wilc1000: rename strInterfaceInfo in the sturct wilc

2015-10-19 Thread Tony Cho
This patch renames strInterfaceInfo in the struct wilc to the vif. In
addition, unnecessary print statements around it are removed in this patch.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 91 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 80 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2bea103..971b99a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -366,24 +366,21 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid  = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
 
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN)) {
-   return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
-   }
-   }
+   for (i = 0; i < g_linux_wlan->vif_num; i++)
+   if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
+   !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+   return g_linux_wlan->vif[i].wilc_netdev;
+
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid  = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN) ||
-   !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, 
ETH_ALEN)) {
-   PRINT_D(INIT_DBG, "Ctx [%p]\n", 
g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
-   return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
-   }
-   }
+   for (i = 0; i < g_linux_wlan->vif_num; i++)
+   if (!memcmp(Bssid1, g_linux_wlan->vif[i].aBSSID, ETH_ALEN) ||
+   !memcmp(Bssid, g_linux_wlan->vif[i].aBSSID, ETH_ALEN))
+   return g_linux_wlan->vif[i].wilc_netdev;
+
PRINT_INFO(INIT_DBG, "\n");
return NULL;
 }
@@ -393,15 +390,13 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, 
u8 *pBSSID)
int i = 0;
int ret = -1;
 
-   PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == 
wilc_netdev) {
-   PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", 
pBSSID[0], pBSSID[1], pBSSID[2]);
-   memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, 
pBSSID, 6);
+   for (i = 0; i < g_linux_wlan->vif_num; i++)
+   if (g_linux_wlan->vif[i].wilc_netdev == wilc_netdev) {
+   memcpy(g_linux_wlan->vif[i].aBSSID, pBSSID, 6);
ret = 0;
break;
}
-   }
+
return ret;
 }
 
@@ -412,10 +407,10 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 null_bssid[6] = {0};
u8 ret_val = 0;
 
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, 
null_bssid, 6))
+   for (i = 0; i < g_linux_wlan->vif_num; i++)
+   if (memcmp(g_linux_wlan->vif[i].aBSSID, null_bssid, 6))
ret_val++;
-   }
+
return ret_val;
 }
 
@@ -462,10 +457,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && 
netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
-   if 
(netif_queue_stopped(g_linux_wlan->strInterfaceInfo[0].wilc_netdev))
-   
netif_wake_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
-   if 
(netif_queue_stopped(g_linux_wlan->strInterfaceInfo[1].wilc_netdev))
-   
netif_wake_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+   if 
(netif_queue_stopped(g_linux_wlan->vif[0].wilc_netdev))
+   
netif_wake_queue(g_linux_wlan->vif[0].wilc_netdev);
+   if 
(netif_queue_stopped(g_linux_wlan->vif[1].wilc_netdev))
+  

[PATCH V2 01/12] staging: wilc1000: change the type of wilc1000_initialized

2015-10-19 Thread Tony Cho
This patch changes the type of wilc1000_initialized in the struc wilc from int
to bool and also renames it to the initialized. In addition, unnecessary
wilc1000_initialized codes are removed in this patch.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 13 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b879b8b..191851b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -884,9 +884,7 @@ _fail_:
 /**/
 void wilc1000_wlan_deinit(struct wilc *nic)
 {
-
-   if (g_linux_wlan->wilc1000_initialized) {
-
+   if (g_linux_wlan->initialized)  {
printk("Deinitializing wilc1000  ...\n");
 
if (nic == NULL) {
@@ -935,7 +933,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
wlan_deinit_locks(g_linux_wlan);
 
/* announce that wilc1000 is not initialized */
-   g_linux_wlan->wilc1000_initialized = 0;
+   g_linux_wlan->initialized = false;
 
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
 
@@ -1143,10 +1141,9 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
perInterface_wlan_t *nic = p_nic;
int ret = 0;
 
-   if (!g_linux_wlan->wilc1000_initialized) {
+   if (!g_linux_wlan->initialized) {
g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
g_linux_wlan->close = 0;
-   g_linux_wlan->wilc1000_initialized = 0;
 
wlan_init_locks(g_linux_wlan);
 
@@ -1233,7 +1230,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
 
-   g_linux_wlan->wilc1000_initialized = 1;
+   g_linux_wlan->initialized = true;
return 0; /*success*/
 
 _fail_fw_start_:
@@ -1567,7 +1564,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, 
int cmd)
/* struct iwreq *wrq = (struct iwreq *) req;// tony moved to case 
SIOCSIWPRIV */
nic = netdev_priv(ndev);
 
-   if (!g_linux_wlan->wilc1000_initialized)
+   if (!g_linux_wlan->initialized)
return 0;
 
switch (cmd) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcbf1bd..e463090 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2418,7 +2418,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 
}
/*If mac is closed, then return*/
-   if (!g_linux_wlan->wilc1000_initialized) {
+   if (!g_linux_wlan->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
@@ -2571,7 +2571,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
 
-   if (g_linux_wlan->wilc1000_initialized) {
+   if (g_linux_wlan->initialized) {
host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2627,7 +2627,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
(struct key_params 
*)(_key_gtk_params));
}
 
-   if (g_linux_wlan->wilc1000_initialized) {
+   if (g_linux_wlan->initialized)  {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering 
Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
@@ -2658,7 +2658,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
nic->iftype = CLIENT_MODE;
 
 
-   if (g_linux_wlan->wilc1000_initialized) {
+   if (g_linux_wlan->initialized)  {
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
 
@@ -2712,7 +2712,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
refresh_scan(pri

[PATCH 00/12] WILC1000 V2 for the g_linux_wlan

2015-10-19 Thread Tony Cho
The series of V2 restore the global variable, wl to g_linux_wlan which is its
original name becasue it will be replaced with local structure and deleted.

Tony Cho (12):
  staging: wilc1000: change the type of wilc1000_initialized
  staging: wilc1000: rename u8NoIfcs in the struct wilc
  staging: wilc1000: rename strInterfaceInfo in the sturct wilc
  staging: wilc1000: rename aSrcAddress in the struct wilc_vif
  staging: wilc1000: rename aBSSID in the sturct wilc_vif
  staging: wilc1000: rename drvHandler in the struct wilc_vif
  staging: wilc1000: rename wilc_netdev in the struct wilc_vif
  staging: wilc1000: move clean up codes into wl_wlan_cleanup function
  staging: wilc1000: rename wilc_firmware in the struct wilc
  staging: wilc1000: remove COMPLEMENT_BOOT
  staging: wilc1000: introduce struct wilc_sdio for sdio data
  staging: wilc1000: assign pointer of g_linux_wlan to sdio device data

 drivers/staging/wilc1000/linux_wlan.c | 331 +++---
 drivers/staging/wilc1000/linux_wlan_sdio.c|  33 ++-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  87 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  19 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  18 --
 5 files changed, 169 insertions(+), 319 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 06/12] staging: wilc1000: rename drvHandler in the struct wilc_vif

2015-10-19 Thread Tony Cho
This patch renames drvHandler in the struct wilc_vif to the hif_drv.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 493e02c..11e26fb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1314,7 +1314,7 @@ int mac_open(struct net_device *ndev)
for (i = 0; i < g_linux_wlan->vif_num; i++) {
if (ndev == g_linux_wlan->vif[i].wilc_netdev) {
memcpy(g_linux_wlan->vif[i].src_addr, mac_add, 
ETH_ALEN);
-   g_linux_wlan->vif[i].drvHandler = priv->hWILCWFIDrv;
+   g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c166d3f..2dfc0fd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2585,16 +2585,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
nic->iftype = interface_type;
 
/*Setting interface 1 drv handler and mac address in 
newly downloaded FW*/
-   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
-   host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv);
+   host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv,
g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].drvHandler,
+   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
+   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2666,16 +2666,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
 
-   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
-   host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv);
+   host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv,
g_linux_wlan->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].drvHandler,
+   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].drvHandler,
+   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2781,16 +2781,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 
 
/*Setting interface 1 drv handler and mac address in newly 
downloaded FW*/
-   host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].drvHandler);
-   host_int_set_MacAddress(g_linux_wlan->vif[0].drvHandler,
+   host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv);
+   host_int_set_MacAddre

Re: [PATCH 35/40] staging: wilc1000: rename variable s32Error

2015-10-18 Thread Tony Cho



On 2015년 10월 17일 13:56, Greg KH wrote:

On Thu, Oct 15, 2015 at 01:25:16PM +0900, Tony Cho wrote:

From: Leo Kim <leo@atmel.com>

This patch renames variable s32Error to result
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
  drivers/staging/wilc1000/host_interface.c | 784 ++
  1 file changed, 371 insertions(+), 413 deletions(-)

This patch doesn't apply, so I stopped in the series here, please rebase
and resend the rest of this series.


I will rebase and send them again.

Thanks,

Tony.



thanks,

greg k-h


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 01/40] staging: wilc1000: rename ssidLen of struct join_bss_param

2015-10-18 Thread Tony Cho



On 2015년 10월 17일 13:59, Greg KH wrote:

On Fri, Oct 16, 2015 at 01:37:31PM +0900, Tony Cho wrote:

From: Leo Kim <leo@atmel.com>

This patch renames ssidLen of struct join_bss_param to ssid_len
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
  drivers/staging/wilc1000/host_interface.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Doesn't apply, I missed that you sent this as v2, why did you do that?
What was wrong with v1?


This series of V2 includes Dan's suggestion, we don't have to add one blank 
line between malloc and null check if-statement.

In addition, some of global variables are declared as "static" because they are used in 
only one file so kbuild test robot indicated they had better be declared as "static".

So, I sent the series of them as V2. I can find the V1 of this series are 
already accepted so I will later make separate patch for them.

Thanks,

Tony.


thanks,

greg k-h


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/16] staging: wilc1000: rename g_linux_wlan to wl

2015-10-18 Thread Tony Cho



On 2015년 10월 17일 13:33, Greg KH wrote:

On Wed, Oct 14, 2015 at 08:46:31PM +0900, Tony Cho wrote:

This patch renames g_linux_wlan to wl.

Why?  What's wrong with g_linux_wlan?  You will need to delete this
entire variable soon anyway, might as well leave it alone until then.


The reason why I rename it to the "wl" is that there first is 80 ending line 
over issue due to its length where I want to modify
and also we will take our representative structure as "wl" in the future. As 
you expected, finally g_linux_wlan global variable will
all be deleted by referring it from the private structure as it is introduced 
in another 13 series of patch.

However, as you guided, I will leave it until all of patch is done.

Thanks,

Tony.


thanks,

greg k-h


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2] staging: wilc1000: wilc_msgqueue.c : remove the goto ERRORHANDER

2015-10-18 Thread Tony Cho



On 2015년 10월 17일 13:28, Greg KH wrote:

On Wed, Oct 14, 2015 at 05:52:55PM +0900, Tony Cho wrote:


On 2015년 10월 14일 17:32, Mike Rapoport wrote:

On Wed, Oct 14, 2015 at 02:55:43PM +0900, Tony Cho wrote:

From: Leo Kim <leo@atmel.com>

This patch removes goto ERRORHANDER and the result variable in wilc_mq_send.
Then, the error type is directly returned. If normal operation, freeing memory
is not needed in this function.
If an error occurs, returns an error after releasing the spin lock.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
V2: add releasing spinlock before returnig an error when an error happens.
---
  drivers/staging/wilc1000/wilc_msgqueue.c | 28 
  1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index b13809a..4dfd476 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -56,35 +56,38 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
  int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize)
  {
-   int result = 0;
unsigned long flags;
Message *pstrMessage = NULL;
if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {
PRINT_ER("pHandle or pvSendBuffer is null\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
spin_lock_irqsave(>strCriticalSection, flags);
/* construct a new message */
pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);

You can make this allocation outisde the spinlock, then there won't be
need to release it if the allocation fails.


-   if (!pstrMessage)
+
+   if (!pstrMessage) {
+   spin_unlock_irqrestore(>strCriticalSection, flags);
return -ENOMEM;
+   }
+
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
pstrMessage->pvBuffer = kmemdup(pvSendBuffer, u32SendBufferSize,
GFP_ATOMIC);
+
if (!pstrMessage->pvBuffer) {
-   result = -ENOMEM;
-   goto ERRORHANDLER;
+   spin_unlock_irqrestore(>strCriticalSection, flags);

You are still holding pHandle->hSem here. Moreover, all error paths
return while still holding pHandle->hSem.

Can you explain to me what you mean for holding hsem here? Basically, this 
function cannot release

the semaphore (of course, this synchronization mechanism will be changed, 
anyway) if errors happen.

The thread will do his work when it is released without unexpected situations.


I'd suggest, that instead of trying to return immediately, you'd better
move error handling code to the end of the function and use goto and
several labels to do appropriate cleanups depending on when the error
was caught. E.g.

I don't want to use goto statement as possible as I can. Do you
concern semaphore uses in this function?

You should use a goto, it will make the error unwinding much easier and
is a very common pattern in Linux kernel code.  It will save you many
lines in this function, please do it that way instead.


ok, I will do that,

Thanks,

Tony.



thanks,

greg k-h


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/13] staging: wilc1000: wlan_init_locks: change parameter and use nic-wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch changes function parameter type wilc with net_device and use netdev
private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f79160c..38b981d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -921,8 +921,13 @@ void wilc1000_wlan_deinit(struct wilc *nic)
}
 }
 
-int wlan_init_locks(struct wilc *p_nic)
+int wlan_init_locks(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
PRINT_D(INIT_DBG, "Initializing Locks ...\n");
 
@@ -1032,7 +1037,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
 
-   wlan_init_locks(wl);
+   wlan_init_locks(dev);
 
linux_to_wlan(, wl);
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/13] staging: wilc1000: mac_close: use netdev private wilc instead of wl

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4450658..8c98a0c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1377,6 +1377,7 @@ int mac_close(struct net_device *ndev)
struct wilc_priv *priv;
perInterface_wlan_t *nic;
struct host_if_drv *pstrWFIDrv;
+   struct wilc *wl;
 
nic = netdev_priv(ndev);
 
@@ -1386,6 +1387,7 @@ int mac_close(struct net_device *ndev)
}
 
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
+   wl = nic->wilc;
 
if (priv == NULL) {
PRINT_ER("priv = NULL\n");
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/13] staging: wilc1000: mac_open: use netdev private wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 38b981d..4450658 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1166,13 +1166,14 @@ int mac_open(struct net_device *ndev)
int i = 0;
struct wilc_priv *priv;
 
+   nic = netdev_priv(ndev);
+   wl = nic->wilc;
 #ifdef WILC_SPI
if (!wl || !wl->wilc_spidev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
 #endif
-   nic = netdev_priv(ndev);
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/13] staging: wilc1000: chage_virtual_intf: use netdev private wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ebba9d4..b34b7d0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2533,9 +2533,11 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
u8 interface_type;
u16 TID = 0;
u8 i;
+   struct wilc *wl;
 
nic = netdev_priv(dev);
priv = wiphy_priv(wiphy);
+   wl = nic->wilc;
 
PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n");
PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/13] staging: wilc1000: CfgConnectResult: use netdev private wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 270f454..97d9929 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -537,11 +537,15 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
struct net_device *dev;
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
connecting = 0;
 
priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
 
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/13] staging: wilc1000: wilc_mgmt_frame_register: use netdev private wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7599457..00ce76f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2396,12 +2396,12 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, 
struct wireless_dev *wdev,
 
struct wilc_priv *priv;
perInterface_wlan_t *nic;
-
+   struct wilc *wl;
 
priv = wiphy_priv(wiphy);
nic = netdev_priv(priv->wdev->netdev);
 
-
+   wl = nic->wilc;
 
if (!frame_type)
return;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/13] staging: wilc1000: del_key: use netdev private wilc instead of wl

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f96f5b8..7599457 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1359,8 +1359,12 @@ static int del_key(struct wiphy *wiphy, struct 
net_device *netdev,
   const u8 *mac_addr)
 {
struct wilc_priv *priv;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(netdev);
+   wl = nic->wilc;
 
/*delete saved keys, if any*/
if (netdev == wl->vif[0].ndev) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/13] staging: wilc1000: start_ap: use netdev private data wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 00ce76f..1a27728 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2889,8 +2889,12 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
struct cfg80211_beacon_data *beacon = &(settings->beacon);
struct wilc_priv *priv;
s32 s32Error = 0;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
 
PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = 
%zu Tail length = %zu\n",
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/13] staging: wilc1000: add_key: use netdev private wilc instead of wl

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

Use netdev private data member wilc instead of global variable wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 97d9929..f96f5b8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1083,8 +1083,12 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(netdev);
+   wl = nic->wilc;
 
PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", 
params->cipher);
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/13] staging: wilc1000: wilc1000_wlan_init: use netdev private wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch uses netdev private data member wilc instead of global variabl wl.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 90c39b6..f79160c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1025,6 +1025,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 {
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
+   struct wilc *wl = nic->wilc;
int ret = 0;
 
if (!wl->initialized) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/13] staging: wilc1000: wilc1000_wlan_deinit: change argument and use nic->wilc

2015-10-16 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch changes function argument wilc with net_device and use nic->wilc
instead of global variable wl. The null check codes should be placed before it
is used so move it.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 25 ++-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  7 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8c98a0c..b32a8ce 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -49,7 +49,6 @@ extern bool g_obtainingIP;
 extern u16 Set_machw_change_vir_if(bool bValue);
 extern void resolve_disconnect_aberration(void *drvHandler);
 extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
 extern struct timer_list hDuringIpTimer;
 
 static int linux_wlan_device_power(int on_off)
@@ -861,16 +860,22 @@ _fail_:
 }
 
 /**/
-void wilc1000_wlan_deinit(struct wilc *nic)
+void wilc1000_wlan_deinit(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
+   if (!wl) {
+   netdev_err(dev, "wl is NULL\n");
+   return;
+   }
+
if (wl->initialized) {
printk("Deinitializing wilc1000  ...\n");
 
-   if (nic == NULL) {
-   PRINT_ER("nic is NULL\n");
-   return;
-   }
-
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
/* johnny : remove */
PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n");
@@ -888,7 +893,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
up(>txq_event);
 
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
-   wlan_deinitialize_threads(nic);
+   wlan_deinitialize_threads(wl);
 
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(wl);
@@ -1226,7 +1231,7 @@ int mac_open(struct net_device *ndev)
 
 _err_:
wilc_deinit_host_int(ndev);
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
return ret;
 }
 
@@ -1425,7 +1430,7 @@ int mac_close(struct net_device *ndev)
if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
wl->close = 1;
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
WILC_WFI_deinit_mon_interface();
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b34b7d0..270f454 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2522,7 +2522,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-void wilc1000_wlan_deinit(struct wilc *nic);
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
 
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
@@ -2582,7 +2581,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/*Eliminate host interface blocking state*/
up(>cfg_event);
 
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
nic->iftype = interface_type;
@@ -2664,7 +2663,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
 
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
 
@@ -2778,7 +2777,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index cb23134..5769359 100644
--- a/dr

[PATCH V2 03/40] staging: wilc1000: rename u8OppEnable of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames u8OppEnable of struct join_bss_param to opp_enabled
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2b8e412..91e7072 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -220,7 +220,7 @@ struct join_bss_param {
u8 rsn_cap[2];
u32 tsf;
u8 noa_enabled;
-   u8 u8OppEnable;
+   u8 opp_enabled;
u8 u8CtWindow;
u8 u8Count;
u8 u8Index;
@@ -1195,10 +1195,9 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
*(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
 
*(pu8CurrByte++) = ptstrJoinBssParam->u8Index;
+   *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled;
 
-   *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable;
-
-   if (ptstrJoinBssParam->u8OppEnable)
+   if (ptstrJoinBssParam->opp_enabled)
*(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow;
 
*(pu8CurrByte++) = ptstrJoinBssParam->u8Count;
@@ -4988,10 +4987,11 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
pNewJoinBssParam->u8Index = pu8IEs[index + 9];
 
if (pu8IEs[index + 10] & BIT(7)) {
-   pNewJoinBssParam->u8OppEnable = 1;
+   pNewJoinBssParam->opp_enabled = 1;
pNewJoinBssParam->u8CtWindow = 
pu8IEs[index + 10];
-   } else
-   pNewJoinBssParam->u8OppEnable = 0;
+   } else {
+   pNewJoinBssParam->opp_enabled = 0;
+   }
 
PRINT_D(GENERIC_DBG, "P2P Dump\n");
for (i = 0; i < pu8IEs[index + 7]; i++)
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 02/40] staging: wilc1000: rename u8NoaEnbaled of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames u8NoaEnbaled of struct join_bss_param to noa_enabled
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e2588ef..2b8e412 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -219,7 +219,7 @@ struct join_bss_param {
u8 rsn_auth_policy[3];
u8 rsn_cap[2];
u32 tsf;
-   u8 u8NoaEnbaled;
+   u8 noa_enabled;
u8 u8OppEnable;
u8 u8CtWindow;
u8 u8Count;
@@ -1184,9 +1184,9 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap);
 
*(pu8CurrByte++) = REAL_JOIN_REQ;
+   *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled;
 
-   *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled;
-   if (ptstrJoinBssParam->u8NoaEnbaled) {
+   if (ptstrJoinBssParam->noa_enabled) {
PRINT_D(HOSTINF_DBG, "NOA present\n");
 
*(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF;
@@ -4984,7 +4984,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
u16 u16P2P_count;
 
pNewJoinBssParam->tsf = 
ptstrNetworkInfo->u32Tsf;
-   pNewJoinBssParam->u8NoaEnbaled = 1;
+   pNewJoinBssParam->noa_enabled = 1;
pNewJoinBssParam->u8Index = pu8IEs[index + 9];
 
if (pu8IEs[index + 10] & BIT(7)) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 06/40] staging: wilc1000: rename u8Index of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames u8Index of struct join_bss_param to idx
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e8a35d3..75a4279 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -223,7 +223,7 @@ struct join_bss_param {
u8 opp_enabled;
u8 ct_window;
u8 cnt;
-   u8 u8Index;
+   u8 idx;
u8 au8Duration[4];
u8 au8Interval[4];
u8 au8StartTime[4];
@@ -1194,8 +1194,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
*(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
*(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
 
-   *(pu8CurrByte++) = ptstrJoinBssParam->u8Index;
*(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled;
+   *(pu8CurrByte++) = ptstrJoinBssParam->idx;
 
if (ptstrJoinBssParam->opp_enabled)
*(pu8CurrByte++) = ptstrJoinBssParam->ct_window;
@@ -4984,7 +4984,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
 
pNewJoinBssParam->tsf = 
ptstrNetworkInfo->u32Tsf;
pNewJoinBssParam->noa_enabled = 1;
-   pNewJoinBssParam->u8Index = pu8IEs[index + 9];
+   pNewJoinBssParam->idx = pu8IEs[index + 9];
 
if (pu8IEs[index + 10] & BIT(7)) {
pNewJoinBssParam->opp_enabled = 1;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 09/40] staging: wilc1000: rename au8StartTime of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames au8StartTime of struct join_bss_param to start_time
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5cbba1a..320073e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -226,7 +226,7 @@ struct join_bss_param {
u8 idx;
u8 duration[4];
u8 interval[4];
-   u8 au8StartTime[4];
+   u8 start_time[4];
 };
 
 enum scan_conn_timer {
@@ -1208,10 +1208,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
memcpy(pu8CurrByte, ptstrJoinBssParam->interval, 
sizeof(ptstrJoinBssParam->interval));
pu8CurrByte += sizeof(ptstrJoinBssParam->interval);
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, 
sizeof(ptstrJoinBssParam->au8StartTime));
-
-   pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime);
-
+   memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, 
sizeof(ptstrJoinBssParam->start_time));
+   pu8CurrByte += sizeof(ptstrJoinBssParam->start_time);
} else
PRINT_D(HOSTINF_DBG, "NOA not present\n");
 
@@ -5004,7 +5002,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
memcpy(pNewJoinBssParam->interval, pu8IEs + 
u16P2P_count, 4);
u16P2P_count += 4;
 
-   memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + 
u16P2P_count, 4);
+   memcpy(pNewJoinBssParam->start_time, pu8IEs + 
u16P2P_count, 4);
 
index += pu8IEs[index + 1] + 2;
continue;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 08/40] staging: wilc1000: rename au8Interval of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames au8Interval of struct join_bss_param to interval
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0c5cf08..5cbba1a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -225,7 +225,7 @@ struct join_bss_param {
u8 cnt;
u8 idx;
u8 duration[4];
-   u8 au8Interval[4];
+   u8 interval[4];
u8 au8StartTime[4];
 };
 
@@ -1205,9 +1205,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
memcpy(pu8CurrByte, ptstrJoinBssParam->duration, 
sizeof(ptstrJoinBssParam->duration));
pu8CurrByte += sizeof(ptstrJoinBssParam->duration);
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, 
sizeof(ptstrJoinBssParam->au8Interval));
-
-   pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval);
+   memcpy(pu8CurrByte, ptstrJoinBssParam->interval, 
sizeof(ptstrJoinBssParam->interval));
+   pu8CurrByte += sizeof(ptstrJoinBssParam->interval);
 
memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, 
sizeof(ptstrJoinBssParam->au8StartTime));
 
@@ -5002,7 +5001,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
memcpy(pNewJoinBssParam->duration, pu8IEs + 
u16P2P_count, 4);
u16P2P_count += 4;
 
-   memcpy(pNewJoinBssParam->au8Interval, pu8IEs + 
u16P2P_count, 4);
+   memcpy(pNewJoinBssParam->interval, pu8IEs + 
u16P2P_count, 4);
u16P2P_count += 4;
 
memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + 
u16P2P_count, 4);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 07/40] staging: wilc1000: rename au8Duration of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames au8Duration of struct join_bss_param to duration
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 75a4279..0c5cf08 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -224,7 +224,7 @@ struct join_bss_param {
u8 ct_window;
u8 cnt;
u8 idx;
-   u8 au8Duration[4];
+   u8 duration[4];
u8 au8Interval[4];
u8 au8StartTime[4];
 };
@@ -1202,9 +1202,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
 
*(pu8CurrByte++) = ptstrJoinBssParam->cnt;
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, 
sizeof(ptstrJoinBssParam->au8Duration));
-
-   pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration);
+   memcpy(pu8CurrByte, ptstrJoinBssParam->duration, 
sizeof(ptstrJoinBssParam->duration));
+   pu8CurrByte += sizeof(ptstrJoinBssParam->duration);
 
memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, 
sizeof(ptstrJoinBssParam->au8Interval));
 
@@ -5000,7 +4999,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
pNewJoinBssParam->cnt = pu8IEs[index + 11];
u16P2P_count = index + 12;
 
-   memcpy(pNewJoinBssParam->au8Duration, pu8IEs + 
u16P2P_count, 4);
+   memcpy(pNewJoinBssParam->duration, pu8IEs + 
u16P2P_count, 4);
u16P2P_count += 4;
 
memcpy(pNewJoinBssParam->au8Interval, pu8IEs + 
u16P2P_count, 4);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 04/40] staging: wilc1000: rename u8CtWindow of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames u8CtWindow of struct join_bss_param to ct_window
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 91e7072..07c5213 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -221,7 +221,7 @@ struct join_bss_param {
u32 tsf;
u8 noa_enabled;
u8 opp_enabled;
-   u8 u8CtWindow;
+   u8 ct_window;
u8 u8Count;
u8 u8Index;
u8 au8Duration[4];
@@ -1198,7 +1198,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
*(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled;
 
if (ptstrJoinBssParam->opp_enabled)
-   *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow;
+   *(pu8CurrByte++) = ptstrJoinBssParam->ct_window;
 
*(pu8CurrByte++) = ptstrJoinBssParam->u8Count;
 
@@ -4988,7 +4988,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
 
if (pu8IEs[index + 10] & BIT(7)) {
pNewJoinBssParam->opp_enabled = 1;
-   pNewJoinBssParam->u8CtWindow = 
pu8IEs[index + 10];
+   pNewJoinBssParam->ct_window = 
pu8IEs[index + 10];
} else {
pNewJoinBssParam->opp_enabled = 0;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 05/40] staging: wilc1000: rename u8Count of struct join_bss_param

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames u8Count of struct join_bss_param to cnt
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 07c5213..e8a35d3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -222,7 +222,7 @@ struct join_bss_param {
u8 noa_enabled;
u8 opp_enabled;
u8 ct_window;
-   u8 u8Count;
+   u8 cnt;
u8 u8Index;
u8 au8Duration[4];
u8 au8Interval[4];
@@ -1200,7 +1200,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
if (ptstrJoinBssParam->opp_enabled)
*(pu8CurrByte++) = ptstrJoinBssParam->ct_window;
 
-   *(pu8CurrByte++) = ptstrJoinBssParam->u8Count;
+   *(pu8CurrByte++) = ptstrJoinBssParam->cnt;
 
memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, 
sizeof(ptstrJoinBssParam->au8Duration));
 
@@ -4997,7 +4997,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
for (i = 0; i < pu8IEs[index + 7]; i++)
PRINT_D(GENERIC_DBG, " %x\n", 
pu8IEs[index + 9 + i]);
 
-   pNewJoinBssParam->u8Count = pu8IEs[index + 11];
+   pNewJoinBssParam->cnt = pu8IEs[index + 11];
u16P2P_count = index + 12;
 
memcpy(pNewJoinBssParam->au8Duration, pu8IEs + 
u16P2P_count, 4);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 31/40] staging: wilc1000: rename variable gu8FlushedAuthType

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8FlushedAuthType to auth_type
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:267:4: sparse: symbol
   'auth_type' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e15aeb1..f06280b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -264,7 +264,7 @@ static u8 del_beacon;
 static u8 *join_req;
 static u8 *info_element;
 static u8 mode_11i;
-u8 gu8FlushedAuthType;
+static u8 auth_type;
 u32 gu32FlushedJoinReqSize;
 u32 gu32FlushedInfoElemAsocSize;
 struct host_if_drv *gu8FlushedJoinReqDrvHandler;
@@ -1100,7 +1100,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
-   gu8FlushedAuthType = 
(u8)hif_drv->strWILC_UsrConnReq.tenuAuth_type;
+   auth_type = (u8)hif_drv->strWILC_UsrConnReq.tenuAuth_type;
 
PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", 
hif_drv->strWILC_UsrConnReq.tenuAuth_type);
PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n",
@@ -1317,7 +1317,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
strWIDList[u32WidsCount].type = WID_CHAR;
strWIDList[u32WidsCount].size = sizeof(char);
-   strWIDList[u32WidsCount].val = (s8 *)();
+   strWIDList[u32WidsCount].val = (s8 *)(_type);
u32WidsCount++;
 
strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 29/40] staging: wilc1000: rename variable gu8FlushedInfoElemAsoc

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8FlushedInfoElemAsoc to info_element
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
- drivers/staging/wilc1000/host_interface.c:268:5: sparse: symbol
  'info_element' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 29 -
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a97583a..db63886 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -262,7 +262,7 @@ static u32 inactive_time;
 static u8 del_beacon;
 
 static u8 *join_req;
-u8 *gu8FlushedInfoElemAsoc;
+static u8 *info_element;
 u8 gu8Flushed11iMode;
 u8 gu8FlushedAuthType;
 u32 gu32FlushedJoinReqSize;
@@ -1076,8 +1076,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
 
gu32FlushedInfoElemAsocSize = 
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
-   gu8FlushedInfoElemAsoc =  
kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL);
-   memcpy(gu8FlushedInfoElemAsoc, 
hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
+   info_element = kmalloc(gu32FlushedInfoElemAsocSize, 
GFP_KERNEL);
+   memcpy(info_element, 
hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
   gu32FlushedInfoElemAsocSize);
}
}
@@ -1302,7 +1302,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
 
strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
-   strWIDList[u32WidsCount].val = gu8FlushedInfoElemAsoc;
+   strWIDList[u32WidsCount].val = info_element;
strWIDList[u32WidsCount].size = gu32FlushedInfoElemAsocSize;
u32WidsCount++;
 
@@ -1411,9 +1411,10 @@ static s32 Handle_ConnectTimeout(struct host_if_drv 
*hif_drv)
kfree(join_req);
join_req = NULL;
}
-   if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
-   kfree(gu8FlushedInfoElemAsoc);
-   gu8FlushedInfoElemAsoc = NULL;
+
+   if (info_element != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
+   kfree(info_element);
+   info_element = NULL;
}
 
return s32Error;
@@ -1714,9 +1715,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
kfree(join_req);
join_req = NULL;
}
-   if (gu8FlushedInfoElemAsoc != NULL && 
gu8FlushedJoinReqDrvHandler == hif_drv) {
-   kfree(gu8FlushedInfoElemAsoc);
-   gu8FlushedInfoElemAsoc = NULL;
+
+   if (info_element != NULL && gu8FlushedJoinReqDrvHandler 
== hif_drv) {
+   kfree(info_element);
+   info_element = NULL;
}
 
hif_drv->enuHostIFstate = HOST_IF_IDLE;
@@ -2106,9 +2108,10 @@ static void Handle_Disconnect(struct host_if_drv 
*hif_drv)
kfree(join_req);
join_req = NULL;
}
-   if (gu8FlushedInfoElemAsoc != NULL && 
gu8FlushedJoinReqDrvHandler == hif_drv) {
-   kfree(gu8FlushedInfoElemAsoc);
-   gu8FlushedInfoElemAsoc = NULL;
+
+   if (info_element != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
+   kfree(info_element);
+   info_element = NULL;
}
 
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 34/40] staging: wilc1000: rename variable gu8FlushedJoinReqDrvHandler

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8FlushedJoinReqDrvHandler to join_req_drv
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:270:20: sparse: symbol
   'join_req_drv' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)
 mode change 100755 => 100644 drivers/staging/wilc1000/host_interface.c

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
old mode 100755
new mode 100644
index 9d747b5..0b3c991
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -267,7 +267,7 @@ static u8 mode_11i;
 static u8 auth_type;
 static u32 join_req_size;
 static u32 info_element_size;
-struct host_if_drv *gu8FlushedJoinReqDrvHandler;
+static struct host_if_drv *join_req_drv;
 #define REAL_JOIN_REQ 0
 #define FLUSHED_JOIN_REQ 1
 #define FLUSHED_BYTE_POS 79
@@ -1210,7 +1210,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
memcpy(join_req, pu8CurrByte, join_req_size);
-   gu8FlushedJoinReqDrvHandler = hif_drv;
+   join_req_drv = hif_drv;
}
 
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
@@ -1331,7 +1331,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
u32WidsCount++;
 
s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
-  
get_id_from_handler(gu8FlushedJoinReqDrvHandler));
+  get_id_from_handler(join_req_drv));
if (s32Error) {
PRINT_ER("failed to send config packet\n");
s32Error = -EINVAL;
@@ -1406,12 +1406,12 @@ static s32 Handle_ConnectTimeout(struct host_if_drv 
*hif_drv)
 
eth_zero_addr(u8ConnectedSSID);
 
-   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
+   if (join_req != NULL && join_req_drv == hif_drv) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
+   if (info_element != NULL && join_req_drv == hif_drv) {
kfree(info_element);
info_element = NULL;
}
@@ -1710,12 +1710,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
 
-   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
+   if (join_req != NULL && join_req_drv == hif_drv) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element != NULL && gu8FlushedJoinReqDrvHandler 
== hif_drv) {
+   if (info_element != NULL && join_req_drv == hif_drv) {
kfree(info_element);
info_element = NULL;
}
@@ -2103,12 +2103,12 @@ static void Handle_Disconnect(struct host_if_drv 
*hif_drv)
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
 
-   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) 
{
+   if (join_req != NULL && join_req_drv == hif_drv) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
+   if (info_element != NULL && join_req_drv == hif_drv) {
kfree(info_element);
info_element = NULL;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 30/40] staging: wilc1000: rename variable gu8Flushed11iMode

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8Flushed11iMode to mode_11i
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:266:4: sparse: symbol
   'mode_11i' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index db63886..e15aeb1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -263,7 +263,7 @@ static u8 del_beacon;
 
 static u8 *join_req;
 static u8 *info_element;
-u8 gu8Flushed11iMode;
+static u8 mode_11i;
 u8 gu8FlushedAuthType;
 u32 gu32FlushedJoinReqSize;
 u32 gu32FlushedInfoElemAsocSize;
@@ -1088,7 +1088,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
-   gu8Flushed11iMode = hif_drv->strWILC_UsrConnReq.u8security;
+   mode_11i = hif_drv->strWILC_UsrConnReq.u8security;
 
PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", 
hif_drv->strWILC_UsrConnReq.u8security);
 
@@ -1309,7 +1309,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
strWIDList[u32WidsCount].type = WID_CHAR;
strWIDList[u32WidsCount].size = sizeof(char);
-   strWIDList[u32WidsCount].val = (s8 *)(&(gu8Flushed11iMode));
+   strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i));
u32WidsCount++;
 
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 28/40] staging: wilc1000: rename variable gu8FlushedJoinReq

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8FlushedJoinReq to join_req
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:264:4: sparse: symbol
   'join_req' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 82d058f..a97583a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -261,7 +261,7 @@ static u8 get_ip[2][4];
 static u32 inactive_time;
 static u8 del_beacon;
 
-u8 *gu8FlushedJoinReq;
+static u8 *join_req;
 u8 *gu8FlushedInfoElemAsoc;
 u8 gu8Flushed11iMode;
 u8 gu8FlushedAuthType;
@@ -1113,7 +1113,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
gu32FlushedJoinReqSize = strWIDList[u32WidsCount].size;
-   gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL);
+   join_req = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL);
}
if (strWIDList[u32WidsCount].val == NULL) {
s32Error = -EFAULT;
@@ -1210,7 +1210,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
-   memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize);
+   memcpy(join_req, pu8CurrByte, gu32FlushedJoinReqSize);
gu8FlushedJoinReqDrvHandler = hif_drv;
}
 
@@ -1323,7 +1323,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
strWIDList[u32WidsCount].type = WID_STR;
strWIDList[u32WidsCount].size = gu32FlushedJoinReqSize;
-   strWIDList[u32WidsCount].val = (s8 *)gu8FlushedJoinReq;
+   strWIDList[u32WidsCount].val = (s8 *)join_req;
pu8CurrByte = strWIDList[u32WidsCount].val;
 
pu8CurrByte += FLUSHED_BYTE_POS;
@@ -1407,9 +1407,9 @@ static s32 Handle_ConnectTimeout(struct host_if_drv 
*hif_drv)
 
eth_zero_addr(u8ConnectedSSID);
 
-   if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
-   kfree(gu8FlushedJoinReq);
-   gu8FlushedJoinReq = NULL;
+   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
+   kfree(join_req);
+   join_req = NULL;
}
if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
kfree(gu8FlushedInfoElemAsoc);
@@ -1710,9 +1710,9 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
 
-   if (gu8FlushedJoinReq != NULL && 
gu8FlushedJoinReqDrvHandler == hif_drv) {
-   kfree(gu8FlushedJoinReq);
-   gu8FlushedJoinReq = NULL;
+   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
+   kfree(join_req);
+   join_req = NULL;
}
if (gu8FlushedInfoElemAsoc != NULL && 
gu8FlushedJoinReqDrvHandler == hif_drv) {
kfree(gu8FlushedInfoElemAsoc);
@@ -2102,9 +2102,9 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
 
-   if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == 
hif_drv) {
-   kfree(gu8FlushedJoinReq);
-   gu8FlushedJoinReq = NULL;
+   if (join_req != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) 
{
+   kfree(join_req);
+   join_req = NULL;
}
if (gu8FlushedInfoElemAsoc != NULL && 
gu8FlushedJoinReqDrvHandler == hif_drv) {
kfree(gu8FlushedInfoElemAsoc);
@@ -3634,7 +3634,7 @@ s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
s32 s32Error = 0;
struct host_if_msg msg;
 
-   if (!gu8FlushedJoinReq) {
+   if (!join_req) {
s32Error = -EFAULT;
return s32Error;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 26/40] staging: wilc1000: rename variable gu8DelBcn

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8DelBcn to del_beacon
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ea3c011..9f5db14 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static u8 ch_no;
 static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 inactive_time;
-static u8 gu8DelBcn;
+static u8 del_beacon;
 static u32 gu32WidConnRstHack;
 
 u8 *gu8FlushedJoinReq;
@@ -2373,7 +2373,7 @@ static void Handle_DelBeacon(struct host_if_drv *hif_drv)
strWID.id = (u16)WID_DEL_BEACON;
strWID.type = WID_CHAR;
strWID.size = sizeof(char);
-   strWID.val = 
+   strWID.val = _beacon;
 
if (strWID.val == NULL)
return;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 27/40] staging: wilc1000: remove unused variable gu32WidConnRstHack

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch removes unused the variable gu32WidConnRstHack.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9f5db14..82d058f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -260,7 +260,6 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 inactive_time;
 static u8 del_beacon;
-static u32 gu32WidConnRstHack;
 
 u8 *gu8FlushedJoinReq;
 u8 *gu8FlushedInfoElemAsoc;
@@ -1209,7 +1208,6 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
 
pu8CurrByte = strWIDList[u32WidsCount].val;
u32WidsCount++;
-   gu32WidConnRstHack = 0;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 24/40] staging: wilc1000: rename variable gs8GetIP

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gs8GetIP to get_ip
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7e436fb..59cbf90 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -257,7 +257,7 @@ static s8 rssi;
 static s8 link_speed;
 static u8 ch_no;
 static u8 set_ip[2][4];
-static u8 gs8GetIP[2][4];
+static u8 get_ip[2][4];
 static u32 gu32InactiveTime;
 static u8 gu8DelBcn;
 static u32 gu32WidConnRstHack;
@@ -456,11 +456,11 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
 
-   memcpy(gs8GetIP[idx], strWID.val, IP_ALEN);
+   memcpy(get_ip[idx], strWID.val, IP_ALEN);
 
kfree(strWID.val);
 
-   if (memcmp(gs8GetIP[idx], set_ip[idx], IP_ALEN) != 0)
+   if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
host_int_setup_ipaddress(hif_drv, set_ip[idx], idx);
 
if (s32Error != 0) {
@@ -469,7 +469,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
}
 
PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx);
-   PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]);
+   PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]);
PRINT_INFO(HOSTINF_DBG, "\n");
 
return s32Error;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 32/40] staging: wilc1000: rename variable gu32FlushedJoinReqSize

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu32FlushedJoinReqSize to join_req_size
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:268:5: sparse: symbol
   'join_req_size' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f06280b..f41a365 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -265,7 +265,7 @@ static u8 *join_req;
 static u8 *info_element;
 static u8 mode_11i;
 static u8 auth_type;
-u32 gu32FlushedJoinReqSize;
+static u32 join_req_size;
 u32 gu32FlushedInfoElemAsocSize;
 struct host_if_drv *gu8FlushedJoinReqDrvHandler;
 #define REAL_JOIN_REQ 0
@@ -1112,8 +1112,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, 
GFP_KERNEL);
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
-   gu32FlushedJoinReqSize = strWIDList[u32WidsCount].size;
-   join_req = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL);
+   join_req_size = strWIDList[u32WidsCount].size;
+   join_req = kmalloc(join_req_size, GFP_KERNEL);
}
if (strWIDList[u32WidsCount].val == NULL) {
s32Error = -EFAULT;
@@ -1210,7 +1210,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
-   memcpy(join_req, pu8CurrByte, gu32FlushedJoinReqSize);
+   memcpy(join_req, pu8CurrByte, join_req_size);
gu8FlushedJoinReqDrvHandler = hif_drv;
}
 
@@ -1322,7 +1322,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
 
strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
strWIDList[u32WidsCount].type = WID_STR;
-   strWIDList[u32WidsCount].size = gu32FlushedJoinReqSize;
+   strWIDList[u32WidsCount].size = join_req_size;
strWIDList[u32WidsCount].val = (s8 *)join_req;
pu8CurrByte = strWIDList[u32WidsCount].val;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 33/40] staging: wilc1000: rename variable gu32FlushedInfoElemAsocSize

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu32FlushedInfoElemAsocSize to info_element_size
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:269:5: sparse: symbol
   'info_element_size' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)
 mode change 100644 => 100755 drivers/staging/wilc1000/host_interface.c

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
old mode 100644
new mode 100755
index f41a365..9d747b5
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -266,7 +266,7 @@ static u8 *info_element;
 static u8 mode_11i;
 static u8 auth_type;
 static u32 join_req_size;
-u32 gu32FlushedInfoElemAsocSize;
+static u32 info_element_size;
 struct host_if_drv *gu8FlushedJoinReqDrvHandler;
 #define REAL_JOIN_REQ 0
 #define FLUSHED_JOIN_REQ 1
@@ -1074,11 +1074,10 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
-
-   gu32FlushedInfoElemAsocSize = 
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
-   info_element = kmalloc(gu32FlushedInfoElemAsocSize, 
GFP_KERNEL);
+   info_element_size = 
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
+   info_element = kmalloc(info_element_size, GFP_KERNEL);
memcpy(info_element, 
hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
-  gu32FlushedInfoElemAsocSize);
+  info_element_size);
}
}
strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
@@ -1303,7 +1302,7 @@ static s32 Handle_FlushConnect(struct host_if_drv 
*hif_drv)
strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
strWIDList[u32WidsCount].val = info_element;
-   strWIDList[u32WidsCount].size = gu32FlushedInfoElemAsocSize;
+   strWIDList[u32WidsCount].size = info_element_size;
u32WidsCount++;
 
strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 21/40] staging: wilc1000: rename variable gs8lnkspd

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gs8lnkspd to link_speed.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index eda6382..2648e43 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -254,7 +254,7 @@ static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 static bool scan_while_connected;
 
 static s8 rssi;
-static s8 gs8lnkspd;
+static s8 link_speed;
 static u8 gu8Chnl;
 static u8 gs8SetIP[2][4];
 static u8 gs8GetIP[2][4];
@@ -2188,11 +2188,11 @@ static void Handle_GetLinkspeed(struct host_if_drv 
*hif_drv)
s32 s32Error = 0;
struct wid strWID;
 
-   gs8lnkspd = 0;
+   link_speed = 0;
 
strWID.id = (u16)WID_LINKSPEED;
strWID.type = WID_CHAR;
-   strWID.val = 
+   strWID.val = _speed;
strWID.size = sizeof(char);
 
PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");
@@ -3971,9 +3971,7 @@ s32 host_int_get_link_speed(struct host_if_drv *hif_drv, 
s8 *ps8lnkspd)
return -EFAULT;
}
 
-
-   *ps8lnkspd = gs8lnkspd;
-
+   *ps8lnkspd = link_speed;
 
return s32Error;
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 23/40] staging: wilc1000: rename variable gs8SetIP

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gs8SetIP to set_ip
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c9126d0..7e436fb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -256,7 +256,7 @@ static bool scan_while_connected;
 static s8 rssi;
 static s8 link_speed;
 static u8 ch_no;
-static u8 gs8SetIP[2][4];
+static u8 set_ip[2][4];
 static u8 gs8GetIP[2][4];
 static u32 gu32InactiveTime;
 static u8 gu8DelBcn;
@@ -417,7 +417,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
 
PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set  IP = %pI4\n", idx, 
pu8IPAddr);
 
-   memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN);
+   memcpy(set_ip[idx], pu8IPAddr, IP_ALEN);
 
strWID.id = (u16)WID_IP_ADDRESS;
strWID.type = WID_STR;
@@ -460,8 +460,8 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
 
kfree(strWID.val);
 
-   if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0)
-   host_int_setup_ipaddress(hif_drv, gs8SetIP[idx], idx);
+   if (memcmp(gs8GetIP[idx], set_ip[idx], IP_ALEN) != 0)
+   host_int_setup_ipaddress(hif_drv, set_ip[idx], idx);
 
if (s32Error != 0) {
PRINT_ER("Failed to get IP address\n");
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 10/40] staging: wilc1000: remove unused variable gWFiDrvHandle

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch removes unused the variable gWFiDrvHandle.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 320073e..ad7c102 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -237,7 +237,6 @@ enum scan_conn_timer {
 
 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
-struct host_if_drv *gWFiDrvHandle;
 bool g_obtainingIP;
 u8 P2P_LISTEN_STATE;
 static struct task_struct *HostIFthreadHandler;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 12/40] staging: wilc1000: rename variable gMsgQHostIF

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gMsgQHostIF to hif_msg_q
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 109 +++---
 1 file changed, 53 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4f24a05..bb770ab1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -240,7 +240,7 @@ struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
 u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
-static WILC_MsgQueueHandle gMsgQHostIF;
+static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hSemHostIFthrdEnd;
 
 struct semaphore hSemDeinitDrvHandle;
@@ -2738,7 +2738,7 @@ static void ListenTimerCB(unsigned long arg)
msg.drv = hif_drv;
msg.body.remain_on_ch.u32ListenSessionID = 
hif_drv->strHostIfRemainOnChan.u32ListenSessionID;
 
-   s32Error = wilc_mq_send(, , sizeof(struct host_if_msg));
+   s32Error = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
if (s32Error)
PRINT_ER("wilc_mq_send fail\n");
 }
@@ -2926,7 +2926,7 @@ static int hostIFthread(void *pvArg)
memset(, 0, sizeof(struct host_if_msg));
 
while (1) {
-   wilc_mq_recv(, , sizeof(struct host_if_msg), 
);
+   wilc_mq_recv(_msg_q, , sizeof(struct host_if_msg), 
);
hif_drv = (struct host_if_drv *)msg.drv;
if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
@@ -2936,13 +2936,13 @@ static int hostIFthread(void *pvArg)
if ((!g_wilc_initialized)) {
PRINT_D(GENERIC_DBG, "--WAIT--");
usleep_range(200 * 1000, 200 * 1000);
-   wilc_mq_send(, , sizeof(struct 
host_if_msg));
+   wilc_mq_send(_msg_q, , sizeof(struct 
host_if_msg));
continue;
}
 
if (msg.id == HOST_IF_MSG_CONNECT && 
hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL) {
PRINT_D(HOSTINF_DBG, "Requeue connect request till scan 
done received\n");
-   wilc_mq_send(, , sizeof(struct 
host_if_msg));
+   wilc_mq_send(_msg_q, , sizeof(struct 
host_if_msg));
usleep_range(2 * 1000, 2 * 1000);
continue;
}
@@ -3136,7 +3136,7 @@ static void TimerCB_Scan(unsigned long arg)
msg.drv = pvArg;
msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED;
 
-   wilc_mq_send(, , sizeof(struct host_if_msg));
+   wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
 }
 
 static void TimerCB_Connect(unsigned long arg)
@@ -3148,7 +3148,7 @@ static void TimerCB_Connect(unsigned long arg)
msg.drv = pvArg;
msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED;
 
-   wilc_mq_send(, , sizeof(struct host_if_msg));
+   wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
 }
 
 s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
@@ -3182,7 +3182,7 @@ int host_int_remove_wep_key(struct host_if_drv *hif_drv, 
u8 index)
msg.drv = hif_drv;
msg.body.key_info.attr.wep.index = index;
 
-   result = wilc_mq_send(, , sizeof(struct host_if_msg));
+   result = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
if (result)
PRINT_ER("Error in sending message queue : Request to remove 
WEP key\n");
down(_drv->hSemTestKeyBlock);
@@ -3211,7 +3211,7 @@ s32 host_int_set_WEPDefaultKeyID(struct host_if_drv 
*hif_drv, u8 u8Index)
msg.drv = hif_drv;
msg.body.key_info.attr.wep.index = u8Index;
 
-   s32Error = wilc_mq_send(, , sizeof(struct host_if_msg));
+   s32Error = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
if (s32Error)
PRINT_ER("Error in sending message queue : Default key 
index\n");
down(_drv->hSemTestKeyBlock);
@@ -3246,7 +3246,7 @@ s32 host_int_add_wep_key_bss_sta(struct host_if_drv 
*hif_drv,
msg.body.key_info.attr.wep.key_len = (u8WepKeylen);
msg.body.key_info.attr.wep.index = u8Keyidx;
 
-   s32Error = wilc_mq_send(, , sizeof(struct host_if_msg));
+   s32Error = wilc_mq_send(_msg_q, , sizeof(struct host_if_msg));
if (s32Error)
PRINT_ER("Error in sending message queue :WEP Key\n");
down(_drv->hSemTestKeyBlock);
@@ -3290,7 +3290,7 @@ s32 host_int_add_wep_key_bss_ap(struct host_if_drv 
*hif_drv,
msg.body.key_info.attr.wep.mode = u8mode;
msg.body.key_info.attr.wep.auth_type = tenuAuth_type;
 
-   s

[PATCH V2 16/40] staging: wilc1000: rename variable hSemHostIntDeinit

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable hSemHostIntDeinit to hif_sema_deinit
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:247:18: sparse: symbol
   'hif_sema_deinit' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9346d42..5900972 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -244,7 +244,7 @@ static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
 static struct semaphore hif_sema_driver;
 static struct semaphore hif_sema_wait_response;
-struct semaphore hSemHostIntDeinit;
+static struct semaphore hif_sema_deinit;
 struct timer_list g_hPeriodicRSSI;
 
 
@@ -4249,7 +4249,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
if (clients_count == 0) {
sema_init(_sema_thread, 0);
sema_init(_sema_driver, 0);
-   sema_init(, 1);
+   sema_init(_sema_deinit, 1);
}
 
sema_init(_drv->hSemTestKeyBlock, 0);
@@ -4333,7 +4333,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
return 0;
}
 
-   down();
+   down(_sema_deinit);
 
terminated_handle = hif_drv;
PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", 
clients_count);
@@ -4395,7 +4395,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
 
clients_count--;
terminated_handle = NULL;
-   up();
+   up(_sema_deinit);
return s32Error;
 }
 
@@ -4438,7 +4438,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
int id;
struct host_if_drv *hif_drv = NULL;
 
-   down();
+   down(_sema_deinit);
 
id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | 
(pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
hif_drv = get_handler_from_id(id);
@@ -4447,13 +4447,13 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
 
if (!hif_drv || hif_drv == terminated_handle) {
PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n");
-   up();
+   up(_sema_deinit);
return;
}
 
if (!hif_drv->strWILC_UsrConnReq.pfUserConnectResult) {
PRINT_ER("Received mac status is not needed when there is no 
current Connect Reques\n");
-   up();
+   up(_sema_deinit);
return;
}
 
@@ -4471,7 +4471,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
if (s32Error)
PRINT_ER("Error in sending message queue asynchronous message 
info: Error(%d)\n", s32Error);
 
-   up();
+   up(_sema_deinit);
 }
 
 void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 15/40] staging: wilc1000: rename variable hWaitResponse

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable hWaitResponse to hif_sema_wait_response
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 32c73b1..9346d42 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -243,7 +243,7 @@ static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
 static struct semaphore hif_sema_driver;
-static struct semaphore hWaitResponse;
+static struct semaphore hif_sema_wait_response;
 struct semaphore hSemHostIntDeinit;
 struct timer_list g_hPeriodicRSSI;
 
@@ -526,7 +526,7 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
PRINT_ER("Failed to get mac address\n");
s32Error = -EFAULT;
}
-   up();
+   up(_sema_wait_response);
 
return s32Error;
 }
@@ -817,7 +817,7 @@ ERRORHANDLER:
 static s32 Handle_wait_msg_q_empty(void)
 {
g_wilc_initialized = 0;
-   up();
+   up(_sema_wait_response);
return 0;
 }
 
@@ -2253,7 +2253,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, 
struct rf_info *pstrStatis
if (s32Error)
PRINT_ER("Failed to send scan paramters config packet\n");
 
-   up();
+   up(_sema_wait_response);
return 0;
 
 }
@@ -2508,7 +2508,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv,
 ERRORHANDLER:
kfree(strWID.val);
 
-   up();
+   up(_sema_wait_response);
 }
 
 static void Handle_DelStation(struct host_if_drv *hif_drv,
@@ -2908,7 +2908,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv 
*hif_drv,
if (strWID.val != NULL)
kfree(strWID.val);
 
-   up();
+   up(_sema_wait_response);
 
return s32Error;
 
@@ -3505,7 +3505,7 @@ s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, 
u8 *pu8MacAddress)
return -EFAULT;
}
 
-   down();
+   down(_sema_wait_response);
return s32Error;
 }
 
@@ -3792,7 +3792,7 @@ int host_int_wait_msg_queue_idle(void)
result = -EINVAL;
}
 
-   down();
+   down(_sema_wait_response);
 
return result;
 }
@@ -3999,7 +3999,7 @@ s32 host_int_get_statistics(struct host_if_drv *hif_drv, 
struct rf_info *pstrSta
return -EFAULT;
}
 
-   down();
+   down(_sema_wait_response);
return s32Error;
 }
 
@@ -4229,7 +4229,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
 
gbScanWhileConnected = false;
 
-   sema_init(, 0);
+   sema_init(_sema_wait_response, 0);
 
hif_drv  = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL);
if (!hif_drv) {
@@ -4795,7 +4795,7 @@ s32 host_int_del_allstation(struct host_if_drv *hif_drv,
if (s32Error)
PRINT_ER("wilc_mq_send fail\n");
 
-   down();
+   down(_sema_wait_response);
 
return s32Error;
 
@@ -5091,7 +5091,7 @@ s32 host_int_delBASession(struct host_if_drv *hif_drv, 
char *pBSSID, char TID)
if (s32Error)
PRINT_ER("wilc_mq_send fail\n");
 
-   down();
+   down(_sema_wait_response);
 
return s32Error;
 }
@@ -5121,7 +5121,7 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv 
*hif_drv,
if (s32Error)
PRINT_ER("wilc_mq_send fail\n");
 
-   down();
+   down(_sema_wait_response);
 
return s32Error;
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 18/40] staging: wilc1000: rename variable gapu8RcvdAssocResp

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gapu8RcvdAssocResp to rcv_assoc_resp
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8c529d1..5112aee 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -249,7 +249,7 @@ static struct timer_list periodic_rssi;
 
 u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
-static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE];
+static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 
 bool gbScanWhileConnected;
 
@@ -1567,10 +1567,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
memset(, 0, sizeof(tstrConnectInfo));
 
if (u8MacStatus == MAC_CONNECTED) {
-   memset(gapu8RcvdAssocResp, 0, 
MAX_ASSOC_RESP_FRAME_SIZE);
+   memset(rcv_assoc_resp, 0, 
MAX_ASSOC_RESP_FRAME_SIZE);
 
host_int_get_assoc_res_info(hif_drv,
-   gapu8RcvdAssocResp,
+   rcv_assoc_resp,

MAX_ASSOC_RESP_FRAME_SIZE,

);
 
@@ -1579,7 +1579,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
if (u32RcvdAssocRespInfoLen != 0) {
 
PRINT_D(HOSTINF_DBG, "Parsing 
association response\n");
-   s32Err = 
ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen,
+   s32Err = 
ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen,

);
if (s32Err) {
PRINT_ER("ParseAssocRespInfo() 
returned error %d\n", s32Err);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 19/40] staging: wilc1000: rename variable gbScanWhileConnected

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gbScanWhileConnected to scan_while_connected
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:254:6: sparse: symbol
   'scan_while_connected' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5112aee..e309197 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -251,7 +251,7 @@ u8 
gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
 static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 
-bool gbScanWhileConnected;
+static bool scan_while_connected;
 
 static s8 gs8Rssi;
 static s8 gs8lnkspd;
@@ -918,9 +918,9 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
u32WidsCount++;
 
if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
-   gbScanWhileConnected = true;
+   scan_while_connected = true;
else if (hif_drv->enuHostIFstate == HOST_IF_IDLE)
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
 
s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
   get_id_from_handler(hif_drv));
@@ -1357,8 +1357,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv 
*hif_drv)
 
hif_drv->enuHostIFstate = HOST_IF_IDLE;
 
-   gbScanWhileConnected = false;
-
+   scan_while_connected = false;
 
memset(, 0, sizeof(tstrConnectInfo));
 
@@ -1658,7 +1657,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
} else {
PRINT_D(HOSTINF_DBG, "MAC status : %d and 
Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus);
hif_drv->enuHostIFstate = HOST_IF_IDLE;
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
}
 
if (strConnectInfo.pu8RespIEs != NULL) {
@@ -1723,7 +1722,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
}
 
hif_drv->enuHostIFstate = HOST_IF_IDLE;
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
 
} else if ((u8MacStatus == MAC_DISCONNECTED) &&
   (hif_drv->strWILC_UsrScanReq.pfUserScanResult != 
NULL)) {
@@ -2093,7 +2092,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = 
NULL\n");
}
 
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
 
hif_drv->enuHostIFstate = HOST_IF_IDLE;
 
@@ -4225,7 +4224,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
 
PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", 
clients_count + 1);
 
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
 
sema_init(_sema_wait_response, 0);
 
@@ -4361,7 +4360,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
 
hif_drv->enuHostIFstate = HOST_IF_IDLE;
 
-   gbScanWhileConnected = false;
+   scan_while_connected = false;
 
memset(, 0, sizeof(struct host_if_msg));
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 17/40] staging: wilc1000: rename variable g_hPeriodicRSSI

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable g_hPeriodicRSSI to periodic_rssi
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:248:19: sparse: symbol
   'periodic_rssi' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5900972..8c529d1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -245,9 +245,7 @@ static struct semaphore hif_sema_thread;
 static struct semaphore hif_sema_driver;
 static struct semaphore hif_sema_wait_response;
 static struct semaphore hif_sema_deinit;
-struct timer_list g_hPeriodicRSSI;
-
-
+static struct timer_list periodic_rssi;
 
 u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
@@ -4207,8 +4205,8 @@ static void GetPeriodicRSSI(unsigned long arg)
return;
}
}
-   g_hPeriodicRSSI.data = (unsigned long)hif_drv;
-   mod_timer(_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
+   periodic_rssi.data = (unsigned long)hif_drv;
+   mod_timer(_rssi, jiffies + msecs_to_jiffies(5000));
 }
 
 
@@ -4276,9 +4274,9 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
result = -EFAULT;
goto _fail_mq_;
}
-   setup_timer(_hPeriodicRSSI, GetPeriodicRSSI,
+   setup_timer(_rssi, GetPeriodicRSSI,
(unsigned long)hif_drv);
-   mod_timer(_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
+   mod_timer(_rssi, jiffies + msecs_to_jiffies(5000));
}
 
setup_timer(_drv->hScanTimer, TimerCB_Scan, 0);
@@ -4346,10 +4344,8 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
}
 
-
-   if (del_timer_sync(_hPeriodicRSSI)) {
+   if (del_timer_sync(_rssi))
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
-   }
 
del_timer_sync(_drv->hRemainOnChannel);
 
@@ -4370,9 +4366,9 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
memset(, 0, sizeof(struct host_if_msg));
 
if (clients_count == 1) {
-   if (del_timer_sync(_hPeriodicRSSI)) {
+   if (del_timer_sync(_rssi))
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
-   }
+
msg.id = HOST_IF_MSG_EXIT;
msg.drv = hif_drv;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 11/40] staging: wilc1000: rename variable HostIFthreadHandler

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable HostIFthreadHandler to hif_thread_handler
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ad7c102..4f24a05 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -239,7 +239,7 @@ static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 
1];
 struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
 u8 P2P_LISTEN_STATE;
-static struct task_struct *HostIFthreadHandler;
+static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle gMsgQHostIF;
 static struct semaphore hSemHostIFthrdEnd;
 
@@ -4271,8 +4271,10 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
PRINT_ER("Failed to creat MQ\n");
goto _fail_;
}
-   HostIFthreadHandler = kthread_run(hostIFthread, NULL, 
"WILC_kthread");
-   if (IS_ERR(HostIFthreadHandler)) {
+
+   hif_thread_handler = kthread_run(hostIFthread, NULL, 
"WILC_kthread");
+
+   if (IS_ERR(hif_thread_handler)) {
PRINT_ER("Failed to creat Thread\n");
result = -EFAULT;
goto _fail_mq_;
@@ -4316,7 +4318,7 @@ _fail_timer_2:
up(_drv->gtOsCfgValuesSem);
del_timer_sync(_drv->hConnectTimer);
del_timer_sync(_drv->hScanTimer);
-   kthread_stop(HostIFthreadHandler);
+   kthread_stop(hif_thread_handler);
 _fail_mq_:
wilc_mq_destroy();
 _fail_:
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 22/40] staging: wilc1000: rename variable gu8Chnl

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu8Chnl to ch_no
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2648e43..c9126d0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -255,7 +255,7 @@ static bool scan_while_connected;
 
 static s8 rssi;
 static s8 link_speed;
-static u8 gu8Chnl;
+static u8 ch_no;
 static u8 gs8SetIP[2][4];
 static u8 gs8GetIP[2][4];
 static u32 gu32InactiveTime;
@@ -2137,7 +2137,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
 
strWID.id = (u16)WID_CURRENT_CHANNEL;
strWID.type = WID_CHAR;
-   strWID.val = (s8 *)
+   strWID.val = (s8 *)_no;
strWID.size = sizeof(char);
 
PRINT_D(HOSTINF_DBG, "Getting channel value\n");
@@ -3852,7 +3852,7 @@ s32 host_int_get_host_chnl_num(struct host_if_drv 
*hif_drv, u8 *pu8ChNo)
PRINT_ER("wilc mq send fail\n");
down(_drv->hSemGetCHNL);
 
-   *pu8ChNo = gu8Chnl;
+   *pu8ChNo = ch_no;
 
return s32Error;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 20/40] staging: wilc1000: rename variable gs8Rssi

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gs8Rssi to rssi
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e309197..eda6382 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -253,7 +253,7 @@ static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
 
 static bool scan_while_connected;
 
-static s8 gs8Rssi;
+static s8 rssi;
 static s8 gs8lnkspd;
 static u8 gu8Chnl;
 static u8 gs8SetIP[2][4];
@@ -2165,7 +2165,7 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv)
 
strWID.id = (u16)WID_RSSI;
strWID.type = WID_CHAR;
-   strWID.val = 
+   strWID.val = 
strWID.size = sizeof(char);
 
PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");
@@ -3943,9 +3943,7 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 
*ps8Rssi)
return -EFAULT;
}
 
-
-   *ps8Rssi = gs8Rssi;
-
+   *ps8Rssi = rssi;
 
return s32Error;
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 14/40] staging: wilc1000: rename variable hSemDeinitDrvHandle

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable hSemDeinitDrvHandle to hif_sema_driver
to avoid CamelCase naming convention.

Add to static because follow warning reported by kbuild system.
 - drivers/staging/wilc1000/host_interface.c:245:18: sparse: symbol
   'hif_sema_driver' was not declared. Should it be static?

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a587080..32c73b1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -242,7 +242,7 @@ u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
-struct semaphore hSemDeinitDrvHandle;
+static struct semaphore hif_sema_driver;
 static struct semaphore hWaitResponse;
 struct semaphore hSemHostIntDeinit;
 struct timer_list g_hPeriodicRSSI;
@@ -370,8 +370,7 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
   pstrHostIfSetDrvHandler->u32Address);
 
if (!hif_drv)
-   up();
-
+   up(_sema_driver);
 
if (s32Error) {
PRINT_ER("Failed to set driver handler\n");
@@ -398,8 +397,7 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
 
 
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
-   up();
-
+   up(_sema_driver);
 
if (s32Error) {
PRINT_ER("Failed to set driver handler\n");
@@ -4250,7 +4248,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
if (clients_count == 0) {
sema_init(_sema_thread, 0);
-   sema_init(, 0);
+   sema_init(_sema_driver, 0);
sema_init(, 1);
}
 
@@ -4356,7 +4354,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
del_timer_sync(_drv->hRemainOnChannel);
 
host_int_set_wfi_drv_handler(NULL);
-   down();
+   down(_sema_driver);
 
if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {

hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 13/40] staging: wilc1000: rename variable hSemHostIFthrdEnd

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable hSemHostIFthrdEnd to hif_sema_thread
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index bb770ab1..a587080 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -241,8 +241,7 @@ bool g_obtainingIP;
 u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
-static struct semaphore hSemHostIFthrdEnd;
-
+static struct semaphore hif_sema_thread;
 struct semaphore hSemDeinitDrvHandle;
 static struct semaphore hWaitResponse;
 struct semaphore hSemHostIntDeinit;
@@ -3123,7 +3122,7 @@ static int hostIFthread(void *pvArg)
}
 
PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n");
-   up();
+   up(_sema_thread);
return 0;
 }
 
@@ -4250,7 +4249,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
 
PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
if (clients_count == 0) {
-   sema_init(, 0);
+   sema_init(_sema_thread, 0);
sema_init(, 0);
sema_init(, 1);
}
@@ -4383,7 +4382,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
if (s32Error != 0)
PRINT_ER("Error in sending deinit's message queue 
message function: Error(%d)\n", s32Error);
 
-   down();
+   down(_sema_thread);
 
wilc_mq_destroy(_msg_q);
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 37/40] staging: wilc1000: move variable FALSE_FRMWR_CHANNEL

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch move variable 'FALSE_FRMWR_CHANNEL' to local define position.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5006f5d..02c9763 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -60,6 +60,7 @@ extern u8 g_wilc_initialized;
 #define BA_SESSION_DEFAULT_BUFFER_SIZE  16
 #define BA_SESSION_DEFAULT_TIMEOUT  1000
 #define BLOCK_ACK_REQ_SIZE  0x14
+#define FALSE_FRMWR_CHANNEL100
 
 struct cfg_param_attr {
struct cfg_param_val cfg_attr_info;
@@ -2655,7 +2656,6 @@ static int Handle_RegisterFrame(struct host_if_drv 
*hif_drv,
return result;
 }
 
-#define FALSE_FRMWR_CHANNEL 100
 static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
 struct remain_ch *pstrHostIfRemainOnChan)
 {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 39/40] staging: wilc1000: fixes alignment should match open parenthesis

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch fixes the checks reported by checkpatch.pl
for alignment should match open parenthesis.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 155 +++---
 1 file changed, 79 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 08f70d8..3209444 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -343,7 +343,7 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to set channel\n");
@@ -365,7 +365,7 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
strWID.size = sizeof(u32);
 
result = send_config_pkt(SET_CFG, , 1,
-  pstrHostIfSetDrvHandler->u32Address);
+pstrHostIfSetDrvHandler->u32Address);
 
if (!hif_drv)
up(_sema_driver);
@@ -390,7 +390,7 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
strWID.size = sizeof(u32);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
up(_sema_driver);
@@ -422,7 +422,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.size = IP_ALEN;
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
 
@@ -447,7 +447,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.size = IP_ALEN;
 
result = send_config_pkt(GET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
 
@@ -490,7 +490,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.val);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to set mac address\n");
result = -EFAULT;
@@ -512,7 +512,7 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
strWID.size = ETH_ALEN;
 
result = send_config_pkt(GET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to get mac address\n");
@@ -797,7 +797,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
}
 
result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result)
PRINT_ER("Error in setting CFG params\n");
@@ -918,7 +918,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
scan_while_connected = false;
 
result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -970,7 +970,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
strWID.size = sizeof(char);
 
result = send_config_pkt(SET_CFG, , 1,
-  get_id_from_handler(hif_drv));
+get_id_from_handler(hif_drv));
 
if (result) {
PRINT_ER("Failed to set abort running scan\n");
@@ -1027,16 +1027,18 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssid_len;
if (pstrHostIFconnectAttr->ssid != NULL) {
hif_drv->strWILC_UsrConnReq.pu8ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
-   memcpy(hif_drv->strWILC

[PATCH V2 35/40] staging: wilc1000: rename variable s32Error

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable s32Error to result
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 784 ++
 1 file changed, 371 insertions(+), 413 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0b3c991..e6c4da3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -330,8 +330,7 @@ static struct host_if_drv *get_handler_from_id(int id)
 static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 struct channel_attr *pstrHostIFSetChan)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_CURRENT_CHANNEL;
@@ -341,21 +340,21 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
-   if (s32Error) {
+
+   if (result) {
PRINT_ER("Failed to set channel\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv,
   struct drv_handler *pstrHostIfSetDrvHandler)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_SET_DRV_HANDLER;
@@ -363,25 +362,24 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
strWID.val = (s8 *)&(pstrHostIfSetDrvHandler->u32Address);
strWID.size = sizeof(u32);
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   pstrHostIfSetDrvHandler->u32Address);
 
if (!hif_drv)
up(_sema_driver);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set driver handler\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
   struct op_mode *pstrHostIfSetOperationMode)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_SET_OPERATION_MODE;
@@ -389,25 +387,23 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
strWID.val = (s8 *)&(pstrHostIfSetOperationMode->u32Mode);
strWID.size = sizeof(u32);
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
-
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
up(_sema_driver);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set driver handler\n");
return -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
char firmwareIPAddress[4] = {0};
 
@@ -423,26 +419,24 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.val = (u8 *)pu8IPAddr;
strWID.size = IP_ALEN;
 
-   s32Error = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(SET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
-
host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
 
-   if (s32Error) {
+   if (result) {
PRINT_ER("Failed to set IP address\n");
return -EINVAL;
}
 
PRINT_INFO(HOSTINF_DBG, "IP address set\n");
 
-   return s32Error;
+   return result;
 }
 
 s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
 {
-
-   s32 s32Error = 0;
+   s32 result = 0;
struct wid strWID;
 
strWID.id = (u16)WID_IP_ADDRESS;
@@ -450,7 +444,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
strWID.val = kmalloc(IP_ALEN, GFP_KERNEL);
strWID.size = IP_ALEN;
 
-   s32Error = send_config_pkt(GET_CFG, , 1,
+   result = send_config_pkt(GET_CFG, , 1,
   get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
@@ -462,7 +456,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
   

[PATCH V2 38/40] staging: wilc1000: fixes unnecessary variable replacement

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch removes an unnecessary variable use for the errors and
returns errors directly without a result variable.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 28 +---
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 02c9763..08f70d8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3200,9 +3200,8 @@ s32 host_int_add_wep_key_bss_sta(struct host_if_drv 
*hif_drv,
struct host_if_msg msg;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3237,9 +3236,8 @@ s32 host_int_add_wep_key_bss_ap(struct host_if_drv 
*hif_drv,
u8 i;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3279,9 +3277,8 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const 
u8 *pu8Ptk,
u32 i;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
if (pu8RxMic != NULL)
u8KeyLen += RX_MIC_KEY_LEN;
@@ -3344,9 +3341,8 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, 
const u8 *pu8RxGtk,
u8 u8KeyLen = u8GtkKeylen;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
memset(, 0, sizeof(struct host_if_msg));
 
@@ -3403,9 +3399,8 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, 
struct host_if_pmkid_at
 
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("driver is null\n");
-   return result;
+   return -EFAULT;
}
 
memset(, 0, sizeof(struct host_if_msg));
@@ -3548,9 +3543,8 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 
*pu8bssid,
enum scan_conn_timer enuScanConnTimer;
 
if (!hif_drv || pfConnectResult == NULL) {
-   result = -EFAULT;
PRINT_ER("Driver is null\n");
-   return result;
+   return -EFAULT;
}
 
if (pJoinParams == NULL) {
@@ -3610,16 +3604,12 @@ s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
s32 result = 0;
struct host_if_msg msg;
 
-   if (!join_req) {
-   result = -EFAULT;
-   return result;
-   }
-
+   if (!join_req)
+   return -EFAULT;
 
if (!hif_drv) {
-   result = -EFAULT;
PRINT_ER("Driver is null\n");
-   return result;
+   return -EFAULT;
}
 
msg.id = HOST_IF_MSG_FLUSH_CONNECT;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 36/40] staging: wilc1000: move variable clients_count

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch move static variable clients_count to local variable position.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e6c4da3..5006f5d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -260,6 +260,7 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 inactive_time;
 static u8 del_beacon;
+static u32 clients_count;
 
 static u8 *join_req;
 static u8 *info_element;
@@ -4175,8 +4176,6 @@ void host_int_send_network_info_to_host
 {
 }
 
-static u32 clients_count;
-
 s32 host_int_init(struct host_if_drv **hif_drv_handler)
 {
s32 result = 0;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 40/40] staging: wilc1000: fixes comparison to NULL could be written

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch fixes the checks reported by checkpatch.pl
for comparison to NULL could be written.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 220 ++
 1 file changed, 106 insertions(+), 114 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3209444..eea3a1a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -476,8 +476,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid strWID;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
-
-   if (mac_buf == NULL) {
+   if (!mac_buf) {
PRINT_ER("No buffer to send mac address\n");
return -EFAULT;
}
@@ -857,7 +856,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
valuesize += 
((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1);
pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL);
strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal;
-   if (strWIDList[u32WidsCount].val != NULL) {
+   if (strWIDList[u32WidsCount].val) {
pu8Buffer = strWIDList[u32WidsCount].val;
 
*pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum;
@@ -893,7 +892,8 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
 
-   if (pstrHostIFscanAttr->ch_freq_list != NULL && 
pstrHostIFscanAttr->ch_list_len > 0) {
+   if (pstrHostIFscanAttr->ch_freq_list &&
+   pstrHostIFscanAttr->ch_list_len > 0) {
int i;
 
for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++)   {
@@ -931,21 +931,22 @@ ERRORHANDLER:
Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
}
 
-   if (pstrHostIFscanAttr->ch_freq_list != NULL) {
+   if (pstrHostIFscanAttr->ch_freq_list) {
kfree(pstrHostIFscanAttr->ch_freq_list);
pstrHostIFscanAttr->ch_freq_list = NULL;
}
 
-   if (pstrHostIFscanAttr->ies != NULL) {
+   if (pstrHostIFscanAttr->ies) {
kfree(pstrHostIFscanAttr->ies);
pstrHostIFscanAttr->ies = NULL;
}
-   if (pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo != NULL)   
{
+
+   if (pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo) {
kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo);
pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL;
}
 
-   if (pu8HdnNtwrksWidVal != NULL)
+   if (pu8HdnNtwrksWidVal)
kfree(pu8HdnNtwrksWidVal);
 
return result;
@@ -1013,19 +1014,19 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global 
structure\n");
 
ptstrJoinBssParam = (struct join_bss_param 
*)pstrHostIFconnectAttr->params;
-   if (ptstrJoinBssParam == NULL) {
+   if (!ptstrJoinBssParam) {
PRINT_ER("Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
}
 
-   if (pstrHostIFconnectAttr->bssid != NULL) {
+   if (pstrHostIFconnectAttr->bssid) {
hif_drv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8bssid, 
pstrHostIFconnectAttr->bssid, 6);
}
 
hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssid_len;
-   if (pstrHostIFconnectAttr->ssid != NULL) {
+   if (pstrHostIFconnectAttr->ssid) {
hif_drv->strWILC_UsrConnReq.pu8ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8ssid,
   pstrHostIFconnectAttr->ssid,
@@ -1034,7 +1035,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
}
 
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 
pstrHostIFconnectAttr->ies_len;
-   if (pstrHostIFconnectAttr->ies != NULL) {
+   if (pstrHostIFconnectAttr->ies) {
hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs = 
kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
memcpy(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
   pstrHostIFconnectAttr->ies,
@@ -1112,15 +1113,14 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
join_req_size = strWIDList[u32WidsCount].size;
join_req = kmalloc(join_r

[PATCH V2 25/40] staging: wilc1000: rename variable gu32InactiveTime

2015-10-15 Thread Tony Cho
From: Leo Kim <leo@atmel.com>

This patch renames variable gu32InactiveTime to inactive_time
to avoid CamelCase naming convention.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 59cbf90..ea3c011 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -258,7 +258,7 @@ static s8 link_speed;
 static u8 ch_no;
 static u8 set_ip[2][4];
 static u8 get_ip[2][4];
-static u32 gu32InactiveTime;
+static u32 inactive_time;
 static u8 gu8DelBcn;
 static u32 gu32WidConnRstHack;
 
@@ -2287,7 +2287,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv 
*hif_drv,
 
strWID.id = (u16)WID_GET_INACTIVE_TIME;
strWID.type = WID_INT;
-   strWID.val = (s8 *)
+   strWID.val = (s8 *)_time;
strWID.size = sizeof(u32);
 
 
@@ -2299,8 +2299,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv 
*hif_drv,
return -EFAULT;
}
 
-
-   PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime);
+   PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time);
 
up(_drv->hSemInactiveTime);
 
@@ -3885,7 +3884,7 @@ s32 host_int_get_inactive_time(struct host_if_drv 
*hif_drv,
 
down(_drv->hSemInactiveTime);
 
-   *pu32InactiveTime = gu32InactiveTime;
+   *pu32InactiveTime = inactive_time;
 
return s32Error;
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2] staging: wilc1000: wilc_msgqueue.c : remove the goto ERRORHANDER

2015-10-14 Thread Tony Cho



On 2015년 10월 14일 17:32, Mike Rapoport wrote:

On Wed, Oct 14, 2015 at 02:55:43PM +0900, Tony Cho wrote:

From: Leo Kim <leo@atmel.com>

This patch removes goto ERRORHANDER and the result variable in wilc_mq_send.
Then, the error type is directly returned. If normal operation, freeing memory
is not needed in this function.
If an error occurs, returns an error after releasing the spin lock.

Signed-off-by: Leo Kim <leo@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
V2: add releasing spinlock before returnig an error when an error happens.
---
  drivers/staging/wilc1000/wilc_msgqueue.c | 28 
  1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index b13809a..4dfd476 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -56,35 +56,38 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
  int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize)
  {
-   int result = 0;
unsigned long flags;
Message *pstrMessage = NULL;
  
  	if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {

PRINT_ER("pHandle or pvSendBuffer is null\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
  
  	if (pHandle->bExiting) {

PRINT_ER("pHandle fail\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
  
  	spin_lock_irqsave(>strCriticalSection, flags);
  
  	/* construct a new message */

pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);

You can make this allocation outisde the spinlock, then there won't be
need to release it if the allocation fails.


-   if (!pstrMessage)
+
+   if (!pstrMessage) {
+   spin_unlock_irqrestore(>strCriticalSection, flags);
return -ENOMEM;
+   }
+
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
pstrMessage->pvBuffer = kmemdup(pvSendBuffer, u32SendBufferSize,
GFP_ATOMIC);
+
if (!pstrMessage->pvBuffer) {
-   result = -ENOMEM;
-   goto ERRORHANDLER;
+   spin_unlock_irqrestore(>strCriticalSection, flags);

You are still holding pHandle->hSem here. Moreover, all error paths
return while still holding pHandle->hSem.


Can you explain to me what you mean for holding hsem here? Basically, this 
function cannot release

the semaphore (of course, this synchronization mechanism will be changed, 
anyway) if errors happen.

The thread will do his work when it is released without unexpected situations.


I'd suggest, that instead of trying to return immediately, you'd better
move error handling code to the end of the function and use goto and
several labels to do appropriate cleanups depending on when the error
was caught. E.g.


I don't want to use goto statement as possible as I can. Do you concern 
semaphore uses in this function?
Thanks for your review,
Tony.



mem_free:
kfree(pstrMessage);
release_lock:   
spin_unlock_irqrestore(>strCriticalSection, flags);
release_sem:
up(>sem);
out:
return result;


+   kfree(pstrMessage);
+   return -ENOMEM;
}
  
  	/* add it to the message queue */

@@ -103,14 +106,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
  
  	up(>hSem);
  
-ERRORHANDLER:

-   /* error occured, free any allocations */
-   if (pstrMessage) {
-   kfree(pstrMessage->pvBuffer);
-   kfree(pstrMessage);
-   }
-
-   return result;
+   return 0;
  }
  
  /*!

--
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/16] staging: wilc1000: rename drvHandler in the struct wilc_vif

2015-10-14 Thread Tony Cho
This patch renames drvHandler in the struct wilc_vif to the hif_drv.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c |  2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 6478f6e..6e21825 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1313,7 +1313,7 @@ int mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++)
if (ndev == wl->vif[i].wilc_netdev) {
memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN);
-   wl->vif[i].drvHandler = priv->hWILCWFIDrv;
+   wl->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 150397a..d7c9279 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2586,16 +2586,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
nic->iftype = interface_type;
 
/*Setting interface 1 drv handler and mac address in 
newly downloaded FW*/
-   host_int_set_wfi_drv_handler(wl->vif[0].drvHandler);
-   host_int_set_MacAddress(wl->vif[0].drvHandler,
+   host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+   host_int_set_MacAddress(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(wl->vif[0].drvHandler,
+   host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(wl->vif[0].drvHandler,
+   host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2666,16 +2666,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
 
-   host_int_set_wfi_drv_handler(wl->vif[0].drvHandler);
-   host_int_set_MacAddress(wl->vif[0].drvHandler,
+   host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+   host_int_set_MacAddress(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(wl->vif[0].drvHandler,
+   host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(wl->vif[0].drvHandler,
+   host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2782,16 +2782,16 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 
 
/*Setting interface 1 drv handler and mac address in newly 
downloaded FW*/
-   host_int_set_wfi_drv_handler(wl->vif[0].drvHandler);
-   host_int_set_MacAddress(wl->vif[0].drvHandler,
+   host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+   host_int_set_MacAddress(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   hos

[PATCH 12/16] staging: wilc1000: move clean up codes into wl_wlan_cleanup function

2015-10-14 Thread Tony Cho
From: Glen Lee <glen@atmel.com>

This patch moves clean up codes from exit_wilc_driver into the wl_wlan_cleanup
newly introduced in this patch. In addition, it is called by linux_sdio_remove
function.

Signed-off-by: Glen Lee <glen@atmel.com>
Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 87 ---
 drivers/staging/wilc1000/linux_wlan_sdio.c|  5 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 42 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3d02ae7..e22d164 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1694,6 +1694,46 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wl->vif[1].ndev, buff, size);
 }
 
+void wl_wlan_cleanup(void)
+{
+   int i = 0;
+   perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
+
+   if (wl && (wl->vif[0].ndev || wl->vif[1].ndev)) {
+   unregister_inetaddr_notifier(_dev_notifier);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+   nic[i] = netdev_priv(wl->vif[i].ndev);
+   }
+
+   if (wl && wl->wilc_firmware)
+   release_firmware(wl->wilc_firmware);
+
+   if (wl && (wl->vif[0].ndev || wl->vif[1].ndev)) {
+   linux_wlan_lock_timeout(_exit_sync, 12 * 1000);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+   if (wl->vif[i].ndev)
+   if (nic[i]->mac_opened)
+   mac_close(wl->vif[i].ndev);
+
+   for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+   unregister_netdev(wl->vif[i].ndev);
+   wilc_free_wiphy(wl->vif[i].ndev);
+   free_netdev(wl->vif[i].ndev);
+   }
+   }
+
+   if (wl)
+   kfree(wl);
+
+#if defined(WILC_DEBUGFS)
+   wilc_debugfs_remove();
+#endif
+   linux_wlan_device_detection(0);
+   linux_wlan_device_power(0);
+}
+
 int wilc_netdev_init(void)
 {
 
@@ -1826,44 +1866,6 @@ late_initcall(init_wilc_driver);
 
 static void __exit exit_wilc_driver(void)
 {
-   int i = 0;
-   perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
-   #define CLOSE_TIMEOUT (12 * 1000)
-
-   if (wl && (wl->vif[0].ndev || wl->vif[1].ndev)) {
-   unregister_inetaddr_notifier(_dev_notifier);
-
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
-   nic[i] = netdev_priv(wl->vif[i].ndev);
-   }
-
-   if (wl && wl->wilc_firmware) {
-   release_firmware(wl->wilc_firmware);
-   wl->wilc_firmware = NULL;
-   }
-
-   if (wl && (wl->vif[0].ndev || wl->vif[1].ndev)) {
-   PRINT_D(INIT_DBG, "Waiting for mac_close \n");
-
-   if (linux_wlan_lock_timeout(_exit_sync, CLOSE_TIMEOUT) < 
0)
-   PRINT_D(INIT_DBG, "Closed TimedOUT\n");
-   else
-   PRINT_D(INIT_DBG, "mac_closed\n");
-
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++)
-   if (wl->vif[i].ndev)
-   if (nic[i]->mac_opened)
-   mac_close(wl->vif[i].ndev);
-
-   for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
-   unregister_netdev(wl->vif[i].ndev);
-   PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
-   wilc_free_wiphy(wl->vif[i].ndev);
-   PRINT_D(INIT_DBG, "Freeing netdev...\n");
-   free_netdev(wl->vif[i].ndev);
-   }
-   }
-
 #ifndef WILC_SDIO
PRINT_D(INIT_DBG, "SPI unregsiter...\n");
spi_unregister_driver(_bus);
@@ -1871,15 +1873,6 @@ static void __exit exit_wilc_driver(void)
PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
sdio_unregister_driver(_bus);
 #endif
-   kfree(wl);
-   printk("Module_exit Done.\n");
-
-#if defined(WILC_DEBUGFS)
-   wilc_debugfs_remove();
-#endif
-
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
 }
 module_exit(exit_wilc_driver);
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 0dd4b19..c78f3a5 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -136,10 +136,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
 static void linux_sdio_remove(struct sdio_func *func)
 {
-   /**
-*  TODO
-**/
-
+   wl_wlan_c

[PATCH 09/16] staging: wilc1000: rename aBSSID in the struct wilc_vif

2015-10-14 Thread Tony Cho
This patch renames aBSSID in the struct wilc_vif to the bssid.

Signed-off-by: Tony Cho <tony@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 14 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ed21ba8..6478f6e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -367,8 +367,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid1 = pMacHeader + 4;
 
for (i = 0; i < wl->vif_num; i++)
-   if (!memcmp(Bssid1, wl->vif[i].aBSSID, ETH_ALEN) ||
-   !memcmp(Bssid, wl->vif[i].aBSSID, ETH_ALEN))
+   if (!memcmp(Bssid1, wl->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, wl->vif[i].bssid, ETH_ALEN))
return wl->vif[i].wilc_netdev;
 
PRINT_INFO(INIT_DBG, "Invalide handle\n");
@@ -377,8 +377,8 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid  = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
for (i = 0; i < wl->vif_num; i++)
-   if (!memcmp(Bssid1, wl->vif[i].aBSSID, ETH_ALEN) ||
-   !memcmp(Bssid, wl->vif[i].aBSSID, ETH_ALEN))
+   if (!memcmp(Bssid1, wl->vif[i].bssid, ETH_ALEN) ||
+   !memcmp(Bssid, wl->vif[i].bssid, ETH_ALEN))
return wl->vif[i].wilc_netdev;
 
PRINT_INFO(INIT_DBG, "\n");
@@ -393,7 +393,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 
*pBSSID)
PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
for (i = 0; i < wl->vif_num; i++)
if (wl->vif[i].wilc_netdev == wilc_netdev) {
-   memcpy(wl->vif[i].aBSSID, pBSSID, 6);
+   memcpy(wl->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
@@ -409,7 +409,7 @@ int linux_wlan_get_num_conn_ifcs(void)
u8 ret_val = 0;
 
for (i = 0; i < wl->vif_num; i++)
-   if (memcmp(wl->vif[i].aBSSID, null_bssid, 6))
+   if (memcmp(wl->vif[i].bssid, null_bssid, 6))
ret_val++;
 
return ret_val;
@@ -1470,7 +1470,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
-   tx_data->pBssid = wl->vif[nic->u8IfIdx].aBSSID;
+   tx_data->pBssid = wl->vif[nic->u8IfIdx].bssid;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
   tx_data->size,
   linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 19bca5d..150397a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2572,7 +2572,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
 
if (wl->initialized) {
host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].aBSSID,
+ wl->vif[0].bssid,
  TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
@@ -2649,7 +2649,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Interface type = 
NL80211_IFTYPE_P2P_CLIENT\n");
 
host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].aBSSID, TID);
+ wl->vif[0].bssid, TID);
 
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2760,7 +2760,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
/*hWaitResponse semaphore, which allows previous config*/
/*packets to actually take action on old FW*/
host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].aBSSID,
+ wl->vif[0].bssid,
  TID);
bEnablePS = false;
PRINT_D(HOSTAPD_DBG, "Int

  1   2   3   4   5   6   >