Re: [PATCH V2] Staging: wilc1000: Fix build break due to undeclared *wilc and implicit declaration of init_irq

2015-11-08 Thread glen lee

I just check the email, I will get back here after I check the patches related 
with this issue.

regards,
glen lee.


On 2015년 11월 09일 06:59, Dan Carpenter wrote:

Top posting beucase I am a bad person.  Punit, you should have CC'd Glen
since this is his code.

The fix is still not right.  It will cause an unused variable warning on
some configs.

To be honest, this code makes no sense.  Why do we even have the wilc
variable in this function when we never use it?  Just declare move it to
wilc_netdev_init().  Also there are too many ifdefs in this code.

regards,
dan carpenter

On Mon, Nov 09, 2015 at 03:01:50AM +0530, Punit Vara wrote:

This patch is to the linux_wlan.c file that fixes up break found during
make drivers/staging/wilc1000/linux_wlan.o

Patch add following things to file :
-init_irq declaration
-At preprocessor (!defined WILC_SDIO) to defination of init_irq
-At preprocessor (!defined WILC_SDIO) to defination isr_uh_routine
-removes unnecessary lines to declare *wilc

Patch fixes 702c0e50f and 2c1d05d10 tags.

Signed-off-by: Punit Vara 
---
-Fixes tag added suggested by Dan carpenter.
-Remove declaration of autovariable with same type and same name suggested by 
Joe Perches

  drivers/staging/wilc1000/linux_wlan.c | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 086f1db..5bd14ed 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -208,7 +208,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
return NOTIFY_DONE;
  }
  
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)

+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined WILC_SDIO)
  static irqreturn_t isr_uh_routine(int irq, void *user_data)
  {
perInterface_wlan_t *nic;
@@ -246,7 +246,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
  }
  
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)

+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined WILC_SDIO)
  static int init_irq(struct net_device *dev)
  {
int ret = 0;
@@ -937,6 +937,10 @@ static void wlan_deinitialize_threads(struct net_device 
*dev)
}
  }
  
+#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)

+static int init_irq(struct net_device *dev);
+#endif
+
  int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
  {
wilc_wlan_inp_t nwi;
@@ -1578,9 +1582,7 @@ int wilc_netdev_init(struct wilc **wilc)
  
  static int __init init_wilc_driver(void)

  {
-#ifdef WILC_SPI
struct wilc *wilc;
-#endif
  
  #if defined(WILC_DEBUGFS)

if (wilc_debugfs_init() < 0) {
--
2.6.2

___
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


Re: [PATCH V2] Staging: wilc1000: Fix build break due to undeclared *wilc and implicit declaration of init_irq

2015-11-09 Thread glen lee

Hi Punit Vara,

I cannot find build errors on my build machines.

According the log which you have posted before says *wilc is undeclared in the 
function init_wilc_driver,
which means WILC_SPI is selected because one of SPI or SDIO should be chosen at 
the moment.
Hence, struct wilc *wilc should be compiled together.
It looks like wilc1000 is compiled without SPI or SDIO.

Of course, there are many cases that I don't know, so you could let me know the 
wilc1000 build configuration?

static int __init init_wilc_driver(void)
{
#ifdef WILC_SPI
struct wilc *wilc;
#endif

..

#ifdef WILC_SDIO
{
int ret;

ret = sdio_register_driver(&wilc_bus);
if (ret < 0)
PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio 
driver\n");

return ret;
}
#else
PRINT_D(INIT_DBG, "Initializing netdev\n");
if (wilc_netdev_init(&wilc))
PRINT_ER("Couldn't initialize netdev\n");
return 0;
#endif

regards,
glen lee.


On 2015년 11월 09일 11:03, glen lee wrote:
I just check the email, I will get back here after I check the patches 
related with this issue.


regards,
glen lee.


On 2015년 11월 09일 06:59, Dan Carpenter wrote:

Top posting beucase I am a bad person. Punit, you should have CC'd Glen
since this is his code.

The fix is still not right.  It will cause an unused variable warning on
some configs.

To be honest, this code makes no sense.  Why do we even have the wilc
variable in this function when we never use it?  Just declare move it to
wilc_netdev_init().  Also there are too many ifdefs in this code.

regards,
dan carpenter

On Mon, Nov 09, 2015 at 03:01:50AM +0530, Punit Vara wrote:

This patch is to the linux_wlan.c file that fixes up break found during
make drivers/staging/wilc1000/linux_wlan.o

Patch add following things to file :
-init_irq declaration
-At preprocessor (!defined WILC_SDIO) to defination of init_irq
-At preprocessor (!defined WILC_SDIO) to defination isr_uh_routine
-removes unnecessary lines to declare *wilc

Patch fixes 702c0e50f and 2c1d05d10 tags.

Signed-off-by: Punit Vara 
---
-Fixes tag added suggested by Dan carpenter.
-Remove declaration of autovariable with same type and same name 
suggested by Joe Perches


  drivers/staging/wilc1000/linux_wlan.c | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c

index 086f1db..5bd14ed 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -208,7 +208,7 @@ static int dev_state_ev_handler(struct 
notifier_block *this, unsigned long event

  return NOTIFY_DONE;
  }
  -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined 
WILC_SDIO)

  static irqreturn_t isr_uh_routine(int irq, void *user_data)
  {
  perInterface_wlan_t *nic;
@@ -246,7 +246,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
  return IRQ_HANDLED;
  }
  -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined 
WILC_SDIO)

  static int init_irq(struct net_device *dev)
  {
  int ret = 0;
@@ -937,6 +937,10 @@ static void wlan_deinitialize_threads(struct 
net_device *dev)

  }
  }
  +#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
+static int init_irq(struct net_device *dev);
+#endif
+
  int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t 
*p_nic)

  {
  wilc_wlan_inp_t nwi;
@@ -1578,9 +1582,7 @@ int wilc_netdev_init(struct wilc **wilc)
static int __init init_wilc_driver(void)
  {
-#ifdef WILC_SPI
  struct wilc *wilc;
-#endif
#if defined(WILC_DEBUGFS)
  if (wilc_debugfs_init() < 0) {
--
2.6.2

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



--
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


Re: [PATCH V2] Staging: wilc1000: Fix build break due to undeclared *wilc and implicit declaration of init_irq

2015-11-09 Thread glen lee


On 2015년 11월 09일 17:18, Dan Carpenter wrote:

On Mon, Nov 09, 2015 at 05:02:48PM +0900, glen lee wrote:

Hi Punit Vara,

I cannot find build errors on my build machines.

According the log which you have posted before says *wilc is undeclared in the 
function init_wilc_driver,
which means WILC_SPI is selected because one of SPI or SDIO should be chosen at 
the moment.
Hence, struct wilc *wilc should be compiled together.
It looks like wilc1000 is compiled without SPI or SDIO.

Of course, there are many cases that I don't know, so you could let me know the 
wilc1000 build configuration?

static int __init init_wilc_driver(void)
{
#ifdef WILC_SPI

This should be #ifndef WILC_SDIO


I will do this in the next patch series.




struct wilc *wilc;
#endif

But the large question remains of why do we have this variable here any
way?


As you pointed out, the variable is do-nothing for spi driver for now.
After reworking SPI driver, the wilc will be passed to SPI as spi drive data 
like we already did in SDIO.

We have done this to remove extern variable g_linux_wlan which is primary 
structure of wilc1000.
For now it is not used, but need it not to break the build.

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);
if (!wl_sdio)
return -ENOMEM;

PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
if (wilc_netdev_init(&wilc)) {
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);

regards,
glen lee.



regards,
dan carpenter



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


Re: [PATCH V2] Staging: wilc1000: Fix build break due to undeclared *wilc and implicit declaration of init_irq

2015-11-09 Thread glen lee



On 2015년 11월 09일 18:05, punit vara wrote:

On Mon, Nov 9, 2015 at 2:25 PM, glen lee  wrote:

On 2015년 11월 09일 17:18, Dan Carpenter wrote:

On Mon, Nov 09, 2015 at 05:02:48PM +0900, glen lee wrote:

Hi Punit Vara,

I cannot find build errors on my build machines.

According the log which you have posted before says *wilc is undeclared
in the function init_wilc_driver,
which means WILC_SPI is selected because one of SPI or SDIO should be
chosen at the moment.
Hence, struct wilc *wilc should be compiled together.
It looks like wilc1000 is compiled without SPI or SDIO.

Of course, there are many cases that I don't know, so you could let me
know the wilc1000 build configuration?

static int __init init_wilc_driver(void)
{
#ifdef WILC_SPI

This should be #ifndef WILC_SDIO


I will do this in the next patch series.


 struct wilc *wilc;
#endif

But the large question remains of why do we have this variable here any
way?


As you pointed out, the variable is do-nothing for spi driver for now.
After reworking SPI driver, the wilc will be passed to SPI as spi drive data
like we already did in SDIO.

We have done this to remove extern variable g_linux_wlan which is primary
structure of wilc1000.
For now it is not used, but need it not to break the build.

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);
 if (!wl_sdio)
 return -ENOMEM;

 PRINT_D(INIT_DBG, "Initializing netdev\n");
 local_sdio_func = func;
 if (wilc_netdev_init(&wilc)) {
 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);

regards,
glen lee.


regards,
dan carpenter


How about this patch @Dan and @glen ,For me it does not create any
build error. For #ifndef WILC_SDIO  that pointer *wilc is not
compiling so that creates the error.


As Dan said, I also think there are too many ifdefs now. We will remove the 
defines after
reworking SPI/SDIO modules.

For now, I cannot test since build error does not happens in my side. :(

Just in case, will this works for you?
config WILC1000_DRIVER
bool "WILC1000 support (WiFi only)"
depends on CFG80211 && WEXT_CORE && INET
+   depends on MMC || SPI

I will look into more about this later.

regards,
glen lee.



--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -224,7 +224,7 @@ static int dev_state_ev_handler(struct
notifier_block *this, unsigned long event

  }

-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined WIC_SDIO)
  static irqreturn_t isr_uh_routine(int irq, void *user_data)
  {
 perInterface_wlan_t *nic;
@@ -264,7 +264,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
 return IRQ_HANDLED;
  }

-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
+#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) || (!defined WILC_SDIO)
  static int init_irq(struct net_device *dev)
  {
 int ret = 0;
@@ -1083,6 +1083,10 @@ static void wlan_deinitialize_threads(struct
net_device *dev)
 }
  }

+#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
+static int init_irq(struct net_device *dev);
+#endif
+
  int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
  {
 wilc_wlan_inp_t nwi;
@@ -1791,7 +1795,7 @@ int wilc_netdev_init(struct wilc **wilc)
  /*The 1st function called after module inserted*/
  static int __init init_wilc_driver(void)
  {
-#ifdef WILC_SPI
+#if (defined WILC_SPI) || (!defined WILC_SDIO)
 struct wilc *wilc;
  #endif


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


[PATCH] staging: wilc1000: fix bug in sdio/spi

2015-11-11 Thread Glen Lee
sdio_init and wilc_spi_init always return error, so it fails everytime.
Fix this by removing else statement.

This fixes c1af9db78950a778ec18343c5c5a6d4cfbf58a61,
bacd388547f55eb415ce266c8723cc6f1281a25d

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_sdio.c | 2 --
 drivers/staging/wilc1000/wilc_spi.c  | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 8aacf55..1addc56 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -564,8 +564,6 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func 
func)
if (!linux_sdio_init()) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
return 0;
-   } else {
-   return 0;
}
 
/**
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 3741836..cff61fd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -968,8 +968,6 @@ static int wilc_spi_init(struct wilc *wilc, wilc_debug_func 
func)
if (!linux_spi_init()) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
-   } else {
-   return 0;
}
 
/**
-- 
1.9.1

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


Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization

2015-11-12 Thread glen lee

Hi arnd,

I appreciate the patches.
I did test this patch series on h/w which is arm based MCU.
From this patch wilc is not working properly. After downloading firmware, the 
firmware cannot start and it fails.
I double check this patch and the previous one(14/20) which works fine.
I cannot find the problem in this patch at the moment. I will see if I can find 
something,
and I'd appreciate if you would help with it.

regards,
glen lee


On 2015년 11월 11일 08:42, Arnd Bergmann wrote:

The wilc_hif_spi and wilc_hif_sdio structures are part of
the bus specific code, and the generic code should have no knowledge
of their addresses.

This changes the code to reference them only from the bus
specific initialization code, which we can then use to split
up the driver into separate modules.

Signed-off-by: Arnd Bergmann 
---
  drivers/staging/wilc1000/linux_wlan.c |  4 ++-
  drivers/staging/wilc1000/linux_wlan_sdio.c|  3 ++-
  drivers/staging/wilc1000/linux_wlan_spi.c |  2 +-
  drivers/staging/wilc1000/wilc_sdio.c  | 35 +--
  drivers/staging/wilc1000/wilc_spi.c   | 34 +-
  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  4 ++-
  drivers/staging/wilc1000/wilc_wlan.c  | 15 ++--
  drivers/staging/wilc1000/wilc_wlan.h  |  4 +--
  8 files changed, 47 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e81e90678d0f..2fb1d97bded1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1408,7 +1408,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
  #endif
  }
  
-int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio)

+int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
+int gpio, const struct wilc_hif_func *ops)
  {
int i;
perInterface_wlan_t *nic;
@@ -1423,6 +1424,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type, int gp
*wilc = wilc_dev;
wilc_dev->io_type = io_type;
wilc_dev->gpio = gpio;
+   wilc_dev->ops = ops;
  
  	register_inetaddr_notifier(&g_dev_notifier);
  
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c

index 732b0d66366b..f4250fda6cf1 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -119,7 +119,8 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
  
  	PRINT_D(INIT_DBG, "Initializing netdev\n");

wilc_sdio_func = func;
-   if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio)) {
+   if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
+&wilc_hif_sdio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index f4dda4a6fa7b..a7a52593156a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void)
  
  	wilc_debugfs_init();
  
-	ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM);

+   ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
if (ret) {
wilc_debugfs_remove();
return ret;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 8441fcc4..0a9b5a71772e 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -912,23 +912,22 @@ static int sdio_sync_ext(int nint /*  how mant interrupts 
to enable. */)
   *
   /
  
-struct wilc_hif_func wilc_hif_sdio = {

-   sdio_init,
-   sdio_deinit,
-   sdio_read_reg,
-   sdio_write_reg,
-   sdio_read,
-   sdio_write,
-   sdio_sync,
-   sdio_clear_int,
-   sdio_read_int,
-   sdio_clear_int_ext,
-   sdio_read_size,
-   sdio_write,
-   sdio_read,
-   sdio_sync_ext,
-
-   sdio_set_max_speed,
-   sdio_set_default_speed,
+const struct wilc_hif_func wilc_hif_sdio = {
+   .hif_init = sdio_init,
+   .hif_deinit = sdio_deinit,
+   .hif_read_reg = sdio_read_reg,
+   .hif_write_reg = sdio_write_reg,
+   .hif_block_rx = sdio_read,
+   .hif_block_tx = sdio_write,
+   .hif_sync = sdio_sync,
+   .hif_clear_int = sdio_clear_int,
+   .hif_read_int = sdio_read_int,
+   .hif_clear_int_ext = sdio_clear_int_ext,
+   .hif_read_size = sdio_read_size,
+   .hif_block_rx_ext = sdio_write,
+   .hif_block_tx_ext = sdio_read,
+   .hif_sync_ext = sdio_sync_ext,
+   .hif_set_max_bus_speed = sdio_set_max_speed

Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization

2015-11-12 Thread glen lee



On 2015년 11월 12일 20:39, Arnd Bergmann wrote:

On Thursday 12 November 2015 19:05:41 glen lee wrote:

Hi arnd,

I appreciate the patches.
I did test this patch series on h/w which is arm based MCU.
  From this patch wilc is not working properly. After downloading firmware, the 
firmware cannot start and it fails.
I double check this patch and the previous one(14/20) which works fine.
I cannot find the problem in this patch at the moment. I will see if I can find 
something,
and I'd appreciate if you would help with it.


I've looked at it some more, but didn't find anything obvious, here are some
possible things I found:



-struct wilc_hif_func wilc_hif_sdio = {
-   sdio_init,
-   sdio_deinit,
-   sdio_read_reg,
-   sdio_write_reg,
-   sdio_read,
-   sdio_write,
-   sdio_sync,
-   sdio_clear_int,
-   sdio_read_int,
-   sdio_clear_int_ext,
-   sdio_read_size,
-   sdio_write,
-   sdio_read,
-   sdio_sync_ext,
-
-   sdio_set_max_speed,
-   sdio_set_default_speed,
+const struct wilc_hif_func wilc_hif_sdio = {
+   .hif_init = sdio_init,
+   .hif_deinit = sdio_deinit,
+   .hif_read_reg = sdio_read_reg,
+   .hif_write_reg = sdio_write_reg,
+   .hif_block_rx = sdio_read,
+   .hif_block_tx = sdio_write,
+   .hif_sync = sdio_sync,
+   .hif_clear_int = sdio_clear_int,
+   .hif_read_int = sdio_read_int,
+   .hif_clear_int_ext = sdio_clear_int_ext,
+   .hif_read_size = sdio_read_size,
+   .hif_block_rx_ext = sdio_write,
+   .hif_block_tx_ext = sdio_read,


Hi arnd,

I found this. These should be like this. It works fine.
+   .hif_block_tx_ext = sdio_write,
+   .hif_block_rx_ext = sdio_read,

also, wilc_hif_spi need to be fixed together like this.
+   .hif_block_tx_ext = _wilc_spi_write,
+   .hif_block_rx_ext = _wilc_spi_read,

Thank you for all the patches.

regards,
glen lee


+   .hif_sync_ext = sdio_sync_ext,
+   .hif_set_max_bus_speed = sdio_set_max_speed,
+   .hif_set_default_bus_speed = sdio_set_default_speed,
   };

If the callbacks are not in the same order here, something could
in theory go wrong. I've tried to verify them by inspection and
could not find anything here, but you can try reverting this part.


memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
g_wlan.io_type = wilc->io_type;
-
-#ifdef WILC_SDIO
-   if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
-   ret = -EIO;
-   goto _fail_;
-   }
-   memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio,
-  sizeof(struct wilc_hif_func));
-#else
-   if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) {
+   g_wlan.hif_func = *wilc->ops;
+   if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
ret = -EIO;
goto _fail_;
}
-   memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi,
-  sizeof(struct wilc_hif_func));
-#endif

This is the most likely part I found:

doing an assigment instead of memcpy should not make a difference,
but my new version also called init after copying over the
operations rather than before. This seemed to be the correct
order when I did it, but it is a change in behavior that might
cause problems if some code relies on the hif_func structure
to be empty at the time that hif_init is called.

Arnd


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


Re: [PATCH 15/20] staging/wilc1000: pass hif operations through initialization

2015-11-15 Thread glen lee


On 2015년 11월 13일 18:17, Arnd Bergmann wrote:

On Friday 13 November 2015 16:49:22 glen lee wrote:

Hi arnd,

I found this. These should be like this. It works fine.
+   .hif_block_tx_ext = sdio_write,
+   .hif_block_rx_ext = sdio_read,

also, wilc_hif_spi need to be fixed together like this.
+   .hif_block_tx_ext = _wilc_spi_write,
+   .hif_block_rx_ext = _wilc_spi_read,

Thank you for all the patches.


Glad you found it. How should we go on to get the right version merged?
Do you want to send the working version of my patches to Greg along with
whatever you have on your end, or do you prefer me to re-send it?


In my opinion, why don't you re-send the whole patches again since I'm still 
working on.

regards,
glen lee.


Arnd


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


Re: [staging:staging-testing 203/406] undefined reference to `nf_conntrack_untracked'

2015-11-17 Thread glen lee

Hi fengguang,

This is because cfg80211 is built as module but wilc1000 is built into the 
Kernel.
Arnd have posted patch series, not yet applied, which also can fix this Kconfig 
issue.

[PATCH 17/19] staging/wilc1000: split out bus specific modules

regards,
glen lee.


On 2015년 11월 18일 10:24, kbuild test robot wrote:

Hi Glen,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   34d96c0dedbfbba50349dcc76546a86ad59a0789
commit: b22fa80cdbf4ff1056ecddb4efdcc0ede5f5f422 [203/406] staging: wilc1000: 
fix kbuild test robot error
config: x86_64-randconfig-s4-11180810 (attached as .config)
reproduce:
 git checkout b22fa80cdbf4ff1056ecddb4efdcc0ede5f5f422
 # save the attached .config to linux build tree
 make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/built-in.o: In function `mgmt_tx_cancel_wait':
wilc_wfi_cfgoperations.c:(.text+0x383ddd): undefined reference to 
`cfg80211_remain_on_channel_expired'
drivers/built-in.o: In function `WILC_WFI_RemainOnChannelExpired':
wilc_wfi_cfgoperations.c:(.text+0x383ebb): undefined reference to 
`cfg80211_remain_on_channel_expired'
drivers/built-in.o: In function `WILC_WFI_RemainOnChannelReady':
wilc_wfi_cfgoperations.c:(.text+0x38427a): undefined reference to 
`cfg80211_ready_on_channel'
drivers/built-in.o: In function `set_channel':
wilc_wfi_cfgoperations.c:(.text+0x3862db): undefined reference to 
`ieee80211_frequency_to_channel'
drivers/built-in.o: In function `refresh_scan':
(.text+0x38a099): undefined reference to `ieee80211_channel_to_frequency'
drivers/built-in.o: In function `refresh_scan':
(.text+0x38a0aa): undefined reference to `__ieee80211_get_channel'
drivers/built-in.o: In function `refresh_scan':
(.text+0x38a1a2): undefined reference to `cfg80211_inform_bss_data'
drivers/built-in.o: In function `refresh_scan':
(.text+0x38a1bf): undefined reference to `cfg80211_put_bss'
drivers/built-in.o: In function `CfgConnectResult':
wilc_wfi_cfgoperations.c:(.text+0x38bd64): undefined reference to 
`cfg80211_connect_result'
wilc_wfi_cfgoperations.c:(.text+0x38bf8b): undefined reference to 
`cfg80211_disconnected'
drivers/built-in.o: In function `scan':
wilc_wfi_cfgoperations.c:(.text+0x38c0a3): undefined reference to 
`ieee80211_frequency_to_channel'
drivers/built-in.o: In function `CfgScanResult':
wilc_wfi_cfgoperations.c:(.text+0x38cd3d): undefined reference to 
`ieee80211_channel_to_frequency'
wilc_wfi_cfgoperations.c:(.text+0x38cd4e): undefined reference to 
`__ieee80211_get_channel'
wilc_wfi_cfgoperations.c:(.text+0x38d029): undefined reference to 
`cfg80211_inform_bss_data'
wilc_wfi_cfgoperations.c:(.text+0x38d046): undefined reference to 
`cfg80211_put_bss'
wilc_wfi_cfgoperations.c:(.text+0x38d463): undefined reference to 
`cfg80211_scan_done'
wilc_wfi_cfgoperations.c:(.text+0x38d5af): undefined reference to 
`cfg80211_scan_done'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38ef01): undefined reference to `cfg80211_mgmt_tx_status'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38efe1): undefined reference to `cfg80211_mgmt_tx_status'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38f09b): undefined reference to `cfg80211_mgmt_tx_status'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38f138): undefined reference to `ieee80211_channel_to_frequency'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38f87d): undefined reference to `cfg80211_rx_mgmt'
drivers/built-in.o: In function `WILC_WFI_p2p_rx':
(.text+0x38f925): undefined reference to `cfg80211_rx_mgmt'
drivers/built-in.o: In function `WILC_WFI_CfgAlloc':
(.text+0x38fb10): undefined reference to `wiphy_new_nm'
drivers/built-in.o: In function `wilc_create_wiphy':
(.text+0x38fecf): undefined reference to `wiphy_register'
drivers/built-in.o: In function `wilc_free_wiphy':
(.text+0x39062a): undefined reference to `wiphy_unregister'
drivers/built-in.o: In function `wilc_free_wiphy':
(.text+0x3906b9): undefined reference to `wiphy_free'
net/built-in.o: In function `nf_dup_ipv4':

(.text+0x152f5b): undefined reference to `nf_conntrack_untracked'

net/built-in.o: In function `nf_dup_ipv4':
(.text+0x152f82): undefined reference to `nf_conntrack_untracked'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


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


[PATCH 01/16] staging: wilc1000: remove sdio speed control codes

2015-11-17 Thread Glen Lee
This patch removes spi speed control related functions and variable. We cannot
get exact clock what we need in this way and it can causes some problem in host
side by setting the clock, so remove the codes.
Speed control codes in spi also will removed in next patch, so it's ok to
remove functions in linux_wlan.c and wilc_wlan.c which also not used anymore.

The Following functions and varialbe are removed.
MAX_SPEED, sdio_default_speed
wilc_bus_set_default_speed
wilc_bus_set_max_speed
linux_sdio_set_speed
linux_sdio_get_speed
wilc_sdio_set_max_speed
wilc_sdio_set_default_speed

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c  |  8 -
 drivers/staging/wilc1000/linux_wlan_sdio.c | 52 --
 drivers/staging/wilc1000/linux_wlan_sdio.h |  3 --
 drivers/staging/wilc1000/wilc_sdio.c   | 12 ---
 drivers/staging/wilc1000/wilc_wlan.c   | 10 --
 5 files changed, 85 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 89b5aca..ab17110 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -733,12 +733,6 @@ void wilc1000_wlan_deinit(struct net_device *dev)
if (wl->initialized){
netdev_info(dev, "Deinitializing wilc1000...\n");
 
-#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
-   PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n");
-#else
-   wilc_bus_set_default_speed();
-#endif
-
PRINT_D(INIT_DBG, "Disabling IRQ\n");
if (!wl->dev_irq_num &&
wl->ops->disable_interrupt) {
@@ -929,8 +923,6 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_irq_enable_;
}
 
-   wilc_bus_set_max_speed();
-
if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f366b5..761cb3d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -11,19 +11,7 @@
 
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 5000
- #endif
-#else
- #define MAX_SPEED (6 * 100) /* Max 50M */
-#endif
-
 static struct sdio_func *wilc_sdio_func;
-static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
 #define SDIO_DEVICE_ID_WILC 0x5347
@@ -177,49 +165,9 @@ void wilc_sdio_disable_interrupt(struct wilc *dev)
PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n");
 }
 
-static int linux_sdio_set_speed(int speed)
-{
-   struct mmc_ios ios;
-   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
-
-   sdio_claim_host(func);
-
-   memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct 
mmc_ios));
-   func->card->host->ios.clock = speed;
-   ios.clock = speed;
-   func->card->host->ops->set_ios(func->card->host, &ios);
-   sdio_release_host(func);
-   PRINT_INFO(INIT_DBG, " change SDIO speed to %d 
@\n", speed);
-
-   return 1;
-}
-
-static int linux_sdio_get_speed(void)
-{
-   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
-   return func->card->host->ios.clock;
-}
-
 int wilc_sdio_init(void)
 {
-
-   /**
-*  TODO :
-**/
-
-
-   sdio_default_speed = linux_sdio_get_speed();
return 1;
 }
 
-int wilc_sdio_set_max_speed(void)
-{
-   return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int wilc_sdio_set_default_speed(void)
-{
-   return linux_sdio_set_speed(sdio_default_speed);
-}
-
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
index d7b213a..dbe911a 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -6,6 +6,3 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
 
 int wilc_sdio_enable_interrupt(struct wilc *);
 void wilc_sdio_disable_interrupt(struct wilc *);
-int wilc_sdio_set_max_speed(void);
-int wilc_sdio_set_default_speed(void);
-
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 2418d52..398c7f5 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -608,16 +608,6 @@ _fail_:
return 0;
 }
 
-static void sdio_set_max_speed(void)
-{
-   wilc_sdio_set_max

[PATCH 02/16] staging: wilc1000: remove spi speed control codes

2015-11-17 Thread Glen Lee
This patch removes spi speed control codes. We are not using define SPEED to
specify speed of spi, it is not proper way of doing this. It will be
provided by the device tree.

The following functions and variable are removed.
MIN_SPEED, MAX_SPEED, SPEED
wilc_spi_set_max_speed
wilc_spi_max_bus_speed
wilc_spi_default_bus_speed
hif_set_max_bus_speed
hif_set_default_bus_speed

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 42 ---
 drivers/staging/wilc1000/linux_wlan_spi.h |  2 --
 drivers/staging/wilc1000/wilc_spi.c   | 11 
 drivers/staging/wilc1000/wilc_wlan.h  |  2 --
 4 files changed, 57 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 1d8922d..5e3bff0 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -17,33 +17,6 @@
 
 #define USE_SPI_DMA 0   /* johnny add */
 
-#ifdef WILC_ASIC_A0
- #if defined(PLAT_PANDA_ES_OMAP4460)
-  #define MIN_SPEED 1200
-  #define MAX_SPEED 2400
- #elif defined(PLAT_WMS8304)
-  #define MIN_SPEED 1200
-  #define MAX_SPEED 2400 /* 400 */
- #elif defined(CUSTOMER_PLATFORM)
-/*
-  TODO : define Clock speed under 48M.
- *
- * ex)
- * #define MIN_SPEED 2400
- * #define MAX_SPEED 4800
- */
- #else
-  #define MIN_SPEED 2400
-  #define MAX_SPEED 4800
- #endif
-#else /* WILC_ASIC_A0 */
-/* Limit clk to 6MHz on FPGA. */
- #define MIN_SPEED 600
- #define MAX_SPEED 600
-#endif /* WILC_ASIC_A0 */
-
-static u32 SPEED = MIN_SPEED;
-
 static const struct wilc1000_ops wilc1000_spi_ops;
 
 static int wilc_bus_probe(struct spi_device *spi)
@@ -119,7 +92,6 @@ int wilc_spi_write(u8 *b, u32 len)
struct spi_transfer tr = {
.tx_buf = b + (i * TXRX_PHASE_SIZE),
.len = TXRX_PHASE_SIZE,
-   .speed_hz = SPEED,
.bits_per_word = 8,
.delay_usecs = 0,
};
@@ -145,7 +117,6 @@ int wilc_spi_write(u8 *b, u32 len)
struct spi_transfer tr = {
.tx_buf = b + (blk * TXRX_PHASE_SIZE),
.len = remainder,
-   .speed_hz = SPEED,
.bits_per_word = 8,
.delay_usecs = 0,
};
@@ -187,7 +158,6 @@ int wilc_spi_write(u8 *b, u32 len)
struct spi_transfer tr = {
.tx_buf = b,
.len = len,
-   .speed_hz = SPEED,
.delay_usecs = 0,
};
char *r_buffer = kzalloc(len, GFP_KERNEL);
@@ -249,7 +219,6 @@ int wilc_spi_read(u8 *rb, u32 rlen)
struct spi_transfer tr = {
.rx_buf = rb + (i * TXRX_PHASE_SIZE),
.len = TXRX_PHASE_SIZE,
-   .speed_hz = SPEED,
.bits_per_word = 8,
.delay_usecs = 0,
};
@@ -273,7 +242,6 @@ int wilc_spi_read(u8 *rb, u32 rlen)
struct spi_transfer tr = {
.rx_buf = rb + (blk * TXRX_PHASE_SIZE),
.len = remainder,
-   .speed_hz = SPEED,
.bits_per_word = 8,
.delay_usecs = 0,
};
@@ -313,7 +281,6 @@ int wilc_spi_read(u8 *rb, u32 rlen)
struct spi_transfer tr = {
.rx_buf = rb,
.len = rlen,
-   .speed_hz = SPEED,
.delay_usecs = 0,
 
};
@@ -359,7 +326,6 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
.rx_buf = rb,
.tx_buf = wb,
.len = rlen,
-   .speed_hz = SPEED,
.bits_per_word = 8,
.delay_usecs = 0,
 
@@ -384,11 +350,3 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 
return ret;
 }
-
-int wilc_spi_set_max_speed(void)
-{
-   SPEED = MAX_SPEED;
-
-   PRINT_INFO(BUS_DBG, " change SPI speed to %d @\n", 
SPEED);
-   return 1;
-}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index f434f79..baa98cc 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -7,6 +7,4 @@ int wilc_spi_init(void);
 int wilc_spi_write(u8 *b, u32 len);
 int wilc_s

[PATCH 03/16] staging: wilc1000: remove paltform define PLAT_WMS8304

2015-11-17 Thread Glen Lee
This patch removes PLAT_WMS8304 and it's related codes as well. We will not
use this way of supporting other platform. This will be supported if necessary
by device tree later.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 161 --
 1 file changed, 161 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 5e3bff0..bfd3cc3 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -66,88 +66,6 @@ int wilc_spi_init(void)
return 1;
 }
 
-#if defined(PLAT_WMS8304)
-#define TXRX_PHASE_SIZE (4096)
-#endif
-
-#if defined(TXRX_PHASE_SIZE)
-
-int wilc_spi_write(u8 *b, u32 len)
-{
-   struct spi_device *spi = to_spi_device(wilc_dev->dev);
-   int ret;
-
-   if (len > 0 && b != NULL) {
-   int i = 0;
-   int blk = len / TXRX_PHASE_SIZE;
-   int remainder = len % TXRX_PHASE_SIZE;
-
-   char *r_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
-   if (!r_buffer)
-   return -ENOMEM;
-
-   if (blk) {
-   while (i < blk) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .tx_buf = b + (i * TXRX_PHASE_SIZE),
-   .len = TXRX_PHASE_SIZE,
-   .bits_per_word = 8,
-   .delay_usecs = 0,
-   };
-
-   tr.rx_buf = r_buffer;
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
-
-   spi_message_add_tail(&tr, &msg);
-   ret = spi_sync(spi, &msg);
-   if (ret < 0) {
-   PRINT_ER("SPI transaction failed\n");
-   }
-   i++;
-
-   }
-   }
-   if (remainder) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .tx_buf = b + (blk * TXRX_PHASE_SIZE),
-   .len = remainder,
-   .bits_per_word = 8,
-   .delay_usecs = 0,
-   };
-   tr.rx_buf = r_buffer;
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
/* rachel */
-
-   spi_message_add_tail(&tr, &msg);
-   ret = spi_sync(spi, &msg);
-   if (ret < 0) {
-   PRINT_ER("SPI transaction failed\n");
-   }
-   }
-   kfree(r_buffer);
-   } else {
-   PRINT_ER("can't write data with the following length: %d\n", 
len);
-   PRINT_ER("FAILED due to NULL buffer or ZERO length check the 
following length: %d\n", len);
-   ret = -1;
-   }
-
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
-
-   return ret;
-
-}
-
-#else
 int wilc_spi_write(u8 *b, u32 len)
 {
struct spi_device *spi = to_spi_device(wilc_dev->dev);
@@ -194,83 +112,6 @@ int wilc_spi_write(u8 *b, u32 len)
return ret;
 }
 
-#endif
-
-#if defined(TXRX_PHASE_SIZE)
-
-int wilc_spi_read(u8 *rb, u32 rlen)
-{
-   struct spi_device *spi = to_spi_device(wilc_dev->dev);
-   int ret;
-
-   if (rlen > 0) {
-   int i = 0;
-
-   int blk = rlen / TXRX_PHASE_SIZE;
-   int remainder = rlen % TXRX_PHASE_SIZE;
-
-   char *t_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
-   if (!t_buffer)
-   return -ENOMEM;
-
-   if (blk) {
-   while (i < blk) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .rx_buf = rb + (i * TXRX_PHASE_SIZE),
-   .len = TXRX_PHASE_SIZE,
-   .bits_per_word = 8,
-   .delay_usecs = 0,
-   };
-   tr.tx_buf = t_buffer;
-
-   mem

[PATCH 00/16] tidy up sdio/spi module and remove wilc_dev

2015-11-17 Thread Glen Lee
This patch series removes global variable wilc_dev and tidy up sdio/spi
modules. I sync with arnd's latest patch series because this work depends
on his patches.

Glen Lee (16):
  staging: wilc1000: remove sdio speed control codes
  staging: wilc1000: remove spi speed control codes
  staging: wilc1000: remove paltform define PLAT_WMS8304
  staging: wilc1000: pass struct wilc to the functions which use
hif_func
  staging: wilc1000: pass wilc to all function pointers of wilc_hif_func
  staging: wilc1000: wilc_sdio_cmd52: pass struct wilc
  staging: wilc1000: wilc_sdio_cmd53: pass struct wilc
  staging: wilc1000: wilc_spi_write: pass struct wilc
  staging: wilc1000: wilc_spi_read: pass struct wilc
  staging: wilc1000: wilc_spi_write_read: pass struct wilc
  staging: wilc1000: add struct wilc to host_if_drv
  staging: wilc1000: wilc_send_config_pkt: pass struct wilc
  staging: wilc1000: wilc_wlan_cfg_set: pass struct wilc
  staging: wilc1000: wilc_wlan_cfg_get: pass struct wilc
  staging: wilc1000: wilc_dbg: remove wilc
  staging: wilc1000: use wilc instead of wilc_dev and remove wilc_dev

 drivers/staging/wilc1000/coreconfigurator.c   |   7 +-
 drivers/staging/wilc1000/coreconfigurator.h   |   3 +-
 drivers/staging/wilc1000/host_interface.c | 133 +++---
 drivers/staging/wilc1000/host_interface.h |   2 +
 drivers/staging/wilc1000/linux_wlan.c | 123 ++---
 drivers/staging/wilc1000/linux_wlan_sdio.c|  60 +--
 drivers/staging/wilc1000/linux_wlan_sdio.h|   7 +-
 drivers/staging/wilc1000/linux_wlan_spi.c | 215 +--
 drivers/staging/wilc1000/linux_wlan_spi.h |   9 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 150 
 drivers/staging/wilc1000/wilc_spi.c   | 142 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   3 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 244 +-
 drivers/staging/wilc1000/wilc_wlan.h  |  37 ++--
 drivers/staging/wilc1000/wilc_wlan_if.h   |   3 +-
 15 files changed, 447 insertions(+), 691 deletions(-)

-- 
1.9.1

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


[PATCH 04/16] staging: wilc1000: pass struct wilc to the functions which use hif_func

2015-11-17 Thread Glen Lee
This patch passes struct wilc to the functions which use hif_func inside.
The function pointers of wilc_hif_func will pass wilc also in the later
patch. Pass wilc to the functions if necessary.

Flollowings are modified functions.
chip_wakeup
wilc_chip_sleep_manually
chip_allow_sleep
wilc_get_chipid
wilc_unknown_isr_ext
wilc_pllupdate_isr_ext
wilc_sleeptimer_isr_ext

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c |  3 +-
 drivers/staging/wilc1000/linux_wlan.c |  5 +--
 drivers/staging/wilc1000/wilc_wlan.c  | 56 +++
 drivers/staging/wilc1000/wilc_wlan.h  |  2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |  3 +-
 5 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 640cb6b..2531d20 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2834,6 +2834,7 @@ static int hostIFthread(void *pvArg)
u32 u32Ret;
struct host_if_msg msg;
struct host_if_drv *hif_drv;
+   struct wilc *wilc = (struct wilc*)pvArg;
 
memset(&msg, 0, sizeof(struct host_if_msg));
 
@@ -2906,7 +2907,7 @@ static int hostIFthread(void *pvArg)
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
 
if (!wilc_wlan_get_num_conn_ifcs(wilc_dev))
-   wilc_chip_sleep_manually();
+   wilc_chip_sleep_manually(wilc);
 
Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ab17110..43458e6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -514,7 +514,8 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
return 0;
 }
 
-static int linux_wlan_init_test_config(struct net_device *dev, struct wilc 
*p_nic)
+static int linux_wlan_init_test_config(struct net_device *dev,
+  struct wilc *wilc)
 {
unsigned char c_val[64];
unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff};
@@ -532,7 +533,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n",
mac_add[0], mac_add[1], mac_add[2],
mac_add[3], mac_add[4], mac_add[5]);
-   wilc_get_chipid(0);
+   wilc_get_chipid(wilc, 0);
 
*(int *)c_val = 1;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 114ea95..e30a34d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -35,9 +35,9 @@ typedef struct {
 static wilc_wlan_dev_t g_wlan;
 
 #ifdef WILC_OPTIMIZE_SLEEP_INT
-static inline void chip_allow_sleep(void);
+static inline void chip_allow_sleep(struct wilc *wilc);
 #endif
-static inline void chip_wakeup(void);
+static inline void chip_wakeup(struct wilc *wilc);
 static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
 
 /* FIXME: replace with dev_debug() */
@@ -65,7 +65,7 @@ static inline void acquire_bus(struct wilc *wilc, 
BUS_ACQUIRE_T acquire)
#endif
{
if (acquire == ACQUIRE_AND_WAKEUP)
-   chip_wakeup();
+   chip_wakeup(wilc);
}
 }
 
@@ -73,7 +73,7 @@ static inline void release_bus(struct wilc *wilc, 
BUS_RELEASE_T release)
 {
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP)
-   chip_allow_sleep();
+   chip_allow_sleep(wilc);
#endif
mutex_unlock(&wilc->hif_cs);
 }
@@ -562,7 +562,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc 
*wilc)
 
 #ifdef WILC_OPTIMIZE_SLEEP_INT
 
-static inline void chip_allow_sleep(void)
+static inline void chip_allow_sleep(struct wilc *wilc)
 {
u32 reg = 0;
 
@@ -571,7 +571,7 @@ static inline void chip_allow_sleep(void)
g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
 }
 
-static inline void chip_wakeup(void)
+static inline void chip_wakeup(struct wilc *wilc)
 {
u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;
@@ -584,12 +584,12 @@ static inline void chip_wakeup(void)
 
do {
usleep_range(2 * 1000, 2 * 1000);
-   if ((wilc_get_chipid(true) == 0))
+   if ((wilc_get_chipid(wilc, true) == 0))
wilc_debug(N_ERR, "Couldn't read chip 
id. Wake up failed\n");
 
-   } while ((wilc_get_chipid(true) == 0) && ((++trials % 
3) == 0));
+   } while ((wilc_get_chipid(wilc, true) == 0) && 
((++trials 

[PATCH 08/16] staging: wilc1000: wilc_spi_write: pass struct wilc

2015-11-17 Thread Glen Lee
This patch add new function parameter struct wilc and use it instead of
wilc_dev, and pass wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h | 3 ++-
 drivers/staging/wilc1000/wilc_spi.c   | 6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index bfd3cc3..7be750b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -66,9 +66,9 @@ int wilc_spi_init(void)
return 1;
 }
 
-int wilc_spi_write(u8 *b, u32 len)
+int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
 {
-   struct spi_device *spi = to_spi_device(wilc_dev->dev);
+   struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
struct spi_message msg;
 
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index baa98cc..41d47dc 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -2,9 +2,10 @@
 #define LINUX_WLAN_SPI_H
 
 #include 
+#include "wilc_wfi_netdevice.h"
 
 int wilc_spi_init(void);
-int wilc_spi_write(u8 *b, u32 len);
+int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
 int wilc_spi_read(u8 *rb, u32 rlen);
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 7a96004..0d89a282 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -482,7 +482,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
order = 0x2;
}
cmd |= order;
-   if (!wilc_spi_write(&cmd, 1)) {
+   if (!wilc_spi_write(wilc, &cmd, 1)) {
PRINT_ER("[wilc spi]: Failed data block cmd write, bus 
error...\n");
result = N_FAIL;
break;
@@ -491,7 +491,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
/**
 *  Write data
 **/
-   if (!wilc_spi_write(&b[ix], nbytes)) {
+   if (!wilc_spi_write(wilc, &b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block write, bus 
error...\n");
result = N_FAIL;
break;
@@ -501,7 +501,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 *  Write Crc
 **/
if (!g_spi.crc_off) {
-   if (!wilc_spi_write(crc, 2)) {
+   if (!wilc_spi_write(wilc, crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc 
write, bus error...\n");
result = N_FAIL;
break;
-- 
1.9.1

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


[PATCH 11/16] staging: wilc1000: add struct wilc to host_if_drv

2015-11-17 Thread Glen Lee
This patch adds struct wilc to host_if_dev and assign wilc to use driver's
primary structure in host_if_dev.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 1 +
 drivers/staging/wilc1000/host_interface.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2531d20..3609949 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3848,6 +3848,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
result = -ENOMEM;
goto _fail_;
}
+   hif_drv->wilc = wilc;
*hif_drv_handler = hif_drv;
err = add_handler_in_list(hif_drv);
if (err) {
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index efeb9e2..004467c6 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -259,7 +259,9 @@ enum p2p_listen_state {
P2P_GRP_FORMATION
 };
 
+struct wilc;
 struct host_if_drv {
+   struct wilc *wilc;
struct user_scan_req usr_scan_req;
struct user_conn_req usr_conn_req;
struct remain_ch remain_on_ch;
-- 
1.9.1

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


[PATCH 09/16] staging: wilc1000: wilc_spi_read: pass struct wilc

2015-11-17 Thread Glen Lee
This patch adds new function parameter struct wilc and use it instead of
global variable wilc_dev, and pass wilc to the functions as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c |  4 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h |  2 +-
 drivers/staging/wilc1000/wilc_spi.c   | 10 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 7be750b..5066191 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -112,9 +112,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
return ret;
 }
 
-int wilc_spi_read(u8 *rb, u32 rlen)
+int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
 {
-   struct spi_device *spi = to_spi_device(wilc_dev->dev);
+   struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
 
if (rlen > 0) {
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 41d47dc..16f0b9f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -6,6 +6,6 @@
 
 int wilc_spi_init(void);
 int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
-int wilc_spi_read(u8 *rb, u32 rlen);
+int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen);
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 0d89a282..f5db2fc 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -365,7 +365,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(&b[ix], nbytes)) {
+   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block 
read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -375,7 +375,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (!wilc_spi_read(crc, 2)) {
+   if (!wilc_spi_read(wilc, crc, 2)) {
PRINT_ER("[wilc spi]: Failed 
data block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -406,7 +406,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 **/
retry = 10;
do {
-   if (!wilc_spi_read(&rsp, 1)) {
+   if (!wilc_spi_read(wilc, &rsp, 1)) {
PRINT_ER("[wilc spi]: Failed 
data response read, bus error...\n");
result = N_FAIL;
break;
@@ -422,7 +422,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(&b[ix], nbytes)) {
+   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block 
read, bus error...\n");
result = N_FAIL;
break;
@@ -432,7 +432,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (!wilc_spi_read(crc, 2)) {
+   if (!wilc_spi_read(wilc, crc, 2)) {
PRINT_ER("[wilc spi]: Failed 
data block crc read, bus error...\n");
result = N_FAIL;
break;
-- 
1.9.1

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


[PATCH 10/16] staging: wilc1000: wilc_spi_write_read: pass struct wilc

2015-11-17 Thread Glen Lee
This patch adds new function parameter struct wilc and use it instead of
global variable wilc_dev, and pass wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h | 2 +-
 drivers/staging/wilc1000/wilc_spi.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 5066191..f3ffc9e 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -154,9 +154,9 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
return ret;
 }
 
-int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
 {
-   struct spi_device *spi = to_spi_device(wilc_dev->dev);
+   struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
 
if (rlen > 0) {
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 16f0b9f..00733ab 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -7,5 +7,5 @@
 int wilc_spi_init(void);
 int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
 int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen);
-int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
+int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index f5db2fc..b6a6ce2 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
}
rix = len;
 
-   if (!wilc_spi_write_read(wb, rb, len2)) {
+   if (!wilc_spi_write_read(wilc, wb, rb, len2)) {
PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
-- 
1.9.1

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


[PATCH 05/16] staging: wilc1000: pass wilc to all function pointers of wilc_hif_func

2015-11-17 Thread Glen Lee
This patch adds new function parameter struct wilc to all function pointers
of struct wilc_hif_func, and all functions of wilc_sdio.c and wilc_spi.c
need to be changed as it's function pointer is changed.
Pass wilc in all the functions call as well.

The wilc will be passed to functions in linux_wlan_sdio.c and linux_wlan_spi.c
to replace with global variable wilc_dev in the next patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_sdio.c |  84 +-
 drivers/staging/wilc1000/wilc_spi.c  | 113 +---
 drivers/staging/wilc1000/wilc_wlan.c | 167 +++
 drivers/staging/wilc1000/wilc_wlan.h |  26 +++---
 4 files changed, 208 insertions(+), 182 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 398c7f5..a920e76 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -26,8 +26,8 @@ typedef struct {
 
 static wilc_sdio_t g_sdio;
 
-static int sdio_write_reg(u32 addr, u32 data);
-static int sdio_read_reg(u32 addr, u32 *data);
+static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
+static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data);
 
 /
  *
@@ -35,7 +35,7 @@ static int sdio_read_reg(u32 addr, u32 *data);
  *
  /
 
-static int sdio_set_func0_csa_address(u32 adr)
+static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr)
 {
sdio_cmd52_t cmd;
 
@@ -71,7 +71,7 @@ _fail_:
return 0;
 }
 
-static int sdio_set_func0_block_size(u32 block_size)
+static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size)
 {
sdio_cmd52_t cmd;
 
@@ -103,7 +103,7 @@ _fail_:
  *
  /
 
-static int sdio_set_func1_block_size(u32 block_size)
+static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size)
 {
sdio_cmd52_t cmd;
 
@@ -128,7 +128,7 @@ _fail_:
return 0;
 }
 
-static int sdio_clear_int(void)
+static int sdio_clear_int(struct wilc *wilc)
 {
if (!g_sdio.irq_gpio) {
/* u32 sts; */
@@ -145,12 +145,12 @@ static int sdio_clear_int(void)
} else {
u32 reg;
 
-   if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
+   if (!sdio_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) {
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg 
(%08x)...\n", WILC_HOST_RX_CTRL_0);
return 0;
}
reg &= ~0x1;
-   sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
+   sdio_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg);
return 1;
}
 
@@ -161,7 +161,7 @@ static int sdio_clear_int(void)
  *  Sdio interfaces
  *
  /
-static int sdio_write_reg(u32 addr, u32 data)
+static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
 #ifdef BIG_ENDIAN
data = BYTE_SWAP(data);
@@ -185,7 +185,7 @@ static int sdio_write_reg(u32 addr, u32 data)
/**
 *  set the AHB address
 **/
-   if (!sdio_set_func0_csa_address(addr))
+   if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
 
cmd.read_write = 1;
@@ -210,7 +210,7 @@ _fail_:
return 0;
 }
 
-static int sdio_write(u32 addr, u8 *buf, u32 size)
+static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
 {
u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd;
@@ -257,7 +257,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
cmd.buffer = buf;
cmd.block_size = block_size;
if (addr > 0) {
-   if (!sdio_set_func0_csa_address(addr))
+   if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
if (!wilc_sdio_cmd53(&cmd)) {
@@ -278,7 +278,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
cmd.block_size = block_size; /* johnny : prevent it from 
setting unexpected value */
 
if (addr > 0) {
-   if (!sdio_set_func0_csa_address(addr))
+   if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
if (!wilc_sdio_cmd53(&cmd)) {
@@ -294,7 +294,7 @@ _fail_:
return 0;
 }
 
-static int sdio_read_reg(u32 addr, u32 *data)
+static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd;
@@ -311,7 +311,7 @@ static int sdio_read_reg(u32 addr, u32 *data)
} else {
sdio_cmd53_t cmd;
 
-   if (!sdio_

[PATCH 07/16] staging: wilc1000: wilc_sdio_cmd53: pass struct wilc

2015-11-17 Thread Glen Lee
This patch adds new function parameter struct wilc and use it instead of
global variable wilc_dev and pass wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c |  4 ++--
 drivers/staging/wilc1000/linux_wlan_sdio.h |  2 +-
 drivers/staging/wilc1000/wilc_sdio.c   | 12 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 6a38876..92633aa 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -61,9 +61,9 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
 }
 
 
-int wilc_sdio_cmd53(sdio_cmd53_t *cmd)
+int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
 {
-   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
+   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
int size, ret;
 
sdio_claim_host(func);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
index d966bb9..8d276c6 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -2,7 +2,7 @@
 
 int wilc_sdio_init(void);
 int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd);
-int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
+int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd);
 
 int wilc_sdio_enable_interrupt(struct wilc *);
 void wilc_sdio_disable_interrupt(struct wilc *);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 4d0ee69..a68a7a4 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -197,7 +197,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from 
setting unexpected value */
 
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write 
reg (%08x)...\n", addr);
goto _fail_;
}
@@ -260,7 +260,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], 
block send...\n", addr);
goto _fail_;
}
@@ -281,7 +281,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], 
bytes send...\n", addr);
goto _fail_;
}
@@ -324,7 +324,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
 
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from 
setting unexpected value */
 
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read 
reg (%08x)...\n", addr);
goto _fail_;
}
@@ -391,7 +391,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], 
block read...\n", addr);
goto _fail_;
}
@@ -412,7 +412,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(&cmd)) {
+   if (!wilc_sdio_cmd53(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], 
bytes read...\n", addr);
goto _fail_;
}
-- 
1.9.1

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


[PATCH 16/16] staging: wilc1000: use wilc instead of wilc_dev and remove wilc_dev

2015-11-17 Thread Glen Lee
This patch changes wilc_dev with wilc in the function call
wilc_wlan_get_num_conn_ifcs, and remove wilc_dev and it's related codes.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 5 +
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 43b77b7..e366366 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2919,7 +2919,7 @@ static int hostIFthread(void *pvArg)
del_timer(&hif_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
 
-   if (!wilc_wlan_get_num_conn_ifcs(wilc_dev))
+   if (!wilc_wlan_get_num_conn_ifcs(wilc))
wilc_chip_sleep_manually(wilc);
 
Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index cd471ab..73954f4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -43,8 +43,6 @@ static int  mac_init_fn(struct net_device *ndev);
 static struct net_device_stats *mac_stats(struct net_device *dev);
 static int  mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
 static void wilc_set_multicast_list(struct net_device *dev);
-struct wilc *wilc_dev;
-EXPORT_SYMBOL_GPL(wilc_dev);
 
 bool wilc_enable_ps = true;
 
@@ -1432,7 +1430,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
sema_init(&close_exit_sync, 0);
 
-   wl = kzalloc(sizeof(*wilc_dev), GFP_KERNEL);
+   wl = kzalloc(sizeof(*wl), GFP_KERNEL);
if (!wl)
return -ENOMEM;
 
@@ -1495,7 +1493,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
nic->iftype = STATION_MODE;
nic->mac_opened = 0;
}
-   wilc_dev = *wilc = wl;
 
return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 4c8de8b..212d607 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -205,7 +205,6 @@ struct WILC_WFI_mon_priv {
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
 
-extern struct wilc *wilc_dev;
 extern struct net_device *WILC_WFI_devs[];
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
-- 
1.9.1

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


[PATCH 06/16] staging: wilc1000: wilc_sdio_cmd52: pass struct wilc

2015-11-17 Thread Glen Lee
This patch adds new function parameter struct wilc and use it instead of
wilc_dev. Pass wilc to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c |  4 +--
 drivers/staging/wilc1000/linux_wlan_sdio.h |  2 +-
 drivers/staging/wilc1000/wilc_sdio.c   | 42 +++---
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 761cb3d..6a38876 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -29,9 +29,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
sdio_claim_host(func);
 }
 
-int wilc_sdio_cmd52(sdio_cmd52_t *cmd)
+int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
 {
-   struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, 
dev);
+   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
int ret;
u8 data;
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
index dbe911a..d966bb9 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,7 +1,7 @@
 #include 
 
 int wilc_sdio_init(void);
-int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
+int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd);
 int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
 
 int wilc_sdio_enable_interrupt(struct wilc *);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index a920e76..4d0ee69 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -47,21 +47,21 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, 
u32 adr)
cmd.raw = 0;
cmd.address = 0x10c;
cmd.data = (u8)adr;
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c 
data...\n");
goto _fail_;
}
 
cmd.address = 0x10d;
cmd.data = (u8)(adr >> 8);
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d 
data...\n");
goto _fail_;
}
 
cmd.address = 0x10e;
cmd.data = (u8)(adr >> 16);
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e 
data...\n");
goto _fail_;
}
@@ -80,14 +80,14 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 
block_size)
cmd.raw = 0;
cmd.address = 0x10;
cmd.data = (u8)block_size;
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 
data...\n");
goto _fail_;
}
 
cmd.address = 0x11;
cmd.data = (u8)(block_size >> 8);
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 
data...\n");
goto _fail_;
}
@@ -112,13 +112,13 @@ static int sdio_set_func1_block_size(struct wilc *wilc, 
u32 block_size)
cmd.raw = 0;
cmd.address = 0x110;
cmd.data = (u8)block_size;
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 
data...\n");
goto _fail_;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 
data...\n");
goto _fail_;
}
@@ -139,7 +139,7 @@ static int sdio_clear_int(struct wilc *wilc)
cmd.raw = 0;
cmd.address = 0x4;
cmd.data = 0;
-   wilc_sdio_cmd52(&cmd);
+   wilc_sdio_cmd52(wilc, &cmd);
 
return cmd.data;
} else {
@@ -175,7 +175,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.raw = 0;
cmd.address = addr;
cmd.data = data;
-   if (!wilc_sdio_cmd52(&cmd)) {
+   if (!wilc_sdio_cmd52(wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read 
reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -303,7 +303,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
  

[PATCH 15/16] staging: wilc1000: wilc_dbg: remove wilc

2015-11-17 Thread Glen Lee
This patch remove parameter struct wilc since it is not used and also wilc_dev
will be removed.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1457e75..cd471ab 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -245,7 +245,7 @@ static void deinit_irq(struct net_device *dev)
}
 }
 
-void wilc_dbg(struct wilc *wilc, u8 *buff)
+void wilc_dbg(u8 *buff)
 {
PRINT_D(INIT_DBG, "%d\n", *buff);
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 6ec6d6a..4c8de8b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -210,7 +210,7 @@ extern struct net_device *WILC_WFI_devs[];
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
 void wilc_rx_complete(struct wilc *wilc);
-void wilc_dbg(struct wilc *, u8 *buff);
+void wilc_dbg(u8 *buff);
 
 int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout);
 void wilc_netdev_cleanup(struct wilc *wilc);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a271851..a73e99f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -51,7 +51,7 @@ static void wilc_debug(u32 flag, char *fmt, ...)
vsprintf(buf, fmt, args);
va_end(args);
 
-   wilc_dbg(wilc_dev, buf);
+   wilc_dbg(buf);
}
 }
 
-- 
1.9.1

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


[PATCH 12/16] staging: wilc1000: wilc_send_config_pkt: pass struct wilc

2015-11-17 Thread Glen Lee
This patch passes struct wilc to wilc_send_config_pkt. The function
wilc_wlan_cfg_set and wilc_wlan_cfg_get function will get wilc to replace
wilc_dev with it.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c |   3 +-
 drivers/staging/wilc1000/coreconfigurator.h |   3 +-
 drivers/staging/wilc1000/host_interface.c   | 127 +++-
 3 files changed, 74 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 47fa82f..dc290d1 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -588,7 +588,8 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo 
*pstrConnectRespInfo)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
+s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+u32 count, u32 drv)
 {
s32 counter = 0, ret = 0;
 
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 912d5c2..3f2a7d3 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -127,7 +127,8 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
+s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
+u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
 s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
 
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3609949..43b77b7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -329,7 +329,7 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   result = wilc_send_config_pkt(SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
if (result) {
@@ -351,7 +351,8 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv 
*hif_drv,
wid.val = (s8 *)&hif_drv_handler->handler;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(SET_CFG, &wid, 1, 
hif_drv_handler->handler);
+   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+ hif_drv_handler->handler);
 
if (!hif_drv)
up(&hif_sema_driver);
@@ -375,7 +376,7 @@ static s32 handle_set_operation_mode(struct host_if_drv 
*hif_drv,
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
if ((hif_op_mode->mode) == IDLE_MODE)
@@ -410,7 +411,7 @@ static s32 handle_set_ip_address(struct host_if_drv 
*hif_drv, u8 *ip_addr, u8 id
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx);
@@ -435,7 +436,7 @@ static s32 handle_get_ip_address(struct host_if_drv 
*hif_drv, u8 idx)
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(GET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -478,7 +479,7 @@ static s32 handle_set_mac_address(struct host_if_drv 
*hif_drv,
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
 
-   result = wilc_send_config_pkt(SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -500,7 +501,7 @@ static s32 handle_get_mac_address(struct host_if_drv 
*hif_drv,
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
 
-   result = wilc_send_config_pkt(GET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
if (result) {
@@ -795,8 +796,8 @@ static s32 ha

[PATCH 13/16] staging: wilc1000: wilc_wlan_cfg_set: pass struct wilc

2015-11-17 Thread Glen Lee
This patch pass struct wilc to the function and use it instead of global
variable wilc_dev.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c |   2 +-
 drivers/staging/wilc1000/linux_wlan.c   | 101 
 drivers/staging/wilc1000/wilc_wlan.c|   5 +-
 drivers/staging/wilc1000/wilc_wlan.h|   4 +-
 4 files changed, 63 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index dc290d1..6278aec 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -616,7 +616,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct 
wid *wids,
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET 
WID:%x\n", wids[counter].id);
-   if (!wilc_wlan_cfg_set(!counter,
+   if (!wilc_wlan_cfg_set(wilc, !counter,
   wids[counter].id,
   wids[counter].val,
   wids[counter].size,
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 43458e6..792cc0b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -537,179 +537,194 @@ static int linux_wlan_init_test_config(struct 
net_device *dev,
 
*(int *)c_val = 1;
 
-   if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;
 
c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = INFRASTRUCTURE;
-   if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = RATE_AUTO;
-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = G_MIXED_11B_2_MODE;
-   if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
+  0))
goto _fail_;
 
c_val[0] = 1;
-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = G_SHORT_PREAMBLE;
-   if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = AUTO_PROT;
-   if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = ACTIVE_SCAN;
-   if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = SITE_SURVEY_OFF;
-   if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;
 
*((int *)c_val) = 0x;
-   if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
 
*((int *)c_val) = 2346;
-   if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
 
c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = 1;
-   if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = NO_POWERSAVE;
-   if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
-   if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = OPEN_SYSTEM;
-   if (!wilc_wlan_cfg_set(0, 

[PATCH 14/16] staging: wilc1000: wilc_wlan_cfg_get: pass struct wilc

2015-11-17 Thread Glen Lee
This patch passes the struct wilc to the function and use it instead of
global variable wilc_dev.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c   | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c| 4 ++--
 drivers/staging/wilc1000/wilc_wlan.h| 3 ++-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 6278aec..0cd2acc 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -597,7 +597,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct 
wid *wids,
for (counter = 0; counter < count; counter++) {
PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet 
[%d][%d]\n", !counter,
   (counter == count - 1));
-   if (!wilc_wlan_cfg_get(!counter,
+   if (!wilc_wlan_cfg_get(wilc, !counter,
   wids[counter].id,
   (counter == count - 1),
   drv)) {
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 792cc0b..1457e75 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -939,7 +939,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_irq_enable_;
}
 
-   if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
+   if (wilc_wlan_cfg_get(wl, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 03c707b..a271851 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1540,10 +1540,10 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 
wid, u8 *buffer,
return ret_size;
 }
 
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler)
+int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
+ u32 drv_handler)
 {
wilc_wlan_dev_t *p = &g_wlan;
-   struct wilc *wilc = wilc_dev;
u32 offset;
int ret_size;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index e1a8c73..2ac63a3 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -291,7 +291,8 @@ void wilc_handle_isr(struct wilc *wilc);
 void wilc_wlan_cleanup(struct net_device *dev);
 int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
  u32 buffer_size, int commit, u32 drv_handler);
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler);
+int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
+ u32 drv_handler);
 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
 int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
   u32 buffer_size, wilc_tx_complete_func_t func);
-- 
1.9.1

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


[PATCH 1/4] staging: wilc1000: remove define COMPLEMENT_BOOT

2015-11-18 Thread Glen Lee
This patch removes define COMPLEMENT_BOOT in Makefile. The feature was removed
by the following commit but the define was not removed. So remove completely.

b46d68825c2d3af70ad18b53dfed6516e393b7fa

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 198d536..c55fdd2 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,5 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
-ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT
-
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
-- 
1.9.1

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


[PATCH 4/4] staging: wilc1000: use kernel define byte order macros

2015-11-18 Thread Glen Lee
This patch removes define BIG_ENDIAN and use kernel define byte order macros
instead of swap itself. Remove unused BYTE_SWAP macro and __CHECK_ENDIAN__
in Makefile also.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile|  2 +-
 drivers/staging/wilc1000/wilc_sdio.c |  8 ++--
 drivers/staging/wilc1000/wilc_spi.c  | 16 
 drivers/staging/wilc1000/wilc_wlan.c | 22 ++
 drivers/staging/wilc1000/wilc_wlan.h | 11 ---
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 16 +++-
 6 files changed, 16 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index cd71be9..2076743 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,7 +4,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
 
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index a68a7a4..6eae08e 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -163,9 +163,7 @@ static int sdio_clear_int(struct wilc *wilc)
  /
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
-#ifdef BIG_ENDIAN
-   data = BYTE_SWAP(data);
-#endif
+   data = cpu_to_le32(data);
 
if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd;
@@ -330,9 +328,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
}
}
 
-#ifdef BIG_ENDIAN
-   *data = BYTE_SWAP(*data);
-#endif
+   *data = cpu_to_le32(*data);
 
return 1;
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index b6a6ce2..20e2532 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -529,9 +529,7 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, 
u32 dat)
 {
int result;
 
-#ifdef BIG_ENDIAN
-   dat = BYTE_SWAP(dat);
-#endif
+   dat = cpu_to_le32(dat);
result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4,
  0);
if (result != N_OK) {
@@ -552,9 +550,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, 
u32 *data)
return 0;
}
 
-#ifdef BIG_ENDIAN
-   *data = BYTE_SWAP(*data);
-#endif
+   *data = cpu_to_le32(*data);
 
return 1;
 }
@@ -571,9 +567,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, 
u32 data)
u8 cmd = CMD_SINGLE_WRITE;
u8 clockless = 0;
 
-#ifdef BIG_ENDIAN
-   data = BYTE_SWAP(data);
-#endif
+   data = cpu_to_le32(data);
if (addr < 0x30) {
/* Clockless register*/
cmd = CMD_INTERNAL_WRITE;
@@ -635,9 +629,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, 
u32 *data)
return 0;
}
 
-#ifdef BIG_ENDIAN
-   *data = BYTE_SWAP(*data);
-#endif
+   *data = cpu_to_le32(*data);
 
return 1;
 }
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 27a44ee..a74a95e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -759,9 +759,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
vmm_table[i] |= BIT(10);
PRINT_D(TX_DBG, "VMMTable entry changed 
for CFG packet = %d\n", vmm_table[i]);
}
-#ifdef BIG_ENDIAN
-   vmm_table[i] = BYTE_SWAP(vmm_table[i]);
-#endif
+   vmm_table[i] = cpu_to_le32(vmm_table[i]);
 
i++;
sum += vmm_sz;
@@ -886,9 +884,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
if (tqe && (vmm_table[i] != 0)) {
u32 header, buffer_offset;
 
-#ifdef BIG_ENDIAN
-   vmm_table[i] = BYTE_SWAP(vmm_table[i]);
-#endif
+   vmm_table[i] = cpu_to_le32(vmm_table[i]);
vmm_sz = (vmm_table[i] & 0x3ff);
vmm_sz *= 4;
header = (tqe->type << 31) |
@@ -899,9 +895,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
els

[PATCH 3/4] staging: wilc1000: rename index to tcp_pending_ack_idx

2015-11-18 Thread Glen Lee
This patch renames "index" of struct txq_entry_t to tcp_pending_ack_idx since
this name could be confused index of txq_entry_t. It is index of tcp pending
ack.

It fixes 8e55639d066f4ef402ba88fca08ed1be70e1c4da

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 12 ++--
 drivers/staging/wilc1000/wilc_wlan.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 10def3f..27a44ee 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -249,7 +249,7 @@ static inline int add_tcp_pending_ack(u32 ack, u32 
session_index,
pending_acks_info[pending_base + pending_acks].ack_num = ack;
pending_acks_info[pending_base + pending_acks].txqe = txqe;
pending_acks_info[pending_base + pending_acks].session_index = 
session_index;
-   txqe->index = pending_base + pending_acks;
+   txqe->tcp_pending_ack_idx = pending_base + pending_acks;
pending_acks++;
}
return 0;
@@ -421,7 +421,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 
*buffer, u32 buffer_s
tqe->tx_complete_func = NULL;
tqe->priv = NULL;
 #ifdef TCP_ACK_FILTER
-   tqe->index = NOT_TCP_ACK;
+   tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
 #endif
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
 
@@ -451,7 +451,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
 
PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
 #ifdef TCP_ACK_FILTER
-   tqe->index = NOT_TCP_ACK;
+   tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
if (is_tcp_ack_filter_enabled())
tcp_process(dev, tqe);
 #endif
@@ -478,7 +478,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void 
*priv, u8 *buffer,
tqe->tx_complete_func = func;
tqe->priv = priv;
 #ifdef TCP_ACK_FILTER
-   tqe->index = NOT_TCP_ACK;
+   tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
 #endif
PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
wilc_wlan_txq_add_to_tail(dev, tqe);
@@ -923,8 +923,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
tqe->tx_complete_func(tqe->priv,
  tqe->status);
#ifdef TCP_ACK_FILTER
-   if (tqe->index != NOT_TCP_ACK)
-   pending_acks_info[tqe->index].txqe = 
NULL;
+   if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK)
+   
pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL;
#endif
kfree(tqe);
} else {
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 2ac63a3..27c7bbb 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -216,7 +216,7 @@ struct txq_entry_t {
struct txq_entry_t *next;
struct txq_entry_t *prev;
int type;
-   int index;
+   int tcp_pending_ack_idx;
u8 *buffer;
int buffer_size;
void *priv;
-- 
1.9.1

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


[PATCH 2/4] staging: wilc1000: remove wilc memory allocation config

2015-11-18 Thread Glen Lee
This patch remove memory allocation options in Kconfig. It was used a long time
ago to aquire memory, which we will not use this config anymore.
Remove it's config, related define and codes as well. We will take
PREALLOCATE_AT_LOADING_DRIVER as it is default.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Kconfig | 22 
 drivers/staging/wilc1000/Makefile|  6 --
 drivers/staging/wilc1000/linux_wlan_common.h |  2 --
 drivers/staging/wilc1000/wilc_wlan.c | 30 
 4 files changed, 60 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index 2923122..dce9cee 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -31,28 +31,6 @@ config WILC1000_SPI
  immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
  VDDIO. Select this if your platform is using the SPI bus.
 
-choice
-prompt "WILC1000 Memory Allocation"
-depends on WILC1000
-default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-   bool "Preallocate memory at loading driver"
-   ---help---
- This choice supports static allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- during initial time. The driver will also free the buffer
- by calling network device stop.
-
-config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
-bool "Dynamically allocate memory in real time"
----help---
- This choice supports dynamic allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- when it is required.
-endchoice
-
-
 config WILC1000_HW_OOB_INTR
bool "WILC1000 out of band interrupt"
depends on WILC1000_SDIO
diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index c55fdd2..cd71be9 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -7,12 +7,6 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
 ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
-ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
-   
-DWILC_PREALLOC_AT_INSMOD
-
-ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC
-
-
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
wilc_msgqueue.o \
coreconfigurator.o host_interface.o \
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h 
b/drivers/staging/wilc1000/linux_wlan_common.h
index 72b524a..5d40f05 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -124,9 +124,7 @@ extern atomic_t WILC_DEBUG_LEVEL;
 #define FN_IN   /* PRINT_D(">>> \n") */
 #define FN_OUT  /* PRINT_D("<<<\n") */
 
-#ifdef MEMORY_STATIC
 #define LINUX_RX_SIZE  (96 * 1024)
-#endif
 #define LINUX_TX_SIZE  (64 * 1024)
 
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a73e99f..10def3f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -12,10 +12,8 @@ typedef struct {
u32 cfg_frame_offset;
int cfg_seq_no;
 
-   #ifdef MEMORY_STATIC
u8 *rx_buffer;
u32 rx_buffer_offset;
-   #endif
u8 *tx_buffer;
u32 tx_buffer_offset;
 
@@ -1050,9 +1048,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
if (offset >= size)
break;
} while (1);
-#ifndef MEMORY_STATIC
-   kfree(buffer);
-#endif
kfree(rqe);
 
if (has_packet)
@@ -1097,9 +1092,7 @@ static void wilc_sleeptimer_isr_ext(struct wilc *wilc, 
u32 int_stats1)
 static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 {
wilc_wlan_dev_t *p = &g_wlan;
-#ifdef MEMORY_STATIC
u32 offset = p->rx_buffer_offset;
-#endif
u8 *buffer = NULL;
u32 size;
u32 retries = 0;
@@ -1118,7 +,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
u32 int_status)
}
 
if (size > 0) {
-#ifdef MEMORY_STATIC
if (LINUX_RX_SIZE - offset < size)
offset = 0;
 
@@ -1129,13 +1121,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
u32 int_status)
goto _end_;
}
 
-#else
-   buffer = kmalloc(size, GFP_KERNEL);
-   if (!buffer) {
-   usleep_range(100 * 1000, 100 * 1000);
-   goto _end_;
-   }
-#endif
 

Re: staging: wilc1000: call linux_sdio_init instead of io_init

2015-11-18 Thread glen lee



On 2015년 11월 18일 19:30, Dan Carpenter wrote:

Hello Glen Lee,

The patch de11ee8b214e: "staging: wilc1000: call linux_sdio_init
instead of io_init" from Nov 6, 2015, leads to the following static
checker warning:

drivers/staging/wilc1000/wilc_sdio.c:574 sdio_init()
info: ignoring unreachable code.

drivers/staging/wilc1000/wilc_sdio.c
553
554  static int sdio_init(struct wilc *wilc, wilc_debug_func func)
555  {
556  sdio_cmd52_t cmd;
557  int loop;
558  u32 chipid;
559
560  memset(&g_sdio, 0, sizeof(wilc_sdio_t));
561
562  g_sdio.dPrint = func;
563
564  if (!linux_sdio_init()) {
565  g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init 
bus...\n");
566  return 0;
567  } else {
568  return 0;
569  }
570
571  /**
572   *  function 0 csa enable
573   **/
574  cmd.read_write = 1;

This line is not reachable now.


Hello dan,

Thank you for this.
I made mistake with this patch and I have posted a patch which fix this. Not 
yet applied.
[PATCH] staging: wilc1000: fix bug in sdio/spi



Really, you should consider runing Smatch over this driver.  Anyway, I
have pasted most of the warnings here.  Based on yesterday's linux-next.
Some of the warnings are not in the released versions of Smatch...


Thank you again for this.
I'll run Smatch and look into them step by step.

regards,
glen lee



drivers/staging/wilc1000/wilc_wlan.c:1330 wilc_wlan_start() warn: bool is not 
less than zero.
drivers/staging/wilc1000/host_interface.c:368 handle_set_wfi_drv_handler() warn: 
'sem:&hif_sema_driver' is sometimes locked here and sometimes unlocked.
drivers/staging/wilc1000/host_interface.c:1028 Handle_Connect() error: potential 
null dereference 'hif_drv->usr_conn_req.pu8ssid'.  (kmalloc returns null)
drivers/staging/wilc1000/host_interface.c:1428 Handle_RcvdNtwrkInfo() warn: this 
array is probably non-NULL. 'hif_drv->usr_scan_req.net_info[i]->au8bssid'
drivers/staging/wilc1000/host_interface.c:1429 Handle_RcvdNtwrkInfo() warn: this 
array is probably non-NULL. 'pstrNetworkInfo->au8bssid'
drivers/staging/wilc1000/host_interface.c:1450 Handle_RcvdNtwrkInfo() warn: this array 
is probably non-NULL. 
'hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt]->au8bssid'
drivers/staging/wilc1000/host_interface.c:1451 Handle_RcvdNtwrkInfo() warn: this 
array is probably non-NULL. 'pstrNetworkInfo->au8bssid'
drivers/staging/wilc1000/host_interface.c:1771 Handle_Key() warn: passing freed 
memory 'pstrHostIFkeyAttr->attr.wep.key'
drivers/staging/wilc1000/host_interface.c:1872 Handle_Key() error: double unlock 
'sem:&hif_drv->sem_test_key_block'
drivers/staging/wilc1000/host_interface.c:1933 Handle_Key() error: double unlock 
'sem:&hif_drv->sem_test_key_block'
drivers/staging/wilc1000/host_interface.c:2619 Handle_ListenStateExpired() 
error: potential null dereference 'wid.val'.  (kmalloc returns null)
drivers/staging/wilc1000/host_interface.c:2619 Handle_ListenStateExpired() 
error: we previously assumed 'wid.val' could be null (see line 2616)
drivers/staging/wilc1000/host_interface.c:2703 Handle_SetMulticastFilter() 
warn: 0xff is larger than 1 bits
drivers/staging/wilc1000/host_interface.c:2704 Handle_SetMulticastFilter() 
warn: right shifting more than type allows
drivers/staging/wilc1000/host_interface.c:4062 hif_get_cfg() warn: inconsistent 
returns 'sem:&hif_drv->sem_cfg_values'.
   Locked on:   line 3980
   Unlocked on: line 4062
drivers/staging/wilc1000/host_interface.c:4198 host_int_init() warn: inconsistent 
returns 'sem:&hif_drv->sem_cfg_values'.
   Locked on:   line 4198
   Unlocked on: line 4188
drivers/staging/wilc1000/host_interface.c:4984 host_int_setup_ipaddress() info: 
ignoring unreachable code.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:731 scan() warn: this array is 
probably non-NULL. 'request->ssids + i->ssid'
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:732 scan() error: potential 
null dereference 'strHiddenNetwork.pstrHiddenNetworkInfo'.  (kmalloc returns 
null)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:1280 add_key() error: 
potential null dereference 'g_key_gtk_params.key'.  (kmalloc returns null)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2995 add_station() error: buffer 
overflow 'priv->assoc_stainfo.au8Sta_AssociatedBss' 9 <= 2007
drivers/staging/wilc1000/linux_wlan.c:423 linux_wlan_txq_task() error: double unlock 
'sem:&wl->txq_thread_started'
drivers/staging/wilc1000/linux_wlan.c:493 linux_wlan_get_firmware() warn: 
missing e

Re: [PATCH 1/4] staging: wilc1000: remove define COMPLEMENT_BOOT

2015-11-18 Thread glen lee


On 2015년 11월 19일 15:19, Dan Carpenter wrote:

On Thu, Nov 19, 2015 at 11:05:58AM +0900, Glen Lee wrote:

This patch removes define COMPLEMENT_BOOT in Makefile. The feature was removed
by the following commit but the define was not removed. So remove completely.

b46d68825c2d3af70ad18b53dfed6516e393b7fa

Put some human readable text next to the hash.  The standard thing is to
include only the first 12 characters of the hash.  If there are fewer
than 12 characters then we could get collisions but including the whole
hash is excessive.


Ok, I understand. Thank you for your advise.

regards,
glen lee



This patch removes define COMPLEMENT_BOOT in Makefile. The feature was
removed by commit b46d68825c2d ('staging: wilc1000: remove
COMPLEMENT_BOOT') but the define was not removed. So remove completely.

regards,
dan carpenter



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


Re: [PATCH 3/4] staging: wilc1000: rename index to tcp_pending_ack_idx

2015-11-18 Thread glen lee



On 2015년 11월 19일 15:23, Dan Carpenter wrote:

On Thu, Nov 19, 2015 at 11:06:00AM +0900, Glen Lee wrote:

This patch renames "index" of struct txq_entry_t to tcp_pending_ack_idx since
this name could be confused index of txq_entry_t. It is index of tcp pending
ack.

It fixes 8e55639d066f4ef402ba88fca08ed1be70e1c4da


It is just a cleanup patch and not a bugfix patch so "fix" is the wrong
word here.  But the correct format for fixes tags is:

Fixes: 123456789012 ('Title of patch')


I see, I learned another one. Thanks.



regards,
dan carpenter



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


[PATCH 05/26] staging: wilc1000: rename u8WLANChannel variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u8WLANChannel variable to wlan_channel to avoid camelcase.
And, remove the relation comment.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 29 +--
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c2e7bf8..3b072ef 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -169,9 +169,7 @@ struct p2p_mgmt_data {
u8 *buff;
 };
 
-/*Global variable used to state the current  connected STA channel*/
-static u8 u8WLANChannel = INVALID_CHANNEL;
-
+static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 
 static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
@@ -593,9 +591,8 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
wilc_wlan_set_bssid(priv->dev, NullBssid);
eth_zero_addr(wilc_connected_SSID);
 
-   /*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->p2p_connect)
-   u8WLANChannel = INVALID_CHANNEL;
+   wlan_channel = INVALID_CHANNEL;
 
PRINT_ER("Unspecified failure: Connection status %d : 
MAC status = %d\n", u16ConnectStatus, u8MacStatus);
}
@@ -652,9 +649,8 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
wilc_wlan_set_bssid(priv->dev, NullBssid);
eth_zero_addr(wilc_connected_SSID);
 
-   /*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->p2p_connect)
-   u8WLANChannel = INVALID_CHANNEL;
+   wlan_channel = 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 == wl->vif[1].ndev)) {
@@ -1029,7 +1025,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
curr_channel = pstrNetworkInfo->u8channel;
 
if (!pstrWFIDrv->p2p_connect)
-   u8WLANChannel = pstrNetworkInfo->u8channel;
+   wlan_channel = pstrNetworkInfo->u8channel;
 
wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
 
@@ -1069,10 +1065,9 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
wilc_connecting = 0;
priv = wiphy_priv(wiphy);
 
-   /*Invalidate u8WLANChannel value on wlan0 disconnect*/
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!pstrWFIDrv->p2p_connect)
-   u8WLANChannel = INVALID_CHANNEL;
+   wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid);
 
PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", 
reason_code);
@@ -1855,15 +1850,14 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
op_channel_attr_index = index;
index += buf[index + 1] + 3; /* ID,Length byte */
}
-   if (u8WLANChannel != INVALID_CHANNEL) {
-
+   if (wlan_channel != INVALID_CHANNEL) {
/*Modify channel list attribute*/
if (channel_list_attr_index) {
PRINT_D(GENERIC_DBG, "Modify channel list attribute\n");
for (i = channel_list_attr_index + 3; i < 
((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
if (buf[i] == 0x51) {
for (j = i + 2; j < ((i + 2) + buf[i + 
1]); j++) {
-   buf[j] = u8WLANChannel;
+   buf[j] = wlan_channel;
}
break;
}
@@ -1873,7 +1867,7 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
if (op_channel_attr_index) {
PRINT_D(GENERIC_DBG, "Modify operating channel 
attribute\n");
buf[op_channel_attr_index + 6] = 0x51;
-   buf[op_channel_attr_index + 7] = u8WLANChannel;
+   buf[op_channel_attr_index + 7] = wlan_channel;
}
}
 }
@@ -1909,15 +1903,14 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, 
bool bOperChan, u8 iftyp
op_channel_attr_index = index;
index += buf[index + 1] + 3; /* ID,Length byte */
}
-   if (u8WLANChannel != INVALID_CHAN

[PATCH 04/26] staging: wilc1000: rename WILC_WFI_rates variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames WILC_WFI_rates variable to ieee80211_bitrates
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 349b720..c2e7bf8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -149,7 +149,7 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = 
{
 
 
 /* Table 6 in section 3.2.1.1 */
-static struct ieee80211_rate WILC_WFI_rates[] = {
+static struct ieee80211_rate ieee80211_bitrates[] = {
RATETAB_ENT(10,  0,  0),
RATETAB_ENT(20,  1,  0),
RATETAB_ENT(55,  2,  0),
@@ -183,8 +183,8 @@ static bool bWilc_ie;
 static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
.channels = ieee80211_2ghz_channels,
.n_channels = ARRAY_SIZE(ieee80211_2ghz_channels),
-   .bitrates = WILC_WFI_rates,
-   .n_bitrates = ARRAY_SIZE(WILC_WFI_rates),
+   .bitrates = ieee80211_bitrates,
+   .n_bitrates = ARRAY_SIZE(ieee80211_bitrates),
 };
 
 
-- 
1.9.1

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


[PATCH 06/26] staging: wilc1000: rename u8P2P_oui variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u8P2P_oui variable to p2p_oui to avoid camelcase.
And, remove the relation comment.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3b072ef..6ab4a79 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -171,8 +171,7 @@ struct p2p_mgmt_data {
 
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
-
-static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
+static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 static u8 u8P2Plocalrandom = 0x01;
 static u8 u8P2Precvrandom = 0x00;
 static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
@@ -1997,9 +1996,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
break;
 
case PUBLIC_ACT_VENDORSPEC:
-   /*Now we have a public action vendor 
specific action frame, check if its a p2p public action frame
-* based on the standard its should 
have the p2p_oui attribute with the following values 50 6f 9A 09*/
-   if (!memcmp(u8P2P_oui, 
&buff[ACTION_SUBTYPE_ID + 1], 4)) {
+   if (!memcmp(p2p_oui, 
&buff[ACTION_SUBTYPE_ID + 1], 4)) {
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
if (!bWilc_ie) {
for (i = 
P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
@@ -2016,7 +2013,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP
  || 
buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
P2P_INV_RSP)) {
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
-   if 
(buff[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buff[i + 2], 4))) {
+   if 
(buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buff[i + 2], 4))) {

WILC_WFI_CfgParseRxAction(&buff[i + 6], size - (i + 6));

break;
}
@@ -2292,9 +2289,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 
case PUBLIC_ACT_VENDORSPEC:
{
-   /*Now we have a public action vendor 
specific action frame, check if its a p2p public action frame
-* based on the standard its should 
have the p2p_oui attribute with the following values 50 6f 9A 09*/
-   if (!memcmp(u8P2P_oui, 
&buf[ACTION_SUBTYPE_ID + 1], 4)) {
+   if (!memcmp(p2p_oui, 
&buf[ACTION_SUBTYPE_ID + 1], 4)) {
/*For the connection of two 
WILC's connection generate a rand number to determine who will be a GO*/
if 
((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
if (u8P2Plocalrandom == 
1 && u8P2Precvrandom < u8P2Plocalrandom) {
@@ -2311,7 +2306,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 
/*Search for 
the p2p information information element , after the Public action subtype 
theres a byte for teh dialog token, skip that*/
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) {
-   if 
(buf[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buf[i + 2], 4))) {
+   if 
(buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) {


[PATCH 02/26] staging: wilc1000: rename astrLastScannedNtwrksShadow variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames astrLastScannedNtwrksShadow variable to last_scanned_shadow
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 124 ++
 1 file changed, 58 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 97848e4..32cc734 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -106,7 +106,7 @@ static const struct ieee80211_txrx_stypes
 extern int wilc_mac_open(struct net_device *ndev);
 extern int wilc_mac_close(struct net_device *ndev);
 
-static tstrNetworkInfo 
astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
+static tstrNetworkInfo last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
 static struct timer_list hAgingTimer;
@@ -214,13 +214,13 @@ static void clear_shadow_scan(void *pUserVoid)
PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n");
 
for (i = 0; i < last_scanned_cnt; i++) {
-   if 
(astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs != NULL) {
-   kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
-   
astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs = NULL;
+   if (last_scanned_shadow[last_scanned_cnt].pu8IEs) {
+   kfree(last_scanned_shadow[i].pu8IEs);
+   last_scanned_shadow[last_scanned_cnt].pu8IEs = 
NULL;
}
 
-   
wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
-   astrLastScannedNtwrksShadow[i].pJoinParams = NULL;
+   
wilc_free_join_params(last_scanned_shadow[i].pJoinParams);
+   last_scanned_shadow[i].pJoinParams = NULL;
}
last_scanned_cnt = 0;
}
@@ -254,8 +254,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool 
bDirectScan)
for (i = 0; i < last_scanned_cnt; i++) {
tstrNetworkInfo *pstrNetworkInfo;
 
-   pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]);
-
+   pstrNetworkInfo = &last_scanned_shadow[i];
 
if ((!pstrNetworkInfo->u8Found) || all) {
s32 s32Freq;
@@ -285,7 +284,7 @@ static void reset_shadow_found(void *pUserVoid)
int i;
 
for (i = 0; i < last_scanned_cnt; i++)
-   astrLastScannedNtwrksShadow[i].u8Found = 0;
+   last_scanned_shadow[i].u8Found = 0;
 }
 
 static void update_scan_time(void *pUserVoid)
@@ -293,7 +292,7 @@ static void update_scan_time(void *pUserVoid)
int i;
 
for (i = 0; i < last_scanned_cnt; i++)
-   astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies;
+   last_scanned_shadow[i].u32TimeRcvdInScan = jiffies;
 }
 
 static void remove_network_from_shadow(unsigned long arg)
@@ -303,16 +302,16 @@ static void remove_network_from_shadow(unsigned long arg)
 
 
for (i = 0; i < last_scanned_cnt; i++) {
-   if (time_after(now, 
astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned 
long)(SCAN_RESULT_EXPIRE))) {
-   PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: 
%s\n", astrLastScannedNtwrksShadow[i].au8ssid);
+   if (time_after(now, last_scanned_shadow[i].u32TimeRcvdInScan + 
(unsigned long)(SCAN_RESULT_EXPIRE))) {
+   PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: 
%s\n", last_scanned_shadow[i].au8ssid);
 
-   kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
-   astrLastScannedNtwrksShadow[i].pu8IEs = NULL;
+   kfree(last_scanned_shadow[i].pu8IEs);
+   last_scanned_shadow[i].pu8IEs = NULL;
 
-   
wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
+   
wilc_free_join_params(last_scanned_shadow[i].pJoinParams);
 
for (j = i; (j < last_scanned_cnt - 1); j++)
-   astrLastScannedNtwrksShadow[j] = 
astrLastScannedNtwrksShadow[j + 1];
+   last_scanned_shadow[j] = last_scanned_shadow[j 
+ 1];
 
last_scanned_cnt--;
}
@@ -347,8 +346,8 @@ static int is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo, void *pUserVoi
} else {
/* Linear search for now */
for (i = 0; i < last_scanned_cnt; i++) {
-   if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid,
-   pstrNetworkInfo->au8bssid, 6) == 0) {
+

[PATCH 03/26] staging: wilc1000: rename WILC_WFI_2ghz_channels variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames WILC_WFI_2ghz_channels variable to ieee80211_2ghz_channels
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 32cc734..349b720 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -124,7 +124,7 @@ u8 wilc_initialized = 1;
 }
 
 /*Frequency range for channels*/
-static struct ieee80211_channel WILC_WFI_2ghz_channels[] = {
+static struct ieee80211_channel ieee80211_2ghz_channels[] = {
CHAN2G(1,  2412, 0),
CHAN2G(2,  2417, 0),
CHAN2G(3,  2422, 0),
@@ -181,8 +181,8 @@ static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 
0x40, 0x03};
 static bool bWilc_ie;
 
 static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
-   .channels = WILC_WFI_2ghz_channels,
-   .n_channels = ARRAY_SIZE(WILC_WFI_2ghz_channels),
+   .channels = ieee80211_2ghz_channels,
+   .n_channels = ARRAY_SIZE(ieee80211_2ghz_channels),
.bitrates = WILC_WFI_rates,
.n_bitrates = ARRAY_SIZE(WILC_WFI_rates),
 };
-- 
1.9.1

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


[PATCH 07/26] staging: wilc1000: rename u8P2Plocalrandom variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u8P2Plocalrandom variable to p2p_local_random
to avoid camelcase.
And, remove the relation comment.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 ---
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6ab4a79..dd8d404 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -172,7 +172,7 @@ struct p2p_mgmt_data {
 static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-static u8 u8P2Plocalrandom = 0x01;
+static u8 p2p_local_random = 0x01;
 static u8 u8P2Precvrandom = 0x00;
 static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
 static bool bWilc_ie;
@@ -641,7 +641,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
wilc_optaining_ip = false;
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason 
%d on dev [%p]\n",
 pstrDisconnectNotifInfo->u16reason, priv->dev);
-   u8P2Plocalrandom = 0x01;
+   p2p_local_random = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
eth_zero_addr(priv->au8AssociatedBss);
@@ -1071,7 +1071,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
 
PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", 
reason_code);
 
-   u8P2Plocalrandom = 0x01;
+   p2p_local_random = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;
@@ -2009,7 +2009,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
}
}
}
-   if (u8P2Plocalrandom > 
u8P2Precvrandom) {
+   if (p2p_local_random > 
u8P2Precvrandom) {
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP
  || 
buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
P2P_INV_RSP)) {
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
@@ -2019,8 +2019,9 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
}
}
}
-   } else
-   PRINT_D(GENERIC_DBG, 
"PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", u8P2Plocalrandom, 
u8P2Precvrandom);
+   } else {
+   PRINT_D(GENERIC_DBG, 
"PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, 
u8P2Precvrandom);
+   }
}
 
 
@@ -2224,7 +2225,7 @@ static int mgmt_tx(struct wiphy *wiphy,
struct host_if_drv *pstrWFIDrv;
u32 i;
perInterface_wlan_t *nic;
-   u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(u8P2Plocalrandom);
+   u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(p2p_local_random);
 
nic = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
@@ -2292,17 +2293,16 @@ static int mgmt_tx(struct wiphy *wiphy,
if (!memcmp(p2p_oui, 
&buf[ACTION_SUBTYPE_ID + 1], 4)) {
/*For the connection of two 
WILC's connection generate a rand number to determine who will be a GO*/
if 
((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
-   if (u8P2Plocalrandom == 
1 && u8P2Precvrandom < u8P2Plocalrandom) {
-   
get_random_bytes(&u8P2Plocalrandom, 1);
-   /*Increment the 
number to prevent if its 0*/
-   
u8P2Plocalrandom++;
+   if (p2p_local_random == 
1 && u8P2Precvrandom < p2

[PATCH 01/26] staging: wilc1000: rename u32LastScannedNtwrksCountShadow variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u32LastScannedNtwrksCountShadow variable to last_scanned_cnt
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 50 +++
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index cc279c6..97848e4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -107,7 +107,7 @@ extern int wilc_mac_open(struct net_device *ndev);
 extern int wilc_mac_close(struct net_device *ndev);
 
 static tstrNetworkInfo 
astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
-static u32 u32LastScannedNtwrksCountShadow;
+static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
 static struct timer_list hAgingTimer;
 static u8 op_ifcs;
@@ -213,16 +213,16 @@ static void clear_shadow_scan(void *pUserVoid)
del_timer_sync(&hAgingTimer);
PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n");
 
-   for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
-   if 
(astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs != NULL) {
+   for (i = 0; i < last_scanned_cnt; i++) {
+   if 
(astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs != NULL) {
kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
-   
astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL;
+   
astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs = NULL;
}
 

wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
astrLastScannedNtwrksShadow[i].pJoinParams = NULL;
}
-   u32LastScannedNtwrksCountShadow = 0;
+   last_scanned_cnt = 0;
}
 
 }
@@ -251,7 +251,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool 
bDirectScan)
priv = (struct wilc_priv *)pUserVoid;
wiphy = priv->dev->ieee80211_ptr->wiphy;
 
-   for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
+   for (i = 0; i < last_scanned_cnt; i++) {
tstrNetworkInfo *pstrNetworkInfo;
 
pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]);
@@ -284,19 +284,16 @@ static void reset_shadow_found(void *pUserVoid)
 {
int i;
 
-   for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
+   for (i = 0; i < last_scanned_cnt; i++)
astrLastScannedNtwrksShadow[i].u8Found = 0;
-
-   }
 }
 
 static void update_scan_time(void *pUserVoid)
 {
int i;
 
-   for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
+   for (i = 0; i < last_scanned_cnt; i++)
astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies;
-   }
 }
 
 static void remove_network_from_shadow(unsigned long arg)
@@ -305,7 +302,7 @@ static void remove_network_from_shadow(unsigned long arg)
int i, j;
 
 
-   for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
+   for (i = 0; i < last_scanned_cnt; i++) {
if (time_after(now, 
astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned 
long)(SCAN_RESULT_EXPIRE))) {
PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: 
%s\n", astrLastScannedNtwrksShadow[i].au8ssid);
 
@@ -314,15 +311,16 @@ static void remove_network_from_shadow(unsigned long arg)
 

wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
 
-   for (j = i; (j < u32LastScannedNtwrksCountShadow - 1); 
j++) {
+   for (j = i; (j < last_scanned_cnt - 1); j++)
astrLastScannedNtwrksShadow[j] = 
astrLastScannedNtwrksShadow[j + 1];
-   }
-   u32LastScannedNtwrksCountShadow--;
+
+   last_scanned_cnt--;
}
}
 
-   PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", 
u32LastScannedNtwrksCountShadow);
-   if (u32LastScannedNtwrksCountShadow != 0) {
+   PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n",
+   last_scanned_cnt);
+   if (last_scanned_cnt != 0) {
hAgingTimer.data = arg;
mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
} else {
@@ -341,14 +339,14 @@ static int is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo, void *pUserVoi
int state = -1;
int i;
 
-   if (u32LastScannedNtwrksCountShadow == 0) {
+   if (last_scanned_cnt == 0) {
PRINT_D(CFG80211_DBG, "Starting Aging timer\n");
 

[PATCH 09/26] staging: wilc1000: rename u8P2P_vendorspec variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u8P2P_vendorspec variable to p2p_vendor_spec
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 904b214..0a7226c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -174,7 +174,7 @@ static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 static u8 p2p_local_random = 0x01;
 static u8 p2p_recv_random = 0x00;
-static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
+static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
 static bool bWilc_ie;
 
 static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
@@ -2000,7 +2000,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
if (!bWilc_ie) {
for (i = 
P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
-   if 
(!memcmp(u8P2P_vendorspec, &buff[i], 6)) {
+   if 
(!memcmp(p2p_vendor_spec, &buff[i], 6)) {

p2p_recv_random = buff[i + 6];

bWilc_ie = true;

PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random);
@@ -2225,7 +2225,7 @@ static int mgmt_tx(struct wiphy *wiphy,
struct host_if_drv *pstrWFIDrv;
u32 i;
perInterface_wlan_t *nic;
-   u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(p2p_local_random);
+   u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random);
 
nic = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
@@ -2323,8 +2323,8 @@ static int mgmt_tx(struct wiphy *wiphy,
 * 
Adding WILC information element to allow two WILC devices to
 * 
identify each other and connect
 */
-   
memcpy(&mgmt_tx->buff[len], u8P2P_vendorspec, sizeof(u8P2P_vendorspec));
-   
mgmt_tx->buff[len + sizeof(u8P2P_vendorspec)] = p2p_local_random;
+   
memcpy(&mgmt_tx->buff[len], p2p_vendor_spec, sizeof(p2p_vendor_spec));
+   
mgmt_tx->buff[len + sizeof(p2p_vendor_spec)] = p2p_local_random;

mgmt_tx->size = buf_len;
}
} else {
-- 
1.9.1

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


[PATCH 08/26] staging: wilc1000: rename u8P2Precvrandom variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames u8P2Precvrandom variable to p2p_recv_random
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index dd8d404..904b214 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -173,7 +173,7 @@ static u8 wlan_channel = INVALID_CHANNEL;
 static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 static u8 p2p_local_random = 0x01;
-static u8 u8P2Precvrandom = 0x00;
+static u8 p2p_recv_random = 0x00;
 static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
 static bool bWilc_ie;
 
@@ -642,7 +642,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason 
%d on dev [%p]\n",
 pstrDisconnectNotifInfo->u16reason, priv->dev);
p2p_local_random = 0x01;
-   u8P2Precvrandom = 0x00;
+   p2p_recv_random = 0x00;
bWilc_ie = false;
eth_zero_addr(priv->au8AssociatedBss);
wilc_wlan_set_bssid(priv->dev, NullBssid);
@@ -1072,7 +1072,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", 
reason_code);
 
p2p_local_random = 0x01;
-   u8P2Precvrandom = 0x00;
+   p2p_recv_random = 0x00;
bWilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;
 
@@ -2001,15 +2001,15 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
if (!bWilc_ie) {
for (i = 
P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if 
(!memcmp(u8P2P_vendorspec, &buff[i], 6)) {
-   
u8P2Precvrandom = buff[i + 6];
+   
p2p_recv_random = buff[i + 6];

bWilc_ie = true;
-   
PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", u8P2Precvrandom);
+   
PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random);

break;
}
}
}
}
-   if (p2p_local_random > 
u8P2Precvrandom) {
+   if (p2p_local_random > 
p2p_recv_random) {
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP
  || 
buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
P2P_INV_RSP)) {
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
@@ -2020,7 +2020,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
}
}
} else {
-   PRINT_D(GENERIC_DBG, 
"PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, 
u8P2Precvrandom);
+   PRINT_D(GENERIC_DBG, 
"PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, 
p2p_recv_random);
}
}
 
@@ -2293,7 +2293,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (!memcmp(p2p_oui, 
&buf[ACTION_SUBTYPE_ID + 1], 4)) {
/*For the connection of two 
WILC's connection generate a rand number to determine who will be a GO*/
if 
((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
-

[PATCH 12/26] staging: wilc1000: rename wilc_connected_SSID variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames wilc_connected_SSID variable to wilc_connected_ssid
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 22 +++---
 drivers/staging/wilc1000/host_interface.h |  2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e366366..aae5a03 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -987,7 +987,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
return result;
 }
 
-u8 wilc_connected_SSID[6] = {0};
+u8 wilc_connected_ssid[6] = {0};
 static s32 Handle_Connect(struct host_if_drv *hif_drv,
  struct connect_attr *pstrHostIFconnectAttr)
 {
@@ -999,7 +999,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
 
PRINT_D(GENERIC_DBG, "Handling connect request\n");
 
-   if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_SSID, ETH_ALEN) 
== 0) {
+   if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) 
== 0) {
result = 0;
PRINT_ER("Trying to connect to an already connected AP, Discard 
connect request\n");
return result;
@@ -1212,10 +1212,11 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
 
if (pstrHostIFconnectAttr->bssid) {
-   memcpy(wilc_connected_SSID, pstrHostIFconnectAttr->bssid, 
ETH_ALEN);
-
-   PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", 
pstrHostIFconnectAttr->bssid);
-   PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_SSID);
+   memcpy(wilc_connected_ssid,
+  pstrHostIFconnectAttr->bssid, ETH_ALEN);
+   PRINT_D(GENERIC_DBG, "save Bssid = %pM\n",
+   pstrHostIFconnectAttr->bssid);
+   PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_ssid);
}
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
@@ -1389,7 +1390,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv 
*hif_drv)
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
 
-   eth_zero_addr(wilc_connected_SSID);
+   eth_zero_addr(wilc_connected_ssid);
 
if (join_req && join_req_drv == hif_drv) {
kfree(join_req);
@@ -1585,11 +1586,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus != 
SUCCESSFUL_STATUSCODE)) {
PRINT_ER("Received MAC status is MAC_CONNECTED 
while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
-   eth_zero_addr(wilc_connected_SSID);
-
+   eth_zero_addr(wilc_connected_ssid);
} else if (u8MacStatus == MAC_DISCONNECTED){
PRINT_ER("Received MAC status is 
MAC_DISCONNECTED\n");
-   eth_zero_addr(wilc_connected_SSID);
+   eth_zero_addr(wilc_connected_ssid);
}
 
if (hif_drv->usr_conn_req.pu8bssid) {
@@ -2007,7 +2007,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
wilc_optaining_ip = false;
wilc_set_power_mgmt(hif_drv, 0, 0);
 
-   eth_zero_addr(wilc_connected_SSID);
+   eth_zero_addr(wilc_connected_ssid);
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 004467c6..4f5300d 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -398,7 +398,7 @@ s32 wilc_get_statistics(struct host_if_drv *hWFIDrv,
 void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv);
 
 extern bool wilc_optaining_ip;
-extern u8 wilc_connected_SSID[6];
+extern u8 wilc_connected_ssid[6];
 extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 
 extern int wilc_connecting;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c49b989..718b060 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -588,7 +588,7 @@ static void CfgConnectResult(enum conn_event 
enu

[PATCH 13/26] staging: wilc1000: clear_shadow_scan: remove unused argument

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch removes pUserVoid that is first argument of
clear_shadow_scan function because it is not used in this function.
Remove argument in the function call also.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 718b060..e72608b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -202,7 +202,7 @@ static bool g_wep_keys_saved;
 #define AGING_TIME (9 * 1000)
 #define during_ip_time 15000
 
-static void clear_shadow_scan(void *pUserVoid)
+static void clear_shadow_scan(void)
 {
int i;
 
@@ -3523,7 +3523,7 @@ int wilc_deinit_host_int(struct net_device *net)
s32Error = wilc_deinit(priv->hWILCWFIDrv);
 
/* Clear the Shadow scan */
-   clear_shadow_scan(priv);
+   clear_shadow_scan();
if (op_ifcs == 0) {
PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
del_timer_sync(&wilc_during_ip_timer);
-- 
1.9.1

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


[PATCH 11/26] staging: wilc1000: rename duringIP_TIME variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames duringIP_TIME variable to during_ip_time
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 24e1e15..c49b989 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -200,7 +200,7 @@ static bool g_gtk_keys_saved;
 static bool g_wep_keys_saved;
 
 #define AGING_TIME (9 * 1000)
-#define duringIP_TIME 15000
+#define during_ip_time 15000
 
 static void clear_shadow_scan(void *pUserVoid)
 {
@@ -2772,7 +2772,8 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(GENERIC_DBG, "start duringIP timer\n");
 
wilc_optaining_ip = true;
-   mod_timer(&wilc_during_ip_timer, jiffies + 
msecs_to_jiffies(duringIP_TIME));
+   mod_timer(&wilc_during_ip_timer,
+ jiffies + msecs_to_jiffies(during_ip_time));
wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
/*Delete block ack has to be the latest config packet*/
/*sent before downloading new FW. This is because it blocks on*/
-- 
1.9.1

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


[PATCH 15/26] staging: wilc1000: rename bDirectScan in refresh_scan function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames bDirectScan to direct_scan that is
third argument of refresh_scan function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e987e78..6f79662 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -237,7 +237,7 @@ static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
return rssi_v;
 }
 
-static void refresh_scan(void *user_void, u8 all, bool bDirectScan)
+static void refresh_scan(void *user_void, u8 all, bool direct_scan)
 {
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -263,7 +263,8 @@ static void refresh_scan(void *user_void, u8 all, bool 
bDirectScan)
channel = ieee80211_get_channel(wiphy, s32Freq);
 
rssi = get_rssi_avg(pstrNetworkInfo);
-   if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 
7) || bDirectScan)  {
+   if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 
7) ||
+   direct_scan) {
bss = cfg80211_inform_bss(wiphy, 
channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, 
pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
  
pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
  
(size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL);
-- 
1.9.1

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


[PATCH 17/26] staging: wilc1000: rename s32Freq variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames s32Freq variable to freq to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 9416644..55cf444 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -254,12 +254,12 @@ static void refresh_scan(void *user_void, u8 all, bool 
direct_scan)
network_info = &last_scanned_shadow[i];
 
if (!network_info->u8Found || all) {
-   s32 s32Freq;
+   s32 freq;
struct ieee80211_channel *channel;
 
if (network_info) {
-   s32Freq = 
ieee80211_channel_to_frequency((s32)network_info->u8channel, 
IEEE80211_BAND_2GHZ);
-   channel = ieee80211_get_channel(wiphy, s32Freq);
+   freq = 
ieee80211_channel_to_frequency((s32)network_info->u8channel, 
IEEE80211_BAND_2GHZ);
+   channel = ieee80211_get_channel(wiphy, freq);
 
rssi = get_rssi_avg(network_info);
if (memcmp("DIRECT-", network_info->au8ssid, 7) 
||
-- 
1.9.1

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


[PATCH 16/26] staging: wilc1000: rename pstrNetworkInfo variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pstrNetworkInfo variable to network_info
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6f79662..9416644 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -249,25 +249,24 @@ static void refresh_scan(void *user_void, u8 all, bool 
direct_scan)
wiphy = priv->dev->ieee80211_ptr->wiphy;
 
for (i = 0; i < last_scanned_cnt; i++) {
-   tstrNetworkInfo *pstrNetworkInfo;
+   tstrNetworkInfo *network_info;
 
-   pstrNetworkInfo = &last_scanned_shadow[i];
+   network_info = &last_scanned_shadow[i];
 
-   if ((!pstrNetworkInfo->u8Found) || all) {
+   if (!network_info->u8Found || all) {
s32 s32Freq;
struct ieee80211_channel *channel;
 
-   if (pstrNetworkInfo != NULL) {
-
-   s32Freq = 
ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, 
IEEE80211_BAND_2GHZ);
+   if (network_info) {
+   s32Freq = 
ieee80211_channel_to_frequency((s32)network_info->u8channel, 
IEEE80211_BAND_2GHZ);
channel = ieee80211_get_channel(wiphy, s32Freq);
 
-   rssi = get_rssi_avg(pstrNetworkInfo);
-   if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 
7) ||
+   rssi = get_rssi_avg(network_info);
+   if (memcmp("DIRECT-", network_info->au8ssid, 7) 
||
direct_scan) {
-   bss = cfg80211_inform_bss(wiphy, 
channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, 
pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
- 
pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
- 
(size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL);
+   bss = cfg80211_inform_bss(wiphy, 
channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, 
network_info->u64Tsf, network_info->u16CapInfo,
+ 
network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs,
+ 
(size_t)network_info->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL);
cfg80211_put_bss(wiphy, bss);
}
}
-- 
1.9.1

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


[PATCH 10/26] staging: wilc1000: rename bWilc_ie variable

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames bWilc_ie variable to wilc_ie to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0a7226c..24e1e15 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -175,7 +175,7 @@ static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 static u8 p2p_local_random = 0x01;
 static u8 p2p_recv_random = 0x00;
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-static bool bWilc_ie;
+static bool wilc_ie;
 
 static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
.channels = ieee80211_2ghz_channels,
@@ -643,7 +643,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
 pstrDisconnectNotifInfo->u16reason, priv->dev);
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
-   bWilc_ie = false;
+   wilc_ie = false;
eth_zero_addr(priv->au8AssociatedBss);
wilc_wlan_set_bssid(priv->dev, NullBssid);
eth_zero_addr(wilc_connected_SSID);
@@ -1073,7 +1073,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
 
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
-   bWilc_ie = false;
+   wilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;
 
s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code);
@@ -1998,11 +1998,11 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
case PUBLIC_ACT_VENDORSPEC:
if (!memcmp(p2p_oui, 
&buff[ACTION_SUBTYPE_ID + 1], 4)) {
if 
((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_RSP)) {
-   if (!bWilc_ie) {
+   if (!wilc_ie) {
for (i = 
P2P_PUB_ACTION_SUBTYPE; i < size; i++) {
if 
(!memcmp(p2p_vendor_spec, &buff[i], 6)) {

p2p_recv_random = buff[i + 6];
-   
bWilc_ie = true;
+   
wilc_ie = true;

PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random);

break;
}
@@ -2025,7 +2025,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
}
 
 
-   if ((buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (bWilc_ie))   {
+   if ((buff[P2P_PUB_ACTION_SUBTYPE] == 
GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)){
PRINT_D(GENERIC_DBG, "Sending 
P2P to host without extra elemnt\n");
/* extra attribute for sig_dbm: 
signal strength in mBm, or 0 if unknown */
cfg80211_rx_mgmt(priv->wdev, 
s32Freq, 0, buff, size - 7, 0);
@@ -2560,9 +2560,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name);
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
-
-   bWilc_ie = false;
-
+   wilc_ie = false;
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
-- 
1.9.1

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


[PATCH 18/26] staging: wilc1000: reset_shadow_found: remove unused argument

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch removes pUserVoid that is first argument of
reset_shadow_found function because it is not used in this function.
Remove argument in the function call also.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 55cf444..5032705 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -276,7 +276,7 @@ static void refresh_scan(void *user_void, u8 all, bool 
direct_scan)
 
 }
 
-static void reset_shadow_found(void *pUserVoid)
+static void reset_shadow_found(void)
 {
int i;
 
@@ -731,9 +731,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
priv->u32RcvdChCount = 0;
 
wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
-
-
-   reset_shadow_found(priv);
+   reset_shadow_found();
 
priv->bCfgScanning = true;
if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { /* TODO: 
mostafa: to be replaced by */
-- 
1.9.1

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


[PATCH 19/26] staging: wilc1000: update_scan_time: remove unused argument

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch removes pUserVoid that is first argument of
update_scan_time function because it is not used in this function.
Remove argument in the function call also.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 5032705..56005f6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -284,7 +284,7 @@ static void reset_shadow_found(void)
last_scanned_shadow[i].u8Found = 0;
 }
 
-static void update_scan_time(void *pUserVoid)
+static void update_scan_time(void)
 {
int i;
 
@@ -523,8 +523,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, 
tstrNetworkInfo *pstrNet
 
PRINT_D(CFG80211_DBG, "Scan Aborted\n");
if (priv->pstrScanReq != NULL) {
-
-   update_scan_time(priv);
+   update_scan_time();
refresh_scan(priv, 1, false);
 
cfg80211_scan_done(priv->pstrScanReq, false);
-- 
1.9.1

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


[PATCH 14/26] staging: wilc1000: rename pUserVoid in refresh_scan function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pUserVoid to user_void that is
first argument of refresh_scan function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 e72608b..e987e78 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -237,7 +237,7 @@ static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
return rssi_v;
 }
 
-static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
+static void refresh_scan(void *user_void, u8 all, bool bDirectScan)
 {
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -245,7 +245,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool 
bDirectScan)
int i;
int rssi = 0;
 
-   priv = (struct wilc_priv *)pUserVoid;
+   priv = (struct wilc_priv *)user_void;
wiphy = priv->dev->ieee80211_ptr->wiphy;
 
for (i = 0; i < last_scanned_cnt; i++) {
-- 
1.9.1

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


[PATCH 21/26] staging: wilc1000: rename pUserVoid in add_network_to_shadow function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pUserVoid to user_void that is
second argument of add_network_to_shadow function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 5a9d0e2..7905f37 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -354,9 +354,10 @@ static int is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
return state;
 }
 
-static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void 
*pUserVoid, void *pJoinParams)
+static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo,
+ void *user_void, void *pJoinParams)
 {
-   int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
+   int ap_found = is_network_in_shadow(pstrNetworkInfo, user_void);
u32 ap_index = 0;
u8 rssi_index = 0;
 
-- 
1.9.1

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


[PATCH 24/26] staging: wilc1000: rename pUserVoid in CfgScanResult function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pUserVoid to user_void that is
third argument of CfgScanResult function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 b0d1ed3..0b03e54 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -421,7 +421,7 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
  */
 static void CfgScanResult(enum scan_event scan_event,
  tstrNetworkInfo *network_info,
- void *pUserVoid,
+ void *user_void,
  void *pJoinParams)
 {
struct wilc_priv *priv;
@@ -430,7 +430,7 @@ static void CfgScanResult(enum scan_event scan_event,
struct ieee80211_channel *channel;
struct cfg80211_bss *bss = NULL;
 
-   priv = (struct wilc_priv *)pUserVoid;
+   priv = (struct wilc_priv *)user_void;
if (priv->bCfgScanning) {
if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
wiphy = priv->dev->ieee80211_ptr->wiphy;
-- 
1.9.1

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


[PATCH 23/26] staging: wilc1000: rename pstrNetworkInfo in CfgScanResult function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pstrNetworkInfo to network_info that is
second argument of CfgScanResult function to avoid camelcase.
And, remove the relation comment.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 41 ++-
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 646beff..b0d1ed3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -420,7 +420,7 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
  *  @version   1.0
  */
 static void CfgScanResult(enum scan_event scan_event,
- tstrNetworkInfo *pstrNetworkInfo,
+ tstrNetworkInfo *network_info,
  void *pUserVoid,
  void *pJoinParams)
 {
@@ -438,33 +438,27 @@ static void CfgScanResult(enum scan_event scan_event,
if (!wiphy)
return;
 
-   if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC
-   &&
-   s32)pstrNetworkInfo->s8rssi) * 100) < 0
-||
-(((s32)pstrNetworkInfo->s8rssi) * 100) > 100)
-   ) {
+   if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
+   (((s32)network_info->s8rssi * 100) < 0 ||
+   ((s32)network_info->s8rssi * 100) > 100)) {
PRINT_ER("wiphy signal type fial\n");
return;
}
 
-   if (pstrNetworkInfo != NULL) {
-   s32Freq = 
ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, 
IEEE80211_BAND_2GHZ);
+   if (network_info) {
+   s32Freq = 
ieee80211_channel_to_frequency((s32)network_info->u8channel, 
IEEE80211_BAND_2GHZ);
channel = ieee80211_get_channel(wiphy, s32Freq);
 
if (!channel)
return;
 
PRINT_INFO(CFG80211_DBG, "Network Info:: 
CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d,"
-  "BeaconPeriod: %d\n", 
channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100),
-  pstrNetworkInfo->u16CapInfo, 
pstrNetworkInfo->u16BeaconPeriod);
+  "BeaconPeriod: %d\n", 
channel->center_freq, (((s32)network_info->s8rssi) * 100),
+  network_info->u16CapInfo, 
network_info->u16BeaconPeriod);
 
-   if (pstrNetworkInfo->bNewNetwork) {
+   if (network_info->bNewNetwork) {
if (priv->u32RcvdChCount < 
MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */
-   /*   max_scan_ssids 
*/
-   PRINT_D(CFG80211_DBG, "Network 
%s found\n", pstrNetworkInfo->au8ssid);
-
-
+   PRINT_D(CFG80211_DBG, "Network 
%s found\n", network_info->au8ssid);
priv->u32RcvdChCount++;
 
 
@@ -472,14 +466,13 @@ static void CfgScanResult(enum scan_event scan_event,
if (pJoinParams == NULL) {

PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n");
}
-   
add_network_to_shadow(pstrNetworkInfo, priv, pJoinParams);
+   
add_network_to_shadow(network_info, priv, pJoinParams);
 
/*P2P peers are sent to WPA 
supplicant and added to shadow table*/
-
-   if (!(memcmp("DIRECT-", 
pstrNetworkInfo->au8ssid, 7))) {
-   bss = 
cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN,  
pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
-   
  pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
-   

[PATCH 26/26] staging: wilc1000: rename pstrNetworkInfo in get_rssi_avg function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pstrNetworkInfo to network_info that is
first argument of get_rssi_avg function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a429167..bcfddbf 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -224,14 +224,14 @@ static void clear_shadow_scan(void)
 
 }
 
-static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
+static u32 get_rssi_avg(tstrNetworkInfo *network_info)
 {
u8 i;
int rssi_v = 0;
-   u8 num_rssi = (pstrNetworkInfo->strRssi.u8Full) ? NUM_RSSI : 
(pstrNetworkInfo->strRssi.u8Index);
+   u8 num_rssi = (network_info->strRssi.u8Full) ? NUM_RSSI : 
(network_info->strRssi.u8Index);
 
for (i = 0; i < num_rssi; i++)
-   rssi_v += pstrNetworkInfo->strRssi.as8RSSI[i];
+   rssi_v += network_info->strRssi.as8RSSI[i];
 
rssi_v /= num_rssi;
return rssi_v;
-- 
1.9.1

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


[PATCH 22/26] staging: wilc1000: rename enuScanEvent in CfgScanResult function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames enuScanEvent to scan_event that is
first argument of CfgScanResult function to avoid camelcase.
And, remove the relation comment.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7905f37..646beff 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -419,7 +419,10 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
  *  @date
  *  @version   1.0
  */
-static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo 
*pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
+static void CfgScanResult(enum scan_event scan_event,
+ tstrNetworkInfo *pstrNetworkInfo,
+ void *pUserVoid,
+ void *pJoinParams)
 {
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -429,7 +432,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, 
tstrNetworkInfo *pstrNet
 
priv = (struct wilc_priv *)pUserVoid;
if (priv->bCfgScanning) {
-   if (enuScanEvent == SCAN_EVENT_NETWORK_FOUND) {
+   if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
wiphy = priv->dev->ieee80211_ptr->wiphy;
 
if (!wiphy)
@@ -498,7 +501,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, 
tstrNetworkInfo *pstrNet
}
}
}
-   } else if (enuScanEvent == SCAN_EVENT_DONE){
+   } else if (scan_event == SCAN_EVENT_DONE) {
PRINT_D(CFG80211_DBG, "Scan Done[%p]\n", priv->dev);
PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n");
refresh_scan(priv, 1, false);
@@ -517,10 +520,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, 
tstrNetworkInfo *pstrNet
priv->pstrScanReq = NULL;
}
up(&(priv->hSemScanReq));
-
-   }
-   /*Aborting any scan operation during mac close*/
-   else if (enuScanEvent == SCAN_EVENT_ABORTED) {
+   } else if (scan_event == SCAN_EVENT_ABORTED) {
down(&(priv->hSemScanReq));
 
PRINT_D(CFG80211_DBG, "Scan Aborted\n");
-- 
1.9.1

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


[PATCH 20/26] staging: wilc1000: rename pUserVoid in is_network_in_shadow function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pUserVoid to user_void that is
second argument of is_network_in_shadow function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 56005f6..5a9d0e2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -330,14 +330,15 @@ static void clear_duringIP(unsigned long arg)
wilc_optaining_ip = false;
 }
 
-static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void 
*pUserVoid)
+static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo,
+   void *user_void)
 {
int state = -1;
int i;
 
if (last_scanned_cnt == 0) {
PRINT_D(CFG80211_DBG, "Starting Aging timer\n");
-   hAgingTimer.data = (unsigned long)pUserVoid;
+   hAgingTimer.data = (unsigned long)user_void;
mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
state = -1;
} else {
-- 
1.9.1

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


[PATCH 25/26] staging: wilc1000: rename pJoinParams in CfgScanResult function

2015-11-18 Thread Glen Lee
From: Leo Kim 

This patch renames pJoinParams to join_params that is
fourth argument of CfgScanResult function to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0b03e54..a429167 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -422,7 +422,7 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
 static void CfgScanResult(enum scan_event scan_event,
  tstrNetworkInfo *network_info,
  void *user_void,
- void *pJoinParams)
+ void *join_params)
 {
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -461,12 +461,9 @@ static void CfgScanResult(enum scan_event scan_event,
PRINT_D(CFG80211_DBG, "Network 
%s found\n", network_info->au8ssid);
priv->u32RcvdChCount++;
 
-
-
-   if (pJoinParams == NULL) {
+   if (!join_params)

PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n");
-   }
-   
add_network_to_shadow(network_info, priv, pJoinParams);
+   
add_network_to_shadow(network_info, priv, join_params);
 
/*P2P peers are sent to WPA 
supplicant and added to shadow table*/
if (!(memcmp("DIRECT-", 
network_info->au8ssid, 7))) {
-- 
1.9.1

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


Re: [PATCH 3/4] staging: wilc1000: rename index to tcp_pending_ack_idx

2015-11-19 Thread glen lee



On 2015년 11월 20일 00:45, Greg KH wrote:

On Thu, Nov 19, 2015 at 03:53:34PM +0900, glen lee wrote:


On 2015년 11월 19일 15:23, Dan Carpenter wrote:

On Thu, Nov 19, 2015 at 11:06:00AM +0900, Glen Lee wrote:

This patch renames "index" of struct txq_entry_t to tcp_pending_ack_idx since
this name could be confused index of txq_entry_t. It is index of tcp pending
ack.

It fixes 8e55639d066f4ef402ba88fca08ed1be70e1c4da


It is just a cleanup patch and not a bugfix patch so "fix" is the wrong
word here.  But the correct format for fixes tags is:

Fixes: 123456789012 ('Title of patch')

I see, I learned another one. Thanks.

Git can do this automatically for you:
 git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n"


This is helpful for me. Thanks.

regards,
glen lee


I have an alias for this to make it easier to use frequently.

greg k-h


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


[PATCH 2/6] staging: wilc1000: return linux error value

2015-11-19 Thread Glen Lee
Return proper linux error value -ETIMEDOUT instead of -1.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 0cd2acc..329477a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -601,7 +601,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct 
wid *wids,
   wids[counter].id,
   (counter == count - 1),
   drv)) {
-   ret = -1;
+   ret = -ETIMEDOUT;
printk("[Sendconfigpkt]Get Timed out\n");
break;
}
@@ -622,7 +622,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct 
wid *wids,
   wids[counter].size,
   (counter == count - 1),
   drv)) {
-   ret = -1;
+   ret = -ETIMEDOUT;
printk("[Sendconfigpkt]Set Timed out\n");
break;
}
-- 
1.9.1

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


[PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t

2015-11-19 Thread Glen Lee
hif_func of wilc_wlan_dev_t is duplicate because we have same struct
wilc_hif_func ops of struct wilc which is available in wilc_wlan.c.
Rename ops of struct wilc with hif_func and remove hif_func of wilc_wlan_dev_t,
and use wilc->hif_func instead of g_wlan.hif_func in all functions.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c |  18 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 161 --
 3 files changed, 87 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 73954f4..7ccc9b0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -749,9 +749,9 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
if (!wl->dev_irq_num &&
-   wl->ops->disable_interrupt) {
+   wl->hif_func->disable_interrupt) {
mutex_lock(&wl->hif_cs);
-   wl->ops->disable_interrupt(wl);
+   wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs);
}
if (&wl->txq_event)
@@ -769,12 +769,12 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wilc_wlan_cleanup(dev);
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
if (!wl->dev_irq_num &&
-   wl->ops->disable_interrupt) {
+   wl->hif_func->disable_interrupt) {
 
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
mutex_lock(&wl->hif_cs);
-   wl->ops->disable_interrupt(wl);
+   wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs);
}
 #endif
@@ -910,8 +910,8 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
if (!wl->dev_irq_num &&
-   wl->ops->enable_interrupt &&
-   wl->ops->enable_interrupt(wl)) {
+   wl->hif_func->enable_interrupt &&
+   wl->hif_func->enable_interrupt(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
@@ -963,8 +963,8 @@ _fail_fw_start_:
 
 _fail_irq_enable_:
if (!wl->dev_irq_num &&
-   wl->ops->disable_interrupt)
-   wl->ops->disable_interrupt(wl);
+   wl->hif_func->disable_interrupt)
+   wl->hif_func->disable_interrupt(wl);
 _fail_irq_init_:
if (wl->dev_irq_num)
deinit_irq(dev);
@@ -1437,7 +1437,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
*wilc = wl;
wl->io_type = io_type;
wl->gpio = gpio;
-   wl->ops = ops;
+   wl->hif_func = ops;
 
register_inetaddr_notifier(&g_dev_notifier);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 212d607..b593b64 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,7 +156,7 @@ struct wilc_vif {
 };
 
 struct wilc {
-   const struct wilc_hif_func *ops;
+   const struct wilc_hif_func *hif_func;
int io_type;
int mac_status;
int gpio;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a74a95e..b9bedc8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -6,7 +6,6 @@
 typedef struct {
int quit;
int io_type;
-   struct wilc_hif_func hif_func;
int cfg_frame_in_use;
struct wilc_cfg_frame cfg_frame;
u32 cfg_frame_offset;
@@ -564,9 +563,9 @@ static inline void chip_allow_sleep(struct wilc *wilc)
 {
u32 reg = 0;
 
-   g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®);
+   wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
 
-   g_wlan.hif_func.hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
+   wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
 }
 
 static inline void chip_wakeup(struct wilc *wilc)
@@ -576,9 +575,9 @@ static inline void chip_wakeup(struct wilc *wilc)
 
if ((g_wlan.io_type & 0x1) == HIF_SPI) {
do {
-   g_wlan.hif_func.hif_read_reg(wilc, 1, ®);
-   g_wlan.hif_func.hif_write_reg(wil

[PATCH 5/6] staging: wilc1000: remove unused varialbe tx_buffer_offset

2015-11-19 Thread Glen Lee
This patch removes unused variable tx_buffer_offset of wilc_wlan_dev_t.

Signed-off-by: Glen Lee 
---
 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 37879cd..502b499 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -13,7 +13,6 @@ typedef struct {
u8 *rx_buffer;
u32 rx_buffer_offset;
u8 *tx_buffer;
-   u32 tx_buffer_offset;
 
unsigned long txq_spinlock_flags;
 
-- 
1.9.1

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


[PATCH 1/6] staging: wilc1000: remove unused variable

2015-11-19 Thread Glen Lee
wilc_sdio_func is not used anymore so just delete it.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 92633aa..ae31f7d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -11,8 +11,6 @@
 
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-static struct sdio_func *wilc_sdio_func;
-
 #define SDIO_VENDOR_ID_WILC 0x0296
 #define SDIO_DEVICE_ID_WILC 0x5347
 
@@ -105,7 +103,6 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
}
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
-   wilc_sdio_func = func;
if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
 &wilc_hif_sdio)) {
PRINT_ER("Couldn't initialize netdev\n");
-- 
1.9.1

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


[PATCH 4/6] staging: wilc1000: remove io_type of wilc_wlan_dev_t

2015-11-19 Thread Glen Lee
io_type of wilc_wlan_dev_t is unneeded, we can use io_type of struct wilc.
Remove io_type of wilc_wlan_dev_t and use io_type of wilc.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index b9bedc8..37879cd 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -5,7 +5,6 @@
 
 typedef struct {
int quit;
-   int io_type;
int cfg_frame_in_use;
struct wilc_cfg_frame cfg_frame;
u32 cfg_frame_offset;
@@ -573,7 +572,7 @@ static inline void chip_wakeup(struct wilc *wilc)
u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;
 
-   if ((g_wlan.io_type & 0x1) == HIF_SPI) {
+   if ((wilc->io_type & 0x1) == HIF_SPI) {
do {
wilc->hif_func->hif_read_reg(wilc, 1, ®);
wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
@@ -587,7 +586,7 @@ static inline void chip_wakeup(struct wilc *wilc)
} while ((wilc_get_chipid(wilc, true) == 0) && 
((++trials % 3) == 0));
 
} while (wilc_get_chipid(wilc, true) == 0);
-   } else if ((g_wlan.io_type & 0x1) == HIF_SDIO)   {
+   } else if ((wilc->io_type & 0x1) == HIF_SDIO){
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
@@ -636,12 +635,12 @@ static inline void chip_wakeup(struct wilc *wilc)
u32 reg, trials = 0;
 
do {
-   if ((g_wlan.io_type & 0x1) == HIF_SPI) {
+   if ((wilc->io_type & 0x1) == HIF_SPI) {
wilc->hif_func->hif_read_reg(wilc, 1, ®);
wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
wilc->hif_func->hif_write_reg(wilc, 1, reg  & ~BIT(1));
-   } else if ((g_wlan.io_type & 0x1) == HIF_SDIO)   {
+   } else if ((wilc->io_type & 0x1) == HIF_SDIO){
wilc->hif_func->hif_read_reg(wilc, 0xf0, ®);
wilc->hif_func->hif_write_reg(wilc, 0xf0,
  reg & ~BIT(0));
@@ -1061,7 +1060,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 
int_stats)
 
wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR);
 
-   if (g_wlan.io_type == HIF_SDIO)
+   if (wilc->io_type == HIF_SDIO)
mdelay(WILC_PLL_TO_SDIO);
else
mdelay(WILC_PLL_TO_SPI);
@@ -1225,15 +1224,14 @@ _fail_1:
 
 int wilc_wlan_start(struct wilc *wilc)
 {
-   wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0;
int ret;
u32 chipid;
 
-   if (p->io_type == HIF_SDIO) {
+   if (wilc->io_type == HIF_SDIO) {
reg = 0;
reg |= BIT(3);
-   } else if (p->io_type == HIF_SPI) {
+   } else if (wilc->io_type == HIF_SPI) {
reg = 1;
}
acquire_bus(wilc, ACQUIRE_ONLY);
@@ -1245,7 +1243,7 @@ int wilc_wlan_start(struct wilc *wilc)
return ret;
}
reg = 0;
-   if (p->io_type == HIF_SDIO && wilc->dev_irq_num)
+   if (wilc->io_type == HIF_SDIO && wilc->dev_irq_num)
reg |= WILC_HAVE_SDIO_IRQ_GPIO;
 
 #ifdef WILC_DISABLE_PMU
@@ -1627,7 +1625,6 @@ int wilc_wlan_init(struct net_device *dev)
PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
 
memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
-   g_wlan.io_type = wilc->io_type;
if (!wilc->hif_func->hif_init(wilc, wilc_debug)) {
ret = -EIO;
goto _fail_;
-- 
1.9.1

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


[PATCH 6/6] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc

2015-11-19 Thread Glen Lee
linux_wlan.c and wilc_wlan.c was separated into two part at the beginning
to support various platforms. They are in charge of send/receive control and
packet data, so they will be merged into one file wlan.c later.
First of all, wilc_wlan_dev_t which is used as global variable of wilc_wlan.c
will be moved into struct wilc.
This patch moves all members of wilc_wlan_dev_t to struct wilc and use wilc
instead of g_wlan. Finally remove wilc_wlan_dev_t and g_wlan.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  22 +++
 drivers/staging/wilc1000/wilc_wlan.c  | 271 +++---
 2 files changed, 139 insertions(+), 154 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index b593b64..68a159f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -181,6 +181,28 @@ struct wilc {
 
struct task_struct *txq_thread;
 
+   int quit;
+   int cfg_frame_in_use;
+   struct wilc_cfg_frame cfg_frame;
+   u32 cfg_frame_offset;
+   int cfg_seq_no;
+
+   u8 *rx_buffer;
+   u32 rx_buffer_offset;
+   u8 *tx_buffer;
+
+   unsigned long txq_spinlock_flags;
+
+   struct txq_entry_t *txq_head;
+   struct txq_entry_t *txq_tail;
+   int txq_entries;
+   int txq_exit;
+
+   struct rxq_entry_t *rxq_head;
+   struct rxq_entry_t *rxq_tail;
+   int rxq_entries;
+   int rxq_exit;
+
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
const struct firmware *firmware;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 502b499..0427349 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -3,32 +3,6 @@
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
-typedef struct {
-   int quit;
-   int cfg_frame_in_use;
-   struct wilc_cfg_frame cfg_frame;
-   u32 cfg_frame_offset;
-   int cfg_seq_no;
-
-   u8 *rx_buffer;
-   u32 rx_buffer_offset;
-   u8 *tx_buffer;
-
-   unsigned long txq_spinlock_flags;
-
-   struct txq_entry_t *txq_head;
-   struct txq_entry_t *txq_tail;
-   int txq_entries;
-   int txq_exit;
-
-   struct rxq_entry_t *rxq_head;
-   struct rxq_entry_t *rxq_tail;
-   int rxq_entries;
-   int rxq_exit;
-} wilc_wlan_dev_t;
-
-static wilc_wlan_dev_t g_wlan;
-
 #ifdef WILC_OPTIMIZE_SLEEP_INT
 static inline void chip_allow_sleep(struct wilc *wilc);
 #endif
@@ -76,21 +50,20 @@ static inline void release_bus(struct wilc *wilc, 
BUS_RELEASE_T release)
 #ifdef TCP_ACK_FILTER
 static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
-   wilc_wlan_dev_t *p = &g_wlan;
-
-   if (tqe == p->txq_head) {
-   p->txq_head = tqe->next;
-   if (p->txq_head)
-   p->txq_head->prev = NULL;
-   } else if (tqe == p->txq_tail)  {
-   p->txq_tail = (tqe->prev);
-   if (p->txq_tail)
-   p->txq_tail->next = NULL;
+
+   if (tqe == wilc->txq_head) {
+   wilc->txq_head = tqe->next;
+   if (wilc->txq_head)
+   wilc->txq_head->prev = NULL;
+   } else if (tqe == wilc->txq_tail) {
+   wilc->txq_tail = (tqe->prev);
+   if (wilc->txq_tail)
+   wilc->txq_tail->next = NULL;
} else {
tqe->prev->next = tqe->next;
tqe->next->prev = tqe->prev;
}
-   p->txq_entries -= 1;
+   wilc->txq_entries -= 1;
 }
 #endif
 
@@ -98,7 +71,6 @@ static struct txq_entry_t *
 wilc_wlan_txq_remove_from_head(struct net_device *dev)
 {
struct txq_entry_t *tqe;
-   wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
perInterface_wlan_t *nic;
struct wilc *wilc;
@@ -107,13 +79,13 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
wilc = nic->wilc;
 
spin_lock_irqsave(&wilc->txq_spinlock, flags);
-   if (p->txq_head) {
-   tqe = p->txq_head;
-   p->txq_head = tqe->next;
-   if (p->txq_head)
-   p->txq_head->prev = NULL;
+   if (wilc->txq_head) {
+   tqe = wilc->txq_head;
+   wilc->txq_head = tqe->next;
+   if (wilc->txq_head)
+   wilc->txq_head->prev = NULL;
 
-   p->txq_entries -= 1;
+   wilc->txq_entries -= 1;
} else {
tqe = NULL;
}
@@ -124,7 +96,6 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
 static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
  st

[PATCH 01/10] staging: wilc1000: sdio/spi: use device print api instead of custom one

2015-11-23 Thread Glen Lee
This patch use device print api instead of driver defined print. Remove
varialbe dPrint as well. String "[wilc sdio]" and "[wilc spi]" are also removed
from all the print statment if exist because it shows which device the message
is related to.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c |  18 ++--
 drivers/staging/wilc1000/linux_wlan_spi.c  |  24 +++--
 drivers/staging/wilc1000/wilc_sdio.c   | 151 +++--
 drivers/staging/wilc1000/wilc_spi.c| 142 +--
 4 files changed, 213 insertions(+), 122 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index ae31f7d..66cdca2 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -52,7 +52,7 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
sdio_release_host(func);
 
if (ret < 0) {
-   PRINT_ER("wilc_sdio_cmd52..failed, err(%d)\n", ret);
+   dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret);
return 0;
}
return 1;
@@ -83,7 +83,7 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
 
 
if (ret < 0) {
-   PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
+   dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret);
return 0;
}
 
@@ -102,16 +102,16 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
gpio = GPIO_NUM;
}
 
-   PRINT_D(INIT_DBG, "Initializing netdev\n");
+   dev_dbg(&func->dev, "Initializing netdev\n");
if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
 &wilc_hif_sdio)) {
-   PRINT_ER("Couldn't initialize netdev\n");
+   dev_err(&func->dev, "Couldn't initialize netdev\n");
return -1;
}
sdio_set_drvdata(func, wilc);
wilc->dev = &func->dev;
 
-   printk("Driver Initializing success\n");
+   dev_info(&func->dev, "Driver Initializing success\n");
return 0;
 }
 
@@ -139,7 +139,7 @@ int wilc_sdio_enable_interrupt(struct wilc *dev)
sdio_release_host(func);
 
if (ret < 0) {
-   PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
+   dev_err(&func->dev, "can't claim sdio_irq, err(%d)\n", ret);
ret = -EIO;
}
return ret;
@@ -150,16 +150,16 @@ void wilc_sdio_disable_interrupt(struct wilc *dev)
struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret;
 
-   PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n");
+   dev_dbg(&func->dev, "wilc_sdio_disable_interrupt IN\n");
 
sdio_claim_host(func);
ret = sdio_release_irq(func);
if (ret < 0) {
-   PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
+   dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret);
}
sdio_release_host(func);
 
-   PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n");
+   dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n");
 }
 
 int wilc_sdio_init(void)
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index f3ffc9e..01fa6fa 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -83,7 +83,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
return -ENOMEM;
 
tr.rx_buf = r_buffer;
-   PRINT_D(BUS_DBG, "Request writing %d bytes\n", len);
+   dev_dbg(&spi->dev, "Request writing %d bytes\n", len);
 
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
@@ -95,13 +95,17 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
 
ret = spi_sync(spi, &msg);
if (ret < 0) {
-   PRINT_ER("SPI transaction failed\n");
+   dev_err(&spi->dev, "SPI transaction failed\n");
}
 
kfree(r_buffer);
} else {
-   PRINT_ER("can't write data with the following length: %d\n", 
len);
-   PRINT_ER("FAILED due to NULL buffer or ZERO length check the 
following length: %d\n", len);
+   dev_err(&spi->dev,
+   "can't write data with the following length: %d\n"

[PATCH 02/10] staging: wilc1000: remove wilc_debug_func of hif_init

2015-11-23 Thread Glen Lee
This patch removes wilc_debug_func of hif_init and remove it's related
functions as well because it is not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_sdio.c | 2 +-
 drivers/staging/wilc1000/wilc_spi.c  | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 30dd7f9..c2c10dd 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -512,7 +512,7 @@ static int sdio_sync(struct wilc *wilc)
return 1;
 }
 
-static int sdio_init(struct wilc *wilc, wilc_debug_func debug_func)
+static int sdio_init(struct wilc *wilc)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
sdio_cmd52_t cmd;
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2d51748..6032a8f 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -734,7 +734,7 @@ static int wilc_spi_sync(struct wilc *wilc)
return 1;
 }
 
-static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func)
+static int _wilc_spi_init(struct wilc *wilc)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
u32 reg;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 0427349..32ecc2d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1587,7 +1587,7 @@ int wilc_wlan_init(struct net_device *dev)
 
PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
 
-   if (!wilc->hif_func->hif_init(wilc, wilc_debug)) {
+   if (!wilc->hif_func->hif_init(wilc)) {
ret = -EIO;
goto _fail_;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 3666453..580e1d6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -226,7 +226,7 @@ struct rxq_entry_t {
  /
 struct wilc;
 struct wilc_hif_func {
-   int (*hif_init)(struct wilc *, wilc_debug_func);
+   int (*hif_init)(struct wilc *);
int (*hif_deinit)(struct wilc *);
int (*hif_read_reg)(struct wilc *, u32, u32 *);
int (*hif_write_reg)(struct wilc *, u32, u32);
-- 
1.9.1

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


[PATCH 04/10] staging: wilc1000: linux_wlan_sdio.c: fix checkpatch warning line over 80

2015-11-23 Thread Glen Lee
This patch fixes checkpatch warning line over 80 characters.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 66cdca2..78e6808 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -74,9 +74,11 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
size = cmd->count;
 
if (cmd->read_write) {  /* write */
-   ret = sdio_memcpy_toio(func, cmd->address, (void *)cmd->buffer, 
size);
+   ret = sdio_memcpy_toio(func, cmd->address,
+  (void *)cmd->buffer, size);
} else {/* read */
-   ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, 
cmd->address,  size);
+   ret = sdio_memcpy_fromio(func, (void *)cmd->buffer,
+cmd->address,  size);
}
 
sdio_release_host(func);
@@ -90,7 +92,8 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
return 1;
 }
 
-static int linux_sdio_probe(struct sdio_func *func, const struct 
sdio_device_id *id)
+static int linux_sdio_probe(struct sdio_func *func,
+   const struct sdio_device_id *id)
 {
struct wilc *wilc;
int gpio;
@@ -126,7 +129,9 @@ static struct sdio_driver wilc1000_sdio_driver = {
.probe  = linux_sdio_probe,
.remove = linux_sdio_remove,
 };
-module_driver(wilc1000_sdio_driver, sdio_register_driver, 
sdio_unregister_driver);
+module_driver(wilc1000_sdio_driver,
+ sdio_register_driver,
+ sdio_unregister_driver);
 MODULE_LICENSE("GPL");
 
 int wilc_sdio_enable_interrupt(struct wilc *dev)
-- 
1.9.1

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


[PATCH 06/10] staging: wilc1000: wilc_sdio_cmd53: return linux error value

2015-11-23 Thread Glen Lee
This patch changes return value with linux error value, not 1 or 0.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c |  7 ++-
 drivers/staging/wilc1000/wilc_sdio.c   | 26 --
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 64fb81b..a918de9 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -83,13 +83,10 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
 
sdio_release_host(func);
 
-
-   if (ret < 0) {
+   if (ret)
dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret);
-   return 0;
-   }
 
-   return 1;
+   return ret;
 }
 
 static int linux_sdio_probe(struct sdio_func *func,
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 1381a10..24bc6f7 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -138,6 +138,7 @@ _fail_:
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   int ret;
 
data = cpu_to_le32(data);
 
@@ -171,8 +172,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.count = 4;
cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from 
setting unexpected value */
-
-   if (!wilc_sdio_cmd53(wilc, &cmd)) {
+   ret = wilc_sdio_cmd53(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd53, write reg (%08x)...\n", addr);
goto _fail_;
@@ -191,7 +192,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd;
-   int nblk, nleft;
+   int nblk, nleft, ret;
 
cmd.read_write = 1;
if (addr > 0) {
@@ -237,7 +238,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(wilc, &cmd)) {
+   ret = wilc_sdio_cmd53(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], block send...\n", addr);
goto _fail_;
@@ -259,7 +261,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(wilc, &cmd)) {
+   ret = wilc_sdio_cmd53(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], bytes send...\n", addr);
goto _fail_;
@@ -276,6 +279,7 @@ _fail_:
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+   int ret;
 
if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd;
@@ -305,8 +309,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.buffer = (u8 *)data;
 
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from 
setting unexpected value */
-
-   if (!wilc_sdio_cmd53(wilc, &cmd)) {
+   ret = wilc_sdio_cmd53(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd53, read reg (%08x)...\n", addr);
goto _fail_;
@@ -327,7 +331,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd;
-   int nblk, nleft;
+   int nblk, nleft, ret;
 
cmd.read_write = 0;
if (addr > 0) {
@@ -373,7 +377,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, 
u32 size)
if (!sdio_set_func0_csa_address(wilc, addr))
goto _fail_;
}
-   if (!wilc_sdio_cmd53(wilc, &cmd)) {
+   ret = wilc_sdio_cmd53(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd53 [%x], block read...\n", addr);
  

[PATCH 08/10] staging: wilc1000: linux_wlan_spi.c: remove braces for single statement

2015-11-23 Thread Glen Lee
This patches fixes checkpatch warning: braces {} are not necessary for single
statement blocks. Remove some comments also.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 01fa6fa..6fcf7b3 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -15,7 +15,7 @@
 #include "linux_wlan_common.h"
 #include "wilc_wlan_if.h"
 
-#define USE_SPI_DMA 0   /* johnny add */
+#define USE_SPI_DMA 0
 
 static const struct wilc1000_ops wilc1000_spi_ops;
 
@@ -87,16 +87,13 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
 
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
-/* [[johnny add */
msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
-/* ]] */
spi_message_add_tail(&tr, &msg);
 
ret = spi_sync(spi, &msg);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(&spi->dev, "SPI transaction failed\n");
-   }
 
kfree(r_buffer);
} else {
@@ -137,16 +134,13 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
 
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
-/* [[ johnny add */
msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
-/* ]] */
spi_message_add_tail(&tr, &msg);
 
ret = spi_sync(spi, &msg);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(&spi->dev, "SPI transaction failed\n");
-   }
kfree(t_buffer);
} else {
dev_err(&spi->dev,
@@ -183,9 +177,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, 
u32 rlen)
 
spi_message_add_tail(&tr, &msg);
ret = spi_sync(spi, &msg);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(&spi->dev, "SPI transaction failed\n");
-   }
} else {
dev_err(&spi->dev,
"can't read data with the following length: %u\n",
-- 
1.9.1

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


[PATCH 10/10] staging: wilc1000: linux_wlan_spi.c: fix NULL comparison style

2015-11-23 Thread Glen Lee
This patch fixes checkpatch CHECK:comparison to NULL could be written "b".

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 190243a..6111405 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -72,7 +72,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
int ret;
struct spi_message msg;
 
-   if (len > 0 && b != NULL) {
+   if (len > 0 && b) {
struct spi_transfer tr = {
.tx_buf = b,
.len = len,
-- 
1.9.1

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


[PATCH 03/10] staging: wilc1000: remove unused functions

2015-11-23 Thread Glen Lee
This patch removes unused function pointer hif_sync and hif_clear_int, and
removes it's related functions sdio_clear_int, sdio_sync, wilc_spi_clear_int
and wilc_spi_sync.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_sdio.c | 94 
 drivers/staging/wilc1000/wilc_spi.c  | 60 ---
 drivers/staging/wilc1000/wilc_wlan.h |  2 -
 3 files changed, 156 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index c2c10dd..1381a10 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -130,37 +130,6 @@ _fail_:
return 0;
 }
 
-static int sdio_clear_int(struct wilc *wilc)
-{
-   struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-
-   if (!g_sdio.irq_gpio) {
-   /* u32 sts; */
-   sdio_cmd52_t cmd;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x4;
-   cmd.data = 0;
-   wilc_sdio_cmd52(wilc, &cmd);
-
-   return cmd.data;
-   } else {
-   u32 reg;
-
-   if (!sdio_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) {
-   dev_err(&func->dev, "Failed read reg (%08x)...\n",
-   WILC_HOST_RX_CTRL_0);
-   return 0;
-   }
-   reg &= ~0x1;
-   sdio_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg);
-   return 1;
-   }
-
-}
-
 /
  *
  *  Sdio interfaces
@@ -451,67 +420,6 @@ static int sdio_deinit(struct wilc *wilc)
return 1;
 }
 
-static int sdio_sync(struct wilc *wilc)
-{
-   struct sdio_func *func = dev_to_sdio_func(wilc->dev);
-   u32 reg;
-
-   /**
-*  Disable power sequencer
-**/
-   if (!sdio_read_reg(wilc, WILC_MISC, ®)) {
-   dev_err(&func->dev, "Failed read misc reg...\n");
-   return 0;
-   }
-
-   reg &= ~BIT(8);
-   if (!sdio_write_reg(wilc, WILC_MISC, reg)) {
-   dev_err(&func->dev, "Failed write misc reg...\n");
-   return 0;
-   }
-
-   if (g_sdio.irq_gpio) {
-   u32 reg;
-   int ret;
-
-   /**
-*  interrupt pin mux select
-**/
-   ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®);
-   if (!ret) {
-   dev_err(&func->dev, "Failed read reg (%08x)...\n",
-   WILC_PIN_MUX_0);
-   return 0;
-   }
-   reg |= BIT(8);
-   ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg);
-   if (!ret) {
-   dev_err(&func->dev, "Failed write reg (%08x)...\n",
-   WILC_PIN_MUX_0);
-   return 0;
-   }
-
-   /**
-*  interrupt enable
-**/
-   ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®);
-   if (!ret) {
-   dev_err(&func->dev, "Failed read reg (%08x)...\n",
-   WILC_INTR_ENABLE);
-   return 0;
-   }
-   reg |= BIT(16);
-   ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg);
-   if (!ret) {
-   dev_err(&func->dev, "Failed write reg (%08x)...\n",
-   WILC_INTR_ENABLE);
-   return 0;
-   }
-   }
-
-   return 1;
-}
-
 static int sdio_init(struct wilc *wilc)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
@@ -950,8 +858,6 @@ const struct wilc_hif_func wilc_hif_sdio = {
.hif_write_reg = sdio_write_reg,
.hif_block_rx = sdio_read,
.hif_block_tx = sdio_write,
-   .hif_sync = sdio_sync,
-   .hif_clear_int = sdio_clear_int,
.hif_read_int = sdio_read_int,
.hif_clear_int_ext = sdio_clear_int_ext,
.hif_read_size = sdio_read_size,
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 6032a8f..f54072b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -668,21 +668,6 @@ static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 
*buf, u32 size)
  *
  /
 
-static int wilc_spi_clear_int(struct wilc *wilc)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   u32 reg;
-
-   if (!wilc_spi_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) {
-   dev_err(&spi->dev, "Failed read reg (%08x)...\n",
-   WILC_HOS

[PATCH 09/10] staging: wilc1000: linux_wlan_spi.c: add a blank

2015-11-23 Thread Glen Lee
This patch fixes checkpatch warning: missing a blank like after declarations.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 6fcf7b3..190243a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -79,6 +79,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
.delay_usecs = 0,
};
char *r_buffer = kzalloc(len, GFP_KERNEL);
+
if (!r_buffer)
return -ENOMEM;
 
@@ -127,6 +128,7 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
 
};
char *t_buffer = kzalloc(rlen, GFP_KERNEL);
+
if (!t_buffer)
return -ENOMEM;
 
-- 
1.9.1

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


[PATCH 05/10] staging: wilc1000: linux_wlan_sdio.c: remove braces

2015-11-23 Thread Glen Lee
This patch fixes checkpatch warning braces{} are not necessary for single
statment blocks.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 78e6808..64fb81b 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -159,9 +159,8 @@ void wilc_sdio_disable_interrupt(struct wilc *dev)
 
sdio_claim_host(func);
ret = sdio_release_irq(func);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret);
-   }
sdio_release_host(func);
 
dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n");
-- 
1.9.1

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


[PATCH 07/10] staging: wilc1000: wilc_sdio_cmd52: return linux error value

2015-11-23 Thread Glen Lee
This patch changes return value with linux error value, not 1 or 0.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c |  6 ++--
 drivers/staging/wilc1000/wilc_sdio.c   | 51 +++---
 2 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index a918de9..e25811d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -51,11 +51,9 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
 
sdio_release_host(func);
 
-   if (ret < 0) {
+   if (ret)
dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret);
-   return 0;
-   }
-   return 1;
+   return ret;
 }
 
 
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 24bc6f7..fd640f1 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -38,6 +38,7 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 
adr)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
sdio_cmd52_t cmd;
+   int ret;
 
/**
 *  Review: BIG ENDIAN
@@ -47,21 +48,24 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, 
u32 adr)
cmd.raw = 0;
cmd.address = 0x10c;
cmd.data = (u8)adr;
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10c data...\n");
goto _fail_;
}
 
cmd.address = 0x10d;
cmd.data = (u8)(adr >> 8);
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10d data...\n");
goto _fail_;
}
 
cmd.address = 0x10e;
cmd.data = (u8)(adr >> 16);
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10e data...\n");
goto _fail_;
}
@@ -75,20 +79,23 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 
block_size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
sdio_cmd52_t cmd;
+   int ret;
 
cmd.read_write = 1;
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0x10;
cmd.data = (u8)block_size;
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x10 data...\n");
goto _fail_;
}
 
cmd.address = 0x11;
cmd.data = (u8)(block_size >> 8);
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x11 data...\n");
goto _fail_;
}
@@ -108,19 +115,22 @@ static int sdio_set_func1_block_size(struct wilc *wilc, 
u32 block_size)
 {
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
sdio_cmd52_t cmd;
+   int ret;
 
cmd.read_write = 1;
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0x110;
cmd.data = (u8)block_size;
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x110 data...\n");
goto _fail_;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev, "Failed cmd52, set 0x111 data...\n");
goto _fail_;
}
@@ -150,7 +160,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 
data)
cmd.raw = 0;
cmd.address = addr;
cmd.data = data;
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
dev_err(&func->dev,
"Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
@@ -288,7 +299,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
cmd.function = 0;
cmd.raw = 0;
cmd.address = addr;
-   if (!wilc_sdio_cmd52(wilc, &cmd)) {
+   ret = wilc_sdio_cmd52(wilc, &cmd);
+   if (ret) {
   

[PATCH 01/10] staging: wilc1000: fix rmmod failure

2015-11-24 Thread Glen Lee
This patch fixes rmmod failure. wilc->firmware needs to be set to NULL because
it is used again to check firmware is released when module exit.

Fixes: 8b8ad7bc90bc ("staging: wilc1000: rename wilc_firmware in the struct 
wilc")
Signed-off-by: Glen Lee 
---
 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 7ccc9b0..92ca072 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -506,6 +506,7 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
release_firmware(wilc->firmware);
+   wilc->firmware = NULL;
 
PRINT_D(INIT_DBG, "Download Succeeded\n");
 
-- 
1.9.1

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


[PATCH 02/10] staging: wilc1000: wilc_wfi_cfgoperations.c: remove over-commenting

2015-11-24 Thread Glen Lee
From: Leo Kim 

There are over-commenting in the wilc_wfi_cfgoperations.c file and most of them
are not helpful to explain what the code does and generate 80 ending
line over warnings. So, all of comments are removed in this patch and the
comments will later be added if necessary with the preferred Linux style.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 681 +-
 1 file changed, 23 insertions(+), 658 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcfddbf..bfef022 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1,20 +1,7 @@
-/*!
- *  @file  wilc_wfi_cfgopertaions.c
- *  @brief CFG80211 Function Implementation functionality
- *  @authoraabouzaeid
- *  mabubakr
- *  mdaftedar
- *  zsalah
- *  @sawilc_wfi_cfgopertaions.h top level OS wrapper file
- *  @date  31 Aug 2010
- *  @version   1.0
- */
-
 #include "wilc_wfi_cfgoperations.h"
 #include "host_interface.h"
 #include 
 
-/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
 #define NO_ENCRYPT 0
 #define ENCRYPT_ENABLEDBIT(0)
 #define WEPBIT(1)
@@ -24,13 +11,11 @@
 #define AESBIT(5)
 #define TKIP   BIT(6)
 
-/*Public action frame index IDs*/
 #define FRAME_TYPE_ID  0
 #define ACTION_CAT_ID  24
 #define ACTION_SUBTYPE_ID  25
 #define P2P_PUB_ACTION_SUBTYPE 30
 
-/*Public action frame Attribute IDs*/
 #define ACTION_FRAME   0xd0
 #define GO_INTENT_ATTR_ID  0x04
 #define CHANLIST_ATTR_ID   0x0b
@@ -38,7 +23,6 @@
 #define PUB_ACTION_ATTR_ID 0x04
 #define P2PELEM_ATTR_ID0xdd
 
-/*Public action subtype values*/
 #define GO_NEG_REQ 0x00
 #define GO_NEG_RSP 0x01
 #define GO_NEG_CONF0x02
@@ -90,7 +74,6 @@ static const struct ieee80211_txrx_stypes
}
 };
 
-/* Time to stay on the channel */
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
 
@@ -123,7 +106,6 @@ u8 wilc_initialized = 1;
.max_power= 30,  \
 }
 
-/*Frequency range for channels*/
 static struct ieee80211_channel ieee80211_2ghz_channels[] = {
CHAN2G(1,  2412, 0),
CHAN2G(2,  2417, 0),
@@ -147,8 +129,6 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = 
{
.flags= (_flags),   \
 }
 
-
-/* Table 6 in section 3.2.1.1 */
 static struct ieee80211_rate ieee80211_bitrates[] = {
RATETAB_ENT(10,  0,  0),
RATETAB_ENT(20,  1,  0),
@@ -342,7 +322,6 @@ static int is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
state = -1;
} else {
-   /* Linear search for now */
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].au8bssid,
   pstrNetworkInfo->au8bssid, 6) == 0) {
@@ -394,7 +373,7 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
if (ap_found != -1)
kfree(last_scanned_shadow[ap_index].pu8IEs);
last_scanned_shadow[ap_index].pu8IEs =
-   kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL);/* will 
be deallocated by the WILC_WFI_CfgScan() function */
+   kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL);
memcpy(last_scanned_shadow[ap_index].pu8IEs,
   pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen);
last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies;
@@ -405,20 +384,6 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
last_scanned_shadow[ap_index].pJoinParams = pJoinParams;
 }
 
-
-/**
- *  @brief  CfgScanResult
- *  @details  Callback function which returns the scan results found
- *
- *  @param[in] tenuScanEvent enuScanEvent: enum, indicating the scan event 
triggered, whether that is
- *SCAN_EVENT_NETWORK_FOUND or SCAN_EVENT_DONE
- *tstrNetworkInfo* pstrNetworkInfo: structure holding 
the scan results information
- *void* pUserVoid: Private structure associated with 
the wireless interface
- *  @return NONE
- *  @authormabubakr
- *  @date
- *  @version   1.0
- */
 static void CfgScanResult(enum scan_event scan_event,
  tstrNetworkInfo *network_info,
  void *user_void,
@@ -457,7 +422,7 @@

[PATCH 06/10] staging: wilc1000: wilc_init(): fixes inconsistent returns

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - wilc_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

No need to up the sema here since down was not called before get here.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 da4f4c6..3aea6ec 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3940,7 +3940,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
return result;
 
 _fail_timer_2:
-   up(&hif_drv->sem_cfg_values);
del_timer_sync(&hif_drv->connect_timer);
del_timer_sync(&hif_drv->scan_timer);
kthread_stop(hif_thread_handler);
-- 
1.9.1

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


[PATCH 03/10] staging: wilc1000: fixes blank lines aren't necessary brace

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the checks reported by checkpatch.pl
for Blank lines aren't necessary after an open brace '{' and
Blank lines aren't necessary before a close brace '}'.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 50 ---
 1 file changed, 50 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bfef022..71038b1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -201,7 +201,6 @@ static void clear_shadow_scan(void)
}
last_scanned_cnt = 0;
}
-
 }
 
 static u32 get_rssi_avg(tstrNetworkInfo *network_info)
@@ -250,10 +249,8 @@ static void refresh_scan(void *user_void, u8 all, bool 
direct_scan)
cfg80211_put_bss(wiphy, bss);
}
}
-
}
}
-
 }
 
 static void reset_shadow_found(void)
@@ -347,7 +344,6 @@ static void add_network_to_shadow(tstrNetworkInfo 
*pstrNetworkInfo,
if (ap_found == -1) {
ap_index = last_scanned_cnt;
last_scanned_cnt++;
-
} else {
ap_index = ap_found;
}
@@ -590,9 +586,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, 
pstrDisconnectNotifInfo->ie,
  pstrDisconnectNotifInfo->ie_len, false,
  GFP_KERNEL);
-
}
-
 }
 
 static int set_channel(struct wiphy *wiphy,
@@ -646,14 +640,11 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
 
if (request->n_ssids >= 1) {
-
-
strHiddenNetwork.pstrHiddenNetworkInfo = 
kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
strHiddenNetwork.u8ssidnum = request->n_ssids;
 
 
for (i = 0; i < request->n_ssids; i++) {
-
if (request->ssids[i].ssid != NULL && 
request->ssids[i].ssid_len != 0) {

strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);

memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, 
request->ssids[i].ssid, request->ssids[i].ssid_len);
@@ -675,7 +666,6 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 (const u8 *)request->ie, 
request->ie_len,
 CfgScanResult, (void *)priv, 
NULL);
}
-
} else {
PRINT_ER("Requested num of scanned channels is greater than the 
max, supported"
 " channels\n");
@@ -835,7 +825,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u8security = ENCRYPT_ENABLED | WPA | AES;
pcgroup_encrypt_val = "WPA_AES";
pccipher_group = "AES";
-
}
pcwpa_version = "WPA_VERSION_1";
 
@@ -845,7 +834,6 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
goto done;
}
-
}
 
if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)
@@ -982,7 +970,6 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
-
priv->WILC_WFI_wep_default = key_index;
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, 
params->key_len);
@@ -1022,12 +1009,10 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || 
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
-
if (priv->wilc_gtk[key_index] == NULL) {
priv->wilc_gtk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq

[PATCH 04/10] staging: wilc1000: replace explicit NULL comparisons with !

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch replace explicit NULL comparison with ! operator to simplify code.
Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or 
"XXX".

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 71038b1..bdc4537 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event,
 
down(&(priv->hSemScanReq));
 
-   if (priv->pstrScanReq != NULL) {
+   if (priv->pstrScanReq) {
cfg80211_scan_done(priv->pstrScanReq, false);
priv->u32RcvdChCount = 0;
priv->bCfgScanning = false;
@@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event,
down(&(priv->hSemScanReq));
 
PRINT_D(CFG80211_DBG, "Scan Aborted\n");
-   if (priv->pstrScanReq != NULL) {
+   if (priv->pstrScanReq) {
update_scan_time();
refresh_scan(priv, 1, false);
 
@@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 
 
for (i = 0; i < request->n_ssids; i++) {
-   if (request->ssids[i].ssid != NULL && 
request->ssids[i].ssid_len != 0) {
+   if (request->ssids[i].ssid &&
+   request->ssids[i].ssid_len != 0) {

strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = 
kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);

memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, 
request->ssids[i].ssid, request->ssids[i].ssid_len);

strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = 
request->ssids[i].ssid_len;
@@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
   sme->ssid,
   sme->ssid_len) == 0) {
PRINT_INFO(CFG80211_DBG, "Network with required SSID is 
found %s\n", sme->ssid);
-   if (sme->bssid == NULL) {
+   if (!sme->bssid) {
PRINT_INFO(CFG80211_DBG, "BSSID is not passed 
from the user\n");
break;
} else {
@@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || 
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
-   if (priv->wilc_gtk[key_index] == NULL) {
+   if (!priv->wilc_gtk[key_index]) {
priv->wilc_gtk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
}
-   if (priv->wilc_ptk[key_index] == NULL) {
+   if (!priv->wilc_ptk[key_index]) {
priv->wilc_ptk[key_index] = 
kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_ptk[key_index]->key = NULL;
priv->wilc_ptk[key_index]->seq = NULL;
@@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy,
 
if (ieee80211_is_mgmt(mgmt->frame_control)) {
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
-   if (mgmt_tx == NULL) {
+   if (!mgmt_tx) {
PRINT_ER("Failed to allocate memory for mgmt_tx 
structure\n");
return -EFAULT;
}
mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
-   if (mgmt_tx->buff == NULL) {
+   if (!mgmt_tx->buff) {
PRINT_ER("Failed to allocate memory for mgmt_tx 
buff\n");
kfree(mgmt_tx);
return -EFAULT;
@@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
 
PRINT_D(CFG80211_DBG, " Power

[PATCH 05/10] staging: wilc1000: fixes potential null dereference 'wid.val'

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the error reported by smatch.
 - Handle_ListenStateExpired() error: potential null dereference 'wid.val'
If kmalloc failed, referenced to a NULL pointer.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index aae5a03..da4f4c6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2629,8 +2629,10 @@ static u32 Handle_ListenStateExpired(struct host_if_drv 
*hif_drv,
wid.size = 2;
wid.val = kmalloc(wid.size, GFP_KERNEL);
 
-   if (!wid.val)
+   if (!wid.val) {
PRINT_ER("Failed to allocate memory\n");
+   return -ENOMEM;
+   }
 
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
-- 
1.9.1

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


[PATCH 08/10] staging: wilc1000: Handle_AddBASession: remove unused function

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch removes unused a function Handle_AddBASession.
And, removes the relation define.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 69 ---
 1 file changed, 69 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8f27227..0b85640 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -43,7 +43,6 @@
 #define HOST_IF_MSG_FLUSH_CONNECT   30
 #define HOST_IF_MSG_GET_STATISTICS  31
 #define HOST_IF_MSG_SET_MULTICAST_FILTER32
-#define HOST_IF_MSG_ADD_BA_SESSION  33
 #define HOST_IF_MSG_DEL_BA_SESSION  34
 #define HOST_IF_MSG_Q_IDLE  35
 #define HOST_IF_MSG_DEL_ALL_STA 36
@@ -2741,70 +2740,6 @@ ERRORHANDLER:
kfree(wid.val);
 }
 
-static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
-  struct ba_session_info *strHostIfBASessionInfo)
-{
-   s32 result = 0;
-   struct wid wid;
-   int AddbaTimeout = 100;
-   char *ptr = NULL;
-
-   PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = 
%.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
-   strHostIfBASessionInfo->bssid[0],
-   strHostIfBASessionInfo->bssid[1],
-   strHostIfBASessionInfo->bssid[2],
-   strHostIfBASessionInfo->buf_size,
-   strHostIfBASessionInfo->time_out,
-   strHostIfBASessionInfo->tid);
-
-   wid.id = (u16)WID_11E_P_ACTION_REQ;
-   wid.type = WID_STR;
-   wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
-   wid.size = BLOCK_ACK_REQ_SIZE;
-   ptr = wid.val;
-   *ptr++ = 0x14;
-   *ptr++ = 0x3;
-   *ptr++ = 0x0;
-   memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
-   ptr += ETH_ALEN;
-   *ptr++ = strHostIfBASessionInfo->tid;
-   *ptr++ = 1;
-   *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF);
-   *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
-   *ptr++ = (AddbaTimeout & 0xFF);
-   *ptr++ = ((AddbaTimeout >> 16) & 0xFF);
-   *ptr++ = 8;
-   *ptr++ = 0;
-
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
-   if (result)
-   PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
-
-   wid.id = (u16)WID_11E_P_ACTION_REQ;
-   wid.type = WID_STR;
-   wid.size = 15;
-   ptr = wid.val;
-   *ptr++ = 15;
-   *ptr++ = 7;
-   *ptr++ = 0x2;
-   memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN);
-   ptr += ETH_ALEN;
-   *ptr++ = strHostIfBASessionInfo->tid;
-   *ptr++ = 8;
-   *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-   *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
-   *ptr++ = 3;
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
-
-   kfree(wid.val);
-
-   return result;
-}
-
 static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
 struct ba_session_info 
*strHostIfBASessionInfo)
 {
@@ -3035,10 +2970,6 @@ static int hostIFthread(void *pvArg)
Handle_SetMulticastFilter(msg.drv, 
&msg.body.multicast_info);
break;
 
-   case HOST_IF_MSG_ADD_BA_SESSION:
-   Handle_AddBASession(msg.drv, &msg.body.session_info);
-   break;
-
case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
Handle_DelAllRxBASessions(msg.drv, 
&msg.body.session_info);
break;
-- 
1.9.1

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


[PATCH 09/10] staging: wilc1000: change if with else if

2015-11-24 Thread Glen Lee
From: Leo Kim 

The if statement should be else if since it is part of whole if condition.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0b85640..c309deb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1764,9 +1764,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
strWIDList, 4,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-   }
-
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len 
+ 2, GFP_KERNEL);
if (!pu8keybuf) {
@@ -1848,9 +1846,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
-   }
-
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling group key(Rx) 
function\n");
 
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
@@ -1921,8 +1917,7 @@ _WPARxGtk_end_case_:
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
-   }
-   if (pstrHostIFkeyAttr->action & ADDKEY) {
+   } else if (pstrHostIFkeyAttr->action & ADDKEY) {
pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n");
-- 
1.9.1

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


[PATCH 07/10] staging: wilc1000: wilc_deinit(): fixes inconsistent returns

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - wilc_deinit() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

This semaphore protect a cfg_values variable but cfg_values variables was not
used here. So, just remove this line.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 3aea6ec..8f27227 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4007,8 +4007,6 @@ s32 wilc_deinit(struct host_if_drv *hif_drv)
wilc_mq_destroy(&hif_msg_q);
}
 
-   down(&hif_drv->sem_cfg_values);
-
ret = remove_handler_in_list(hif_drv);
if (ret)
result = -ENOENT;
-- 
1.9.1

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


[PATCH 10/10] staging: wilc1000: Handle_SetMulticastFilter(): fixes right shifting more than type allows

2015-11-24 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - Handle_SetMulticastFilter() warn: right shifting more than type allows

That is unnecessary action of boolean type. just assign 0.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 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 c309deb..3b986cb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2713,9 +2713,9 @@ static void Handle_SetMulticastFilter(struct host_if_drv 
*hif_drv,
 
pu8CurrByte = wid.val;
*pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF);
-   *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF);
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
+   *pu8CurrByte++ = 0;
 
*pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
-- 
1.9.1

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


[PATCH 2/4] staging: wilc1000: linux_sdio_probe: use return value

2015-11-25 Thread Glen Lee
Return ret from wilc_netdev_init instead of -1 for proper error handling.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index e25811d..4b9cb55 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -91,7 +91,7 @@ static int linux_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
 {
struct wilc *wilc;
-   int gpio;
+   int gpio, ret;
 
gpio = -1;
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
@@ -101,10 +101,11 @@ static int linux_sdio_probe(struct sdio_func *func,
}
 
dev_dbg(&func->dev, "Initializing netdev\n");
-   if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
-&wilc_hif_sdio)) {
+   ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
+&wilc_hif_sdio);
+   if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
-   return -1;
+   return ret;
}
sdio_set_drvdata(func, wilc);
wilc->dev = &func->dev;
-- 
1.9.1

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


[PATCH 4/4] staging: wilc1000: remove unused files

2015-11-25 Thread Glen Lee
This patch removes linux_wlan_sdio.[ch] which is not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile  |  2 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c | 10 --
 drivers/staging/wilc1000/linux_wlan_sdio.h |  1 -
 3 files changed, 1 insertion(+), 12 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.c
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 2076743..09f0ddb 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -14,7 +14,7 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o 
linux_mon.o \
wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
-wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+wilc1000-sdio-objs += wilc_sdio.o
 
 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
 wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
deleted file mode 100644
index 67d99e9..000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "wilc_wfi_netdevice.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "linux_wlan_sdio.h"
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
deleted file mode 100644
index abb2312..000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ /dev/null
@@ -1 +0,0 @@
-#include 
-- 
1.9.1

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


[PATCH 1/4] staging: wilc1000: linux_wlan_spi.c: return linux error value

2015-11-25 Thread Glen Lee
return linux error value instead of 0 or 1 and use -EINVAL. Related codes
also changed together.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 14 +++---
 drivers/staging/wilc1000/wilc_spi.c   | 18 +-
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 6111405..c7d2542 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -104,13 +104,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
dev_err(&spi->dev,
"FAILED due to NULL buffer or ZERO length check the 
following length: %d\n",
len);
-   ret = -1;
+   ret = -EINVAL;
}
 
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
-
-
return ret;
 }
 
@@ -148,10 +144,8 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
dev_err(&spi->dev,
"can't read data with the following length: %u\n",
rlen);
-   ret = -1;
+   ret = -EINVAL;
}
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
 
return ret;
 }
@@ -185,10 +179,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, 
u32 rlen)
dev_err(&spi->dev,
"can't read data with the following length: %u\n",
rlen);
-   ret = -1;
+   ret = -EINVAL;
}
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
 
return ret;
 }
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index f54072b..450adc0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
}
rix = len;
 
-   if (!wilc_spi_write_read(wilc, wb, rb, len2)) {
+   if (wilc_spi_write_read(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (!wilc_spi_read(wilc, crc, 2)) {
+   if (wilc_spi_read(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data 
block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 **/
retry = 10;
do {
-   if (!wilc_spi_read(wilc, &rsp, 1)) {
+   if (wilc_spi_read(wilc, &rsp, 1)) {
dev_err(&spi->dev, "Failed data 
response read, bus error...\n");
result = N_FAIL;
break;
@@ -423,7 +423,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
   

[PATCH 3/4] staging: wilc1000: linux_wlan_sdio.c: move all the codes to wilc_sdio.c

2015-11-25 Thread Glen Lee
To Combine linux_wlan_sdio.c and wilc_sdio.c as one file, move all the codes
in linux_wlan_sdio.c to wilc_sdio.c, and make functions static only.
No Modification has not been made except static, just moved them.
Function declaration in linux_wlan_sdio.h is needless, so just remove them.
linux_wlan_sdio.[ch] will be deleted in the next patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 160 
 drivers/staging/wilc1000/linux_wlan_sdio.h |   7 --
 drivers/staging/wilc1000/wilc_sdio.c   | 164 -
 3 files changed, 163 insertions(+), 168 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4b9cb55..67d99e9 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -8,163 +8,3 @@
 #include 
 
 #include "linux_wlan_sdio.h"
-
-#define SDIO_MODALIAS "wilc1000_sdio"
-
-#define SDIO_VENDOR_ID_WILC 0x0296
-#define SDIO_DEVICE_ID_WILC 0x5347
-
-static const struct sdio_device_id wilc_sdio_ids[] = {
-   { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) },
-   { },
-};
-
-
-static void wilc_sdio_interrupt(struct sdio_func *func)
-{
-   sdio_release_host(func);
-   wilc_handle_isr(sdio_get_drvdata(func));
-   sdio_claim_host(func);
-}
-
-int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
-{
-   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
-   int ret;
-   u8 data;
-
-   sdio_claim_host(func);
-
-   func->num = cmd->function;
-   if (cmd->read_write) {  /* write */
-   if (cmd->raw) {
-   sdio_writeb(func, cmd->data, cmd->address, &ret);
-   data = sdio_readb(func, cmd->address, &ret);
-   cmd->data = data;
-   } else {
-   sdio_writeb(func, cmd->data, cmd->address, &ret);
-   }
-   } else {/* read */
-   data = sdio_readb(func, cmd->address, &ret);
-   cmd->data = data;
-   }
-
-   sdio_release_host(func);
-
-   if (ret)
-   dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret);
-   return ret;
-}
-
-
-int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
-{
-   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
-   int size, ret;
-
-   sdio_claim_host(func);
-
-   func->num = cmd->function;
-   func->cur_blksize = cmd->block_size;
-   if (cmd->block_mode)
-   size = cmd->count * cmd->block_size;
-   else
-   size = cmd->count;
-
-   if (cmd->read_write) {  /* write */
-   ret = sdio_memcpy_toio(func, cmd->address,
-  (void *)cmd->buffer, size);
-   } else {/* read */
-   ret = sdio_memcpy_fromio(func, (void *)cmd->buffer,
-cmd->address,  size);
-   }
-
-   sdio_release_host(func);
-
-   if (ret)
-   dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret);
-
-   return ret;
-}
-
-static int linux_sdio_probe(struct sdio_func *func,
-   const struct sdio_device_id *id)
-{
-   struct wilc *wilc;
-   int gpio, ret;
-
-   gpio = -1;
-   if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
-   gpio = of_get_gpio(func->dev.of_node, 0);
-   if (gpio < 0)
-   gpio = GPIO_NUM;
-   }
-
-   dev_dbg(&func->dev, "Initializing netdev\n");
-   ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
-&wilc_hif_sdio);
-   if (ret) {
-   dev_err(&func->dev, "Couldn't initialize netdev\n");
-   return ret;
-   }
-   sdio_set_drvdata(func, wilc);
-   wilc->dev = &func->dev;
-
-   dev_info(&func->dev, "Driver Initializing success\n");
-   return 0;
-}
-
-static void linux_sdio_remove(struct sdio_func *func)
-{
-   wilc_netdev_cleanup(sdio_get_drvdata(func));
-}
-
-static struct sdio_driver wilc1000_sdio_driver = {
-   .name   = SDIO_MODALIAS,
-   .id_table   = wilc_sdio_ids,
-   .probe  = linux_sdio_probe,
-   .remove = linux_sdio_remove,
-};
-module_driver(wilc1000_sdio_driver,
- sdio_register_driver,
- sdio_unregister_driver);
-MODULE_LICENSE("GPL");
-
-int wilc_sdio_enable_interrupt(struct wilc *dev)
-{
-   struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
-   int ret = 0;
-
-   sdio_claim_host(func);
-   r

[PATCH 2/5] staging: wilc1000: remove unneeded function

2015-11-25 Thread Glen Lee
wilc_spi_init in linux_wlan_spi.c is unneeded. It just return true. Rename
_wilc_spi_init in wlan_spi.c to wilc_spi_init.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 5 -
 drivers/staging/wilc1000/linux_wlan_spi.h | 1 -
 drivers/staging/wilc1000/wilc_spi.c   | 9 ++---
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index e9ad33f..06935cf 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -61,11 +61,6 @@ struct spi_driver wilc1000_spi_driver = {
 module_spi_driver(wilc1000_spi_driver);
 MODULE_LICENSE("GPL");
 
-int wilc_spi_init(void)
-{
-   return 1;
-}
-
 int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 5ff070b..d41c16a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -4,7 +4,6 @@
 #include 
 #include "wilc_wfi_netdevice.h"
 
-int wilc_spi_init(void);
 int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len);
 int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen);
 int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index ef1ad3b..0f730cd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -676,7 +676,7 @@ static int _wilc_spi_deinit(struct wilc *wilc)
return 1;
 }
 
-static int _wilc_spi_init(struct wilc *wilc)
+static int wilc_spi_init(struct wilc *wilc)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
u32 reg;
@@ -695,11 +695,6 @@ static int _wilc_spi_init(struct wilc *wilc)
 
memset(&g_spi, 0, sizeof(wilc_spi_t));
 
-   if (!wilc_spi_init()) {
-   dev_err(&spi->dev, "Failed io init bus...\n");
-   return 0;
-   }
-
/**
 *  configure protocol
 **/
@@ -992,7 +987,7 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
  *
  /
 const struct wilc_hif_func wilc_hif_spi = {
-   .hif_init = _wilc_spi_init,
+   .hif_init = wilc_spi_init,
.hif_deinit = _wilc_spi_deinit,
.hif_read_reg = wilc_spi_read_reg,
.hif_write_reg = wilc_spi_write_reg,
-- 
1.9.1

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


[PATCH 4/5] staging: wilc1000: remove unused files

2015-11-25 Thread Glen Lee
This patch removes linux_wlan_spi.[ch] which are not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c | 16 
 drivers/staging/wilc1000/linux_wlan_spi.h |  6 --
 3 files changed, 1 insertion(+), 23 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.c
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.h

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 09f0ddb..20a5cb9 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -17,4 +17,4 @@ obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
 
 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
-wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
+wilc1000-spi-objs += wilc_spi.o
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
deleted file mode 100644
index c4315f5..000
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "linux_wlan_spi.h"
-#include "wilc_wfi_netdevice.h"
-#include "linux_wlan_common.h"
-#include "wilc_wlan_if.h"
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
deleted file mode 100644
index 32e3926..000
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef LINUX_WLAN_SPI_H
-#define LINUX_WLAN_SPI_H
-
-#include 
-#include "wilc_wfi_netdevice.h"
-#endif
-- 
1.9.1

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


[PATCH 3/5] staging: wilc1000: linux_wlan_spi.c: move all the codes to wilc_spi.c

2015-11-25 Thread Glen Lee
This patch moves all the codes in linux_wlan_spi.c to wilc_spi.c to make
one spi module. Make wilc_spi_tx, wilc_spi_rx and wilc_spi_tx_rx static
functions. Remove function declaration in linux_wlan_spi.h, which is unnedded
now. No modification has been made inside the codes.
linux_wlan_spi.[ch] will be remove in the next patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 165 ---
 drivers/staging/wilc1000/linux_wlan_spi.h |   4 -
 drivers/staging/wilc1000/wilc_spi.c   | 180 +-
 3 files changed, 178 insertions(+), 171 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 06935cf..c4315f5 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -14,168 +14,3 @@
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
 #include "wilc_wlan_if.h"
-
-#define USE_SPI_DMA 0
-
-static const struct wilc1000_ops wilc1000_spi_ops;
-
-static int wilc_bus_probe(struct spi_device *spi)
-{
-   int ret, gpio;
-   struct wilc *wilc;
-
-   gpio = of_get_gpio(spi->dev.of_node, 0);
-   if (gpio < 0)
-   gpio = GPIO_NUM;
-
-   ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
-   if (ret)
-   return ret;
-
-   spi_set_drvdata(spi, wilc);
-   wilc->dev = &spi->dev;
-
-   return 0;
-}
-
-static int wilc_bus_remove(struct spi_device *spi)
-{
-   wilc_netdev_cleanup(spi_get_drvdata(spi));
-   return 0;
-}
-
-static const struct of_device_id wilc1000_of_match[] = {
-   { .compatible = "atmel,wilc_spi", },
-   {}
-};
-MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-
-struct spi_driver wilc1000_spi_driver = {
-   .driver = {
-   .name = MODALIAS,
-   .of_match_table = wilc1000_of_match,
-   },
-   .probe =  wilc_bus_probe,
-   .remove = wilc_bus_remove,
-};
-module_spi_driver(wilc1000_spi_driver);
-MODULE_LICENSE("GPL");
-
-int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   int ret;
-   struct spi_message msg;
-
-   if (len > 0 && b) {
-   struct spi_transfer tr = {
-   .tx_buf = b,
-   .len = len,
-   .delay_usecs = 0,
-   };
-   char *r_buffer = kzalloc(len, GFP_KERNEL);
-
-   if (!r_buffer)
-   return -ENOMEM;
-
-   tr.rx_buf = r_buffer;
-   dev_dbg(&spi->dev, "Request writing %d bytes\n", len);
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
-   spi_message_add_tail(&tr, &msg);
-
-   ret = spi_sync(spi, &msg);
-   if (ret < 0)
-   dev_err(&spi->dev, "SPI transaction failed\n");
-
-   kfree(r_buffer);
-   } else {
-   dev_err(&spi->dev,
-   "can't write data with the following length: %d\n",
-   len);
-   dev_err(&spi->dev,
-   "FAILED due to NULL buffer or ZERO length check the 
following length: %d\n",
-   len);
-   ret = -EINVAL;
-   }
-
-   return ret;
-}
-
-int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   int ret;
-
-   if (rlen > 0) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .rx_buf = rb,
-   .len = rlen,
-   .delay_usecs = 0,
-
-   };
-   char *t_buffer = kzalloc(rlen, GFP_KERNEL);
-
-   if (!t_buffer)
-   return -ENOMEM;
-
-   tr.tx_buf = t_buffer;
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
-   spi_message_add_tail(&tr, &msg);
-
-   ret = spi_sync(spi, &msg);
-   if (ret < 0)
-   dev_err(&spi->dev, "SPI transaction failed\n");
-   kfree(t_buffer);
-   } else {
-   dev_err(&spi->dev,
-   "can't read data with the following length: %u\n",
-   rlen);
-   ret = -EINVAL;
-   }
-
-   return ret;
-}
-
-int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
-{
-  

[PATCH 5/5] staging: wilc1000: remove unneeded extern variable

2015-11-25 Thread Glen Lee
This patch removes unnedded extern variable WILC_WFI_devs[] which is not used.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 68a159f..b9961f0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -227,7 +227,6 @@ struct WILC_WFI_mon_priv {
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
 
-extern struct net_device *WILC_WFI_devs[];
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
 void wilc_rx_complete(struct wilc *wilc);
-- 
1.9.1

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


[PATCH 1/5] staging: wilc1000: rename spi function names

2015-11-25 Thread Glen Lee
There are several similar function names, such as wilc_spi_write and
_wilc_spi_write. It is likely to be confused after merging linux_wlan_spi.c and
wilc_spi.c, so rename following functions properly.
Rename wilc_spi_write to wilc_spi_tx, wilc_spi_read to wilc_spi_rx,
wilc_spi_write_read to wilc_spi_tx_rx, _wilc_spi_write to wilc_spi_write,
_wilc_spi_read to wilc_spi_read.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c |  6 +++---
 drivers/staging/wilc1000/linux_wlan_spi.h |  6 +++---
 drivers/staging/wilc1000/wilc_spi.c   | 34 +++
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index c7d2542..e9ad33f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -66,7 +66,7 @@ int wilc_spi_init(void)
return 1;
 }
 
-int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
+int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
@@ -110,7 +110,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
return ret;
 }
 
-int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
+int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
@@ -150,7 +150,7 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
return ret;
 }
 
-int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
+int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 00733ab..5ff070b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -5,7 +5,7 @@
 #include "wilc_wfi_netdevice.h"
 
 int wilc_spi_init(void);
-int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
-int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen);
-int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
+int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len);
+int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen);
+int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 450adc0..ef1ad3b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -21,8 +21,8 @@ typedef struct {
 
 static wilc_spi_t g_spi;
 
-static int _wilc_spi_read(struct wilc *wilc, u32, u8 *, u32);
-static int _wilc_spi_write(struct wilc *wilc, u32, u8 *, u32);
+static int wilc_spi_read(struct wilc *wilc, u32, u8 *, u32);
+static int wilc_spi_write(struct wilc *wilc, u32, u8 *, u32);
 
 /
  *
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
}
rix = len;
 
-   if (wilc_spi_write_read(wilc, wb, rb, len2)) {
+   if (wilc_spi_tx_rx(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (wilc_spi_read(wilc, crc, 2)) {
+   if (wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data 
block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 **/
retry = 10;
do {
-   if (wilc_spi_read(wilc, &rsp, 1)) {
+   if (wilc_spi_rx(wilc, &rsp,

[PATCH 0/3] clean up interface information structure

2015-11-26 Thread Glen Lee
This patch series combines perInterface_wlan_t and struct wilc_vif. vif of
struct wilc can be the pointer of net device private data with
perInterface_wlan_t. As a conseqeunce, there will be one interface information
structure wilc_vif.

Glen Lee (3):
  staging: wilc1000: move perInterface_wlan_t to wilc_vif
  staging: wilc1000: change vif to pointer to refence real private data
  staging: wilc1000: remove duplicate netdev

 drivers/staging/wilc1000/host_interface.c |   6 +-
 drivers/staging/wilc1000/linux_wlan.c | 307 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 220 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  22 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  60 ++---
 5 files changed, 305 insertions(+), 310 deletions(-)

-- 
1.9.1

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


[PATCH 1/3] staging: wilc1000: move perInterface_wlan_t to wilc_vif

2015-11-26 Thread Glen Lee
perInterface_wlan_t and wilc_vif are all about interface control informations.
We will combine those two structures and maintain as one network interface
control information.
Move all the members of perInterface_wlan_t to wilc_vif and remove the
structure. Rename perInterace_wlan_t to wilc_vif and rename variable name nic
to vif which is proper name for it.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c |   6 +-
 drivers/staging/wilc1000/linux_wlan.c | 251 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 148 ++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  21 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  60 +++---
 5 files changed, 241 insertions(+), 245 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3b986cb..f7e560e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3772,11 +3772,11 @@ s32 wilc_init(struct net_device *dev, struct 
host_if_drv **hif_drv_handler)
s32 result = 0;
struct host_if_drv *hif_drv;
int err;
-   perInterface_wlan_t *nic;
+   struct wilc_vif *vif;
struct wilc *wilc;
 
-   nic = netdev_priv(dev);
-   wilc = nic->wilc;
+   vif = netdev_priv(dev);
+   wilc = vif->wilc;
 
PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", 
clients_count + 1);
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 92ca072..263d9d8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -64,7 +64,7 @@ static int dev_state_ev_handler(struct notifier_block *this, 
unsigned long event
struct host_if_drv *hif_drv;
struct net_device *dev;
u8 *ip_addr_buf;
-   perInterface_wlan_t *nic;
+   struct wilc_vif *vif;
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";
 
@@ -90,8 +90,8 @@ static int dev_state_ev_handler(struct notifier_block *this, 
unsigned long event
return NOTIFY_DONE;
}
hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
-   nic = netdev_priv(dev);
-   if (!nic || !hif_drv) {
+   vif = netdev_priv(dev);
+   if (!vif || !hif_drv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
@@ -104,7 +104,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
 
PRINT_INFO(GENERIC_DBG, "\n == IP Address Obtained 
===\n\n");
 
-   if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
+   if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
@@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
-   wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
+   wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);
 
break;
 
@@ -128,7 +128,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN 
%p\n", dev);
 
PRINT_INFO(GENERIC_DBG, "\n == IP Address Released 
===\n\n");
-   if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
+   if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
wilc_optaining_ip = false;
}
@@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
 
-   wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
+   wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);
 
break;
 
@@ -161,12 +161,12 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
 
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
-   perInterface_wlan_t *nic;
+   struct wilc_vif *vif;
struct wilc *wilc;
struct net_device *dev = (struct net_device *)user_data;
 
-   nic = netdev_priv(dev);
-   wilc = nic->wilc;
+   vif = netdev_priv(dev);
+   wilc = vif->wilc;
  

[PATCH 3/3] staging: wilc1000: remove duplicate netdev

2015-11-26 Thread Glen Lee
There are two net_device pointer which is the same because two structures
are merged into wilc_vif in previous patch. Remove wilc_netdev and change
with ndev.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 35 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  4 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 -
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 810d7ce..bb3ff49 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -440,8 +440,8 @@ int wilc_wlan_get_firmware(struct net_device *dev)
goto _fail_;
}
 
-   if (!(&vif->wilc_netdev->dev)) {
-   PRINT_ER("&vif->wilc_netdev->dev  is NULL\n");
+   if (!(&vif->ndev->dev)) {
+   PRINT_ER("&vif->ndev->dev  is NULL\n");
goto _fail_;
}
 
@@ -1010,7 +1010,7 @@ int wilc_mac_open(struct net_device *ndev)
 
vif = netdev_priv(ndev);
wilc = vif->wilc;
-   priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
+   priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
 
ret = wilc_init_host_int(ndev);
@@ -1050,12 +1050,12 @@ int wilc_mac_open(struct net_device *ndev)
return -EINVAL;
}
 
-   wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy,
-vif->wilc_netdev->ieee80211_ptr,
+   wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy,
+vif->ndev->ieee80211_ptr,
 vif->g_struct_frame_reg[0].frame_type,
 vif->g_struct_frame_reg[0].reg);
-   wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy,
-vif->wilc_netdev->ieee80211_ptr,
+   wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy,
+vif->ndev->ieee80211_ptr,
 vif->g_struct_frame_reg[1].frame_type,
 vif->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
@@ -1204,13 +1204,13 @@ int wilc_mac_close(struct net_device *ndev)
 
vif = netdev_priv(ndev);
 
-   if (!vif || !vif->wilc_netdev || !vif->wilc_netdev->ieee80211_ptr ||
-   !vif->wilc_netdev->ieee80211_ptr->wiphy) {
+   if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
+   !vif->ndev->ieee80211_ptr->wiphy) {
PRINT_ER("vif = NULL\n");
return 0;
}
 
-   priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
+   priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
wl = vif->wilc;
 
if (!priv) {
@@ -1239,10 +1239,10 @@ int wilc_mac_close(struct net_device *ndev)
return 0;
}
 
-   if (vif->wilc_netdev) {
-   netif_stop_queue(vif->wilc_netdev);
+   if (vif->ndev) {
+   netif_stop_queue(vif->ndev);
 
-   wilc_deinit_host_int(vif->wilc_netdev);
+   wilc_deinit_host_int(vif->ndev);
}
 
if (wl->open_ifcs == 0) {
@@ -1288,7 +1288,7 @@ static int mac_ioctl(struct net_device *ndev, struct 
ifreq *req, int cmd)
return PTR_ERR(buff);
 
if (strncasecmp(buff, "RSSI", length) == 0) {
-   priv = 
wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
+   priv = 
wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi);
if (ret)
PRINT_ER("Failed to send get rssi 
param's message queue ");
@@ -1457,7 +1457,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
strcpy(ndev->name, "p2p%d");
 
vif->u8IfIdx = wl->vif_num;
-   vif->wilc_netdev = ndev;
vif->wilc = *wilc;
wl->vif[i] = vif;
wl->vif[wl->vif_num]->ndev = ndev;
@@ -1476,9 +1475,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
return -1;
}
 
-   vif->wilc_netdev->ieee80211_ptr = wdev;
-   vif->wilc_netdev->ml_priv = vif;
-   wdev->netdev = vif->wilc_netdev

[PATCH 2/3] staging: wilc1000: change vif to pointer to refence real private data

2015-11-26 Thread Glen Lee
vif of struct has it's own memory which is not necessary because we have
allocated vif from netdev_priv.
Change vif to pointer type and assign vif which is netdev private data.
Change it's operator on related codes as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 65 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 263d9d8..810d7ce 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -289,9 +289,9 @@ static struct net_device *get_if_handler(struct wilc *wilc, 
u8 *mac_header)
bssid1 = mac_header + 4;
 
for (i = 0; i < wilc->vif_num; i++)
-   if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
-   !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN))
-   return wilc->vif[i].ndev;
+   if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) ||
+   !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN))
+   return wilc->vif[i]->ndev;
 
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
@@ -299,9 +299,9 @@ static struct net_device *get_if_handler(struct wilc *wilc, 
u8 *mac_header)
bssid = mac_header + 18;
bssid1 = mac_header + 12;
for (i = 0; i < wilc->vif_num; i++)
-   if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
-   !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN))
-   return wilc->vif[i].ndev;
+   if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) ||
+   !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN))
+   return wilc->vif[i]->ndev;
 
PRINT_INFO(INIT_DBG, "\n");
return NULL;
@@ -318,8 +318,8 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 
*bssid)
wilc = vif->wilc;
 
for (i = 0; i < wilc->vif_num; i++)
-   if (wilc->vif[i].ndev == wilc_netdev) {
-   memcpy(wilc->vif[i].bssid, bssid, 6);
+   if (wilc->vif[i]->ndev == wilc_netdev) {
+   memcpy(wilc->vif[i]->bssid, bssid, 6);
ret = 0;
break;
}
@@ -334,7 +334,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
u8 ret_val = 0;
 
for (i = 0; i < wilc->vif_num; i++)
-   if (memcmp(wilc->vif[i].bssid, null_bssid, 6))
+   if (memcmp(wilc->vif[i]->bssid, null_bssid, 6))
ret_val++;
 
return ret_val;
@@ -384,10 +384,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
PRINT_D(TX_DBG, "Waking up queue\n");
 
-   if (netif_queue_stopped(wl->vif[0].ndev))
-   netif_wake_queue(wl->vif[0].ndev);
-   if (netif_queue_stopped(wl->vif[1].ndev))
-   netif_wake_queue(wl->vif[1].ndev);
+   if (netif_queue_stopped(wl->vif[0]->ndev))
+   netif_wake_queue(wl->vif[0]->ndev);
+   if (netif_queue_stopped(wl->vif[1]->ndev))
+   netif_wake_queue(wl->vif[1]->ndev);
}
 
if (ret == WILC_TX_ERR_NO_BUF) {
@@ -1034,14 +1034,14 @@ int wilc_mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
 
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;
+   if (ndev == wl->vif[i]->ndev) {
+   memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+   wl->vif[i]->hif_drv = priv->hWILCWFIDrv;
break;
}
}
 
-   memcpy(ndev->dev_addr, wl->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");
@@ -1182,14 +1182,14 @@ int wilc_mac_xmit(struct sk_buff *skb, struct 
net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n&

Re: [PATCH 1/1] staging: cleanup: Fix incompatible type comparison in wilc1000/host_interface.c

2015-12-03 Thread glen lee



On 2015년 12월 03일 00:12, Mario J. Rugiero wrote:
OK. Since the maintainers are CC'd, I guess I should wait for a 
clarification about this?


Hi Mario,

The purpose of that is to check if tail is null or not. if it is not null, 
there is tail
to send, so copy to buff.

regards,
glen lee.



El 02/12/15 a las 10:29, Dan Carpenter escribió:

Put v2 in the subject.  Also the subsystem prefix is:

[PATCH v3] staging: wilc1000: ...

On Mon, Nov 30, 2015 at 09:09:04PM -0300, Mario J. Rugiero wrote:

This patch replaces an "if (ptr > 0)" comparison that seems to be a
confusing way to check for null by a simpler "if (ptr)" check.

Signed-off-by: Mario J. Rugiero 
---

v2: Remove the != NULL because checkpatch complains.


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 d5b7725..0c87f6c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2270,7 +2270,7 @@ static void Handle_AddBeacon(struct 
host_if_drv *hif_drv,

  *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF);
  *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF);
  -if (pstrSetBeaconParam->tail > 0)
+if (pstrSetBeaconParam->tail)
Probably the intention was to check if "pstrSetBeaconParam->tail_len 
> 0"

but I'm not sure.  The wilc1000 maintainers are very responsive though
so maybe they will know for sure.

regards,
dan carpenter




___
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


  1   2   3   4   5   6   7   8   >