2015-10-20 22:48:09

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 00/19] staging/wilc1000 cleanups

After I screwed up two or three times trying to get the dependencies
with the SPI and SDIO backends right, I ended up taking the time
to do the real fix and make both coexist.

This is a series of patches that address various issues with the
driver, but is mainly targetted at splitting out the spi and sdio
backends into separate drivers that can be built independent of
one another.

The last patch is more experimental than the others, hence the
[RFC] annotation.

Please review and test.

Arnd

Arnd Bergmann (19):
staging/wilc1000: remove unused functions
staging/wilc1000: make symbols static if possible
staging/wilc1000: use proper naming for global symbols
staging/wilc1000: move extern declarations to headers
staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
staging/wilc1000: avoid static definitions in header
staging/wilc1000: remove linux_wlan_{device_power,device_detection}
staging/wilc1000: move wilc_wlan_inp_t into struct wilc
staging/wilc1000: move init/exit functions to driver files
staging/wilc1000: unify device pointer
staging/wilc1000: move wilc1000_ops to drivers
staging/wilc1000: use device pointer for phy creation
staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
staging/wilc1000: turn enable_irq/disable_irq into callbacks
staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
staging/wilc1000: pass hif operations through initialization
staging/wilc1000: split out bus specific modules
[RFC] staging/wilc1000: use more regular probing

drivers/staging/wilc1000/Kconfig | 66 +-
drivers/staging/wilc1000/Makefile | 16 +-
drivers/staging/wilc1000/coreconfigurator.c | 12 +-
drivers/staging/wilc1000/coreconfigurator.h | 12 +-
drivers/staging/wilc1000/host_interface.c | 501 +++-------------
drivers/staging/wilc1000/host_interface.h | 349 ++---------
drivers/staging/wilc1000/linux_mon.c | 11 +-
drivers/staging/wilc1000/linux_wlan.c | 695 +++++++---------------
drivers/staging/wilc1000/linux_wlan_common.h | 18 +-
drivers/staging/wilc1000/linux_wlan_sdio.c | 202 +++++--
drivers/staging/wilc1000/linux_wlan_sdio.h | 14 -
drivers/staging/wilc1000/linux_wlan_spi.c | 119 ++--
drivers/staging/wilc1000/linux_wlan_spi.h | 8 -
drivers/staging/wilc1000/wilc_debugfs.c | 20 +-
drivers/staging/wilc1000/wilc_sdio.c | 213 +++----
drivers/staging/wilc1000/wilc_spi.c | 276 +--------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 87 +--
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 21 +-
drivers/staging/wilc1000/wilc_wlan.c | 180 +++---
drivers/staging/wilc1000/wilc_wlan.h | 49 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 23 +-
23 files changed, 1171 insertions(+), 2222 deletions(-)
delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

--
2.1.0.rc2



2015-10-25 08:26:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 01/19] staging/wilc1000: remove unused functions

On Wed, Oct 21, 2015 at 12:47:20AM +0200, Arnd Bergmann wrote:
> A number of symbols in the wilc1000 driver are completely unused
> and can be removed.
> This includes two variables that are only written but not read.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

Due to other patches that were sent before yours for this driver, this
patch doesn't apply :(

Watch out, I'm getting about 50 patches a week for this driver, it's
under _heavy_ development, you will get merge issues...

Can you rebase the series on my staging-testing branch and resend?

thanks,

greg k-h

2015-10-20 22:48:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 12/19] staging/wilc1000: use device pointer for phy creation

wilc_create_wiphy tries to get a pointer to a device from the
global wilc1000_sdio_func variable. This is a layering violation
and we can use the wilc1000_dev->dev pointer instead.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++-------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 1 +
4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index aa6f5c7db139..abcb70bb1bd7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1638,7 +1638,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
{
struct wireless_dev *wdev;
/*Register WiFi*/
- wdev = wilc_create_wiphy(ndev);
+ wdev = wilc_create_wiphy(ndev, wilc1000_dev->dev);

/* set netdev, tony */
if (dev)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 702c40c1df4b..7405fb8bae42 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,9 +11,6 @@
*/

#include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
#include "host_interface.h"
#include <linux/errno.h>

@@ -3379,7 +3376,7 @@ _fail_:
* @date 01 MAR 2012
* @version 1.0
*/
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
{
struct wilc_priv *priv;
struct wireless_dev *wdev;
@@ -3431,9 +3428,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type,
wdev->wiphy->interface_modes, wdev->iftype);

- #ifdef WILC_SDIO
- set_wiphy_dev(wdev->wiphy, &wilc1000_sdio_func->dev);
- #endif
+ set_wiphy_dev(wdev->wiphy, dev);

/*Register wiphy structure*/
s32Error = wiphy_register(wdev->wiphy);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 158d98c0eb87..ab53d9d59081 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,7 +10,7 @@
#define NM_WFI_CFGOPERATIONS
#include "wilc_wfi_netdevice.h"

-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
void wilc_free_wiphy(struct net_device *net);
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
int wilc_deinit_host_int(struct net_device *net);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 8c5253cce97c..2297e31b5b75 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -2,6 +2,7 @@
#define WILC_WLAN_H

#include <linux/types.h>
+#include <linux/netdevice.h>

#define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0)

--
2.1.0.rc2


2015-10-20 22:48:14

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc

wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c
to have knowledge of the specific sdio and spi front-ends. This
removes the structure and places the members with a constant
'struct wilc1000_ops' pointer inside of 'struct wilc'.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 67 +++++++++++++--------------
drivers/staging/wilc1000/wilc_sdio.c | 17 +++----
drivers/staging/wilc1000/wilc_spi.c | 17 +++----
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
drivers/staging/wilc1000/wilc_wlan.c | 22 ++++-----
drivers/staging/wilc1000/wilc_wlan.h | 4 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 16 ++-----
7 files changed, 70 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index eb4c6cba4575..53cecb892a84 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -923,31 +923,29 @@ static int wlan_deinit_locks(struct wilc *nic)
return 0;
}

-static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-
- PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
- nwi->os_context.os_private = (void *)nic;
-
#ifdef WILC_SDIO
- nwi->io_func.io_type = HIF_SDIO;
- nwi->io_func.io_init = wilc1000_sdio_init;
- nwi->io_func.io_deinit = wilc1000_sdio_deinit;
- nwi->io_func.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52;
- nwi->io_func.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53;
- nwi->io_func.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed;
- nwi->io_func.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed;
-#else
- nwi->io_func.io_type = HIF_SPI;
- nwi->io_func.io_init = wilc1000_spi_init;
- nwi->io_func.io_deinit = wilc1000_spi_deinit;
- nwi->io_func.u.spi.spi_tx = wilc1000_spi_write;
- nwi->io_func.u.spi.spi_rx = wilc1000_spi_read;
- nwi->io_func.u.spi.spi_trx = wilc1000_spi_write_read;
- nwi->io_func.u.spi.spi_max_speed = wilc1000_spi_set_max_speed;
+static const struct wilc1000_ops wilc1000_sdio_ops = {
+ .io_type = HIF_SDIO,
+ .io_init = wilc1000_sdio_init,
+ .io_deinit = wilc1000_sdio_deinit,
+ .u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+ .u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+ .u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+ .u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};
+#endif
+
+#ifdef WILC_SPI
+static const struct wilc1000_ops wilc1000_spi_ops = {
+ .io_type = HIF_SPI,
+ .io_init = wilc1000_spi_init,
+ .io_deinit = wilc1000_spi_deinit,
+ .u.spi.spi_tx = wilc1000_spi_write,
+ .u.spi.spi_rx = wilc1000_spi_read,
+ .u.spi.spi_trx = wilc1000_spi_write_read,
+ .u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
#endif
-}

static int wlan_initialize_threads(perInterface_wlan_t *nic)
{
@@ -995,7 +993,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
#ifdef COMPLEMENT_BOOT

#define READY_CHECK_THRESHOLD 30
-static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
{
u8 trials = 0;

@@ -1011,8 +1009,8 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
msleep(100);
wilc1000_probe = 0;
wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
- linux_to_wlan(nwi, nic);
- wilc_wlan_init(nwi);
+ nic->ops = &wilc1000_sdio_ops;
+ wilc_wlan_init(nic);
}

if (READY_CHECK_THRESHOLD <= trials)
@@ -1025,8 +1023,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
static int repeat_power_cycle(perInterface_wlan_t *nic)
{
int ret = 0;
- wilc_wlan_inp_t nwi;
-
sdio_unregister_driver(&wilc_bus);

sdio_register_driver(&wilc_bus);
@@ -1036,8 +1032,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
msleep(100);
wilc1000_probe = 0;
wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
- linux_to_wlan(&nwi, wilc1000_dev);
- ret = wilc_wlan_init(&nwi);
+ wilc1000_dev->ops = &wilc1000_sdio_ops;
+ ret = wilc_wlan_init(wilc1000_dev);

wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
@@ -1067,7 +1063,6 @@ __fail__:

int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
- wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;

@@ -1078,9 +1073,13 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)

wlan_init_locks(wilc1000_dev);

- linux_to_wlan(&nwi, wilc1000_dev);
+#ifdef WILC_SDIO
+ wilc1000_dev->ops = &wilc1000_sdio_ops;
+#else
+ wilc1000_dev->ops = &wilc1000_spi_ops;
+#endif

- ret = wilc_wlan_init(&nwi);
+ ret = wilc_wlan_init(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
@@ -1095,7 +1094,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
- if (wilc1000_prepare_11b_core(&nwi, wilc1000_dev)) {
+ if (wilc1000_prepare_11b_core(wilc1000_dev)) {
PRINT_ER("11b Core is not ready\n");
ret = -EIO;
goto _fail_threads_;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 91b626ac8797..2d39a5386718 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -8,6 +8,7 @@
/* //////////////////////////////////////////////////////////////////////////// */

#include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"

@@ -498,7 +499,7 @@ static int sdio_sync(void)
return 1;
}

-static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int sdio_init(struct wilc *inp, wilc_debug_func func)
{
sdio_cmd52_t cmd;
int loop;
@@ -507,10 +508,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
memset(&g_sdio, 0, sizeof(wilc_sdio_t));

g_sdio.dPrint = func;
- g_sdio.os_context = inp->os_context.os_private;
+ g_sdio.os_context = inp;

- if (inp->io_func.io_init) {
- if (!inp->io_func.io_init(g_sdio.os_context)) {
+ if (inp->ops->io_init) {
+ if (!inp->ops->io_init(g_sdio.os_context)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
return 0;
}
@@ -518,10 +519,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
return 0;
}

- g_sdio.sdio_cmd52 = inp->io_func.u.sdio.sdio_cmd52;
- g_sdio.sdio_cmd53 = inp->io_func.u.sdio.sdio_cmd53;
- g_sdio.sdio_set_max_speed = inp->io_func.u.sdio.sdio_set_max_speed;
- g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed;
+ g_sdio.sdio_cmd52 = inp->ops->u.sdio.sdio_cmd52;
+ g_sdio.sdio_cmd53 = inp->ops->u.sdio.sdio_cmd53;
+ g_sdio.sdio_set_max_speed = inp->ops->u.sdio.sdio_set_max_speed;
+ g_sdio.sdio_set_default_speed = inp->ops->u.sdio.sdio_set_default_speed;

/**
* function 0 csa enable
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index bb7ee37171ce..4c5659b72f29 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -8,6 +8,7 @@
/* //////////////////////////////////////////////////////////////////////////// */

#include <linux/string.h>
+#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"

@@ -724,7 +725,7 @@ static int spi_sync(void)
return 1;
}

-static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
+static int spi_init(struct wilc *inp, wilc_debug_func func)
{
u32 reg;
u32 chipid;
@@ -743,19 +744,19 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
memset(&g_spi, 0, sizeof(wilc_spi_t));

g_spi.dPrint = func;
- g_spi.os_context = inp->os_context.os_private;
- if (inp->io_func.io_init) {
- if (!inp->io_func.io_init(g_spi.os_context)) {
+ g_spi.os_context = inp;
+ if (inp->ops->io_init) {
+ if (!inp->ops->io_init(g_spi.os_context)) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
}
} else {
return 0;
}
- g_spi.spi_tx = inp->io_func.u.spi.spi_tx;
- g_spi.spi_rx = inp->io_func.u.spi.spi_rx;
- g_spi.spi_trx = inp->io_func.u.spi.spi_trx;
- g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed;
+ g_spi.spi_tx = inp->ops->u.spi.spi_tx;
+ g_spi.spi_rx = inp->ops->u.spi.spi_rx;
+ g_spi.spi_trx = inp->ops->u.spi.spi_trx;
+ g_spi.spi_max_speed = inp->ops->u.spi.spi_max_speed;

/**
* configure protocol
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 28610d889c0c..485df4768e78 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,6 +156,7 @@ struct wilc_vif {
};

struct wilc {
+ const struct wilc1000_ops *ops;
int mac_status;
int wilc1000_initialized;
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a147547fb66e..7e1b892f721d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -23,7 +23,7 @@ typedef struct {
/**
* input interface functions
**/
- wilc_wlan_io_func_t io_func;
+ const struct wilc1000_ops *io_func;

/**
* host interface functions
@@ -651,7 +651,7 @@ static inline void chip_wakeup(void)
u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;

- if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+ if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
do {
g_wlan.hif_func.hif_read_reg(1, &reg);
/* Set bit 1 */
@@ -671,7 +671,7 @@ static inline void chip_wakeup(void)
} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));

} while (wilc_get_chipid(true) == 0);
- } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) {
+ } else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(0xf0, &reg);
do {
/* Set bit 1 */
@@ -731,7 +731,7 @@ static inline void chip_wakeup(void)
u32 reg, trials = 0;

do {
- if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+ if ((g_wlan.io_func->io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, &reg);
/* Make sure bit 1 is 0 before we start. */
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
@@ -739,7 +739,7 @@ static inline void chip_wakeup(void)
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
/* Clear bit 1*/
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
- } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) {
+ } else if ((g_wlan.io_func->io_type & 0x1) == HIF_SDIO) {
/* Make sure bit 0 is 0 before we start. */
g_wlan.hif_func.hif_read_reg(0xf0, &reg);
g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
@@ -1465,10 +1465,10 @@ int wilc_wlan_start(void)
/**
* Set the host interface
**/
- if (p->io_func.io_type == HIF_SDIO) {
+ if (p->io_func->io_type == HIF_SDIO) {
reg = 0;
reg |= BIT(3); /* bug 4456 and 4557 */
- } else if (p->io_func.io_type == HIF_SPI) {
+ } else if (p->io_func->io_type == HIF_SPI) {
reg = 1;
}
acquire_bus(ACQUIRE_ONLY);
@@ -1932,7 +1932,7 @@ u8 wilc1000_core_11b_ready(void)
}
#endif

-int wilc_wlan_init(wilc_wlan_inp_t *inp)
+int wilc_wlan_init(struct wilc *inp)
{

int ret = 0;
@@ -1944,11 +1944,11 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
/**
* store the input
**/
- memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t));
+ g_wlan.io_func = inp->ops;
/***
* host interface init
**/
- if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
+ if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
/* EIO 5 */
ret = -5;
@@ -1956,7 +1956,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
}
memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
} else {
- if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
+ if ((inp->ops->io_type & 0x1) == HIF_SPI) {
/**
* TODO:
**/
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 64295a664ea9..4460c482cb7a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -251,8 +251,10 @@ struct rxq_entry_t {
*
********************************************/

+struct wilc;
+
typedef struct {
- int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func);
+ int (*hif_init)(struct wilc *, wilc_debug_func);
int (*hif_deinit)(void *);
int (*hif_read_reg)(u32, u32 *);
int (*hif_write_reg)(u32, u32);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index be972afe6e62..bfa1291e22ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -71,7 +71,7 @@ typedef struct {
u32 block_size;
} sdio_cmd53_t;

-typedef struct {
+struct wilc1000_ops {
int io_type;
int (*io_init)(void *);
void (*io_deinit)(void *);
@@ -89,7 +89,7 @@ typedef struct {
int (*spi_trx)(u8 *, u8 *, u32);
} spi;
} u;
-} wilc_wlan_io_func_t;
+};

#define WILC_MAC_INDICATE_STATUS 0x1
#define WILC_MAC_STATUS_INIT -1
@@ -98,15 +98,6 @@ typedef struct {

#define WILC_MAC_INDICATE_SCAN 0x2

-typedef struct {
- void *os_private;
-} wilc_wlan_os_context_t;
-
-typedef struct {
- wilc_wlan_os_context_t os_context;
- wilc_wlan_io_func_t io_func;
-} wilc_wlan_inp_t;
-
struct tx_complete_data {
int size;
void *buff;
@@ -937,7 +928,8 @@ typedef enum {
WID_MAX = 0xFFFF
} WID_T;

-int wilc_wlan_init(wilc_wlan_inp_t *inp);
+struct wilc;
+int wilc_wlan_init(struct wilc *inp);

void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void);
--
2.1.0.rc2


2015-10-27 07:10:54

by Tony Cho

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

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

I always appreciate your review and contribution.

Thanks,
Tony.

On 2015년 10월 23일 16:51, Tony Cho wrote:
> Hi Arnd,
> First of all, I would like to say "thank you" for your efforts and
> contributions.
> We are updating the driver because new revision came up and making new
> patches
> to make it stable and elegant as Linux driver. In these days, we are
> sending big changes
> while testing such patches and also doing updates at once.
>
> As you did, we are scheduled to provide the patches making device tree
> and delete all of platform
> dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other
> things. So, I would like to
> discuss with you for your series of patch.
>
> In this time, I think it's important to make the driver to be compiled
> even if the link problem
> happens as you reported. So, how about deleting all of SPI related
> files from source tree and
> even from Kconfig for the time being because new bus driver will come
> or revert
> the Kconfig and then can we expect the best patch in the near feature?
>
> I respect your efforts and patches, so your opinion is very important
> to me.
>
> Thanks,
> Tony.
>
> On 2015년 10월 23일 10:37, glen lee wrote:
>>
>> On 2015년 10월 22일 21:23, Arnd Bergmann wrote:
>>> On Wednesday 21 October 2015 19:06:52 glen lee wrote:
>>>> Hi arnd,
>>>>
>>>> Thanks for the all the patches.
>>>> About the patch ( use proper naming for global symbols ),
>>>> We are planning to use this driver not only for wilc1000 but also for
>>>> other atmel wireless driver. I'd appreciate if you could use wl
>>>> instead of wilc1000.
>>>>
>>>> And the global variable g_linux_wlan will be placed in netdevice
>>>> private data
>>>> and finally it will be removed. I already posted some of those
>>>> patches.
>>> I couldn't find the patches anywhere, but I've updated my series now
>>> to rename the symbols to wilc_* and to remove most but not all
>>> references to
>>> g_linux_wlan (or wilc_dev after my rename). Do you want me to post
>>> those
>>> so you can integrate them, or should I have a look at what you sent
>>> first
>>> (please send me a copy then).
>>
>> Hi arnd,
>>
>> I have tested with all the patches you have posted but it does not
>> works. firmware start timed out
>> in the function wilc1000_start_firmware.
>> I also have tested with all the patched without last one, [RFC] one,
>> but it shows
>> Segmentation fault when insmod driver.
>> For now, I can't rebase the patches. I'd appreciate if you could help
>> us.
>>
>> The title of my first patch is,
>> [PATCH 01/13] staging: wilc1000: add wilc to netdev private data
>> structure
>> and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
>> ( The patches posted by [email protected] )
>>
>> By the way, deleting feature COMPLEMENT_BOOT patch already posted but
>> not yet accepted.
>>
>> Thank you.
>> Glen.
>>
>>> Arnd
>>
>


2015-10-21 10:04:35

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

Hi arnd,

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

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

Thanks,
Glen.


On 2015년 10월 21일 07:47, Arnd Bergmann wrote:
> After I screwed up two or three times trying to get the dependencies
> with the SPI and SDIO backends right, I ended up taking the time
> to do the real fix and make both coexist.
>
> This is a series of patches that address various issues with the
> driver, but is mainly targetted at splitting out the spi and sdio
> backends into separate drivers that can be built independent of
> one another.
>
> The last patch is more experimental than the others, hence the
> [RFC] annotation.
>
> Please review and test.
>
> Arnd
>
> Arnd Bergmann (19):
> staging/wilc1000: remove unused functions
> staging/wilc1000: make symbols static if possible
> staging/wilc1000: use proper naming for global symbols
> staging/wilc1000: move extern declarations to headers
> staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
> staging/wilc1000: avoid static definitions in header
> staging/wilc1000: remove linux_wlan_{device_power,device_detection}
> staging/wilc1000: move wilc_wlan_inp_t into struct wilc
> staging/wilc1000: move init/exit functions to driver files
> staging/wilc1000: unify device pointer
> staging/wilc1000: move wilc1000_ops to drivers
> staging/wilc1000: use device pointer for phy creation
> staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
> staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
> staging/wilc1000: turn enable_irq/disable_irq into callbacks
> staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
> staging/wilc1000: pass hif operations through initialization
> staging/wilc1000: split out bus specific modules
> [RFC] staging/wilc1000: use more regular probing
>
> drivers/staging/wilc1000/Kconfig | 66 +-
> drivers/staging/wilc1000/Makefile | 16 +-
> drivers/staging/wilc1000/coreconfigurator.c | 12 +-
> drivers/staging/wilc1000/coreconfigurator.h | 12 +-
> drivers/staging/wilc1000/host_interface.c | 501 +++-------------
> drivers/staging/wilc1000/host_interface.h | 349 ++---------
> drivers/staging/wilc1000/linux_mon.c | 11 +-
> drivers/staging/wilc1000/linux_wlan.c | 695 +++++++---------------
> drivers/staging/wilc1000/linux_wlan_common.h | 18 +-
> drivers/staging/wilc1000/linux_wlan_sdio.c | 202 +++++--
> drivers/staging/wilc1000/linux_wlan_sdio.h | 14 -
> drivers/staging/wilc1000/linux_wlan_spi.c | 119 ++--
> drivers/staging/wilc1000/linux_wlan_spi.h | 8 -
> drivers/staging/wilc1000/wilc_debugfs.c | 20 +-
> drivers/staging/wilc1000/wilc_sdio.c | 213 +++----
> drivers/staging/wilc1000/wilc_spi.c | 276 +--------
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++++++--------
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 87 +--
> drivers/staging/wilc1000/wilc_wfi_netdevice.h | 21 +-
> drivers/staging/wilc1000/wilc_wlan.c | 180 +++---
> drivers/staging/wilc1000/wilc_wlan.h | 49 +-
> drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
> drivers/staging/wilc1000/wilc_wlan_if.h | 23 +-
> 23 files changed, 1171 insertions(+), 2222 deletions(-)
> delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h
>


2015-10-21 14:20:58

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] fixup! staging/wilc1000: split out bus specific modules

The patch to split out bus modules causes new valid build warnings without this.

Signed-off-by: Arnd Bergmann <[email protected]>

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..fe3b464f0d5c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,7 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
}
EXPORT_SYMBOL_GPL(wilc_netdev_init);

-void __init wilc1000_init_driver(void)
+void wilc1000_init_driver(void)
{
#if defined(WILC_DEBUGFS)
if (wilc_debugfs_init() < 0)
@@ -1606,7 +1606,7 @@ void __init wilc1000_init_driver(void)
}
EXPORT_SYMBOL_GPL(wilc1000_init_driver);

-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
{
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,7 +1653,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
}
EXPORT_SYMBOL_GPL(wilc_netdev_free);

-void __exit wilc1000_exit_driver(void)
+void wilc1000_exit_driver(void)
{
kfree(wilc1000_dev);
wilc1000_dev = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..b460b7f6971a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);

void wilc_handle_isr(void);

@@ -340,7 +340,7 @@ extern bool wilc1000_enable_ps;
int wilc1000_firmware_download(struct wilc *p_nic);
int wilc1000_start_firmware(struct wilc_per_interface *nic);

-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
+void wilc1000_init_driver(void);
+void wilc1000_exit_driver(void);

#endif




2015-10-20 22:48:10

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 09/19] staging/wilc1000: move init/exit functions to driver files

The driver interfaces are in linux_wlan_sdio.c and linux_wlan_spi.c, so
this is where the init and exit functions should be. Splitting this up
enables further cleanups, including eventually allowing both modules
to be built together.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 49 +++++++-----------------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 14 +++++++++
drivers/staging/wilc1000/linux_wlan_spi.c | 16 ++++++++++
drivers/staging/wilc1000/wilc_wlan.h | 4 +++
4 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 53cecb892a84..caa85442c12d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1725,59 +1725,38 @@ int wilc_netdev_init(void)
return 0;
}

-/*The 1st function called after module inserted*/
-static int __init init_wilc_driver(void)
+void __init wilc1000_init_driver(void)
{
#if defined(WILC_DEBUGFS)
- if (wilc_debugfs_init() < 0) {
+ if (wilc_debugfs_init() < 0)
PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
- return -1;
- }
#endif

printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-
-#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())
- PRINT_ER("Couldn't initialize netdev\n");
- return 0;
-#endif
}
-late_initcall(init_wilc_driver);

-static void __exit exit_wilc_driver(void)
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
{
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
#define CLOSE_TIMEOUT (12 * 1000)

- if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+ wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
unregister_inetaddr_notifier(&g_dev_notifier);

for (i = 0; i < NUM_CONCURRENT_IFC; i++)
nic[i] = netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}

- if ((wilc1000_dev != NULL) && wilc1000_dev->wilc_firmware != NULL) {
+ if (wilc1000_dev->wilc_firmware) {
release_firmware(wilc1000_dev->wilc_firmware);
wilc1000_dev->wilc_firmware = NULL;
}

- if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+ wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
PRINT_D(INIT_DBG, "Waiting for wilc1000_mac_close ....\n");

if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
@@ -1801,15 +1780,10 @@ static void __exit exit_wilc_driver(void)
free_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}
}
+}

-#ifndef WILC_SDIO
- PRINT_D(INIT_DBG, "SPI unregsiter...\n");
- spi_unregister_driver(&wilc_bus);
-#else
- PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
- sdio_unregister_driver(&wilc_bus);
-#endif
-
+void __exit wilc1000_exit_driver(void)
+{
kfree(wilc1000_dev);
wilc1000_dev = NULL;
printk("Module_exit Done.\n");
@@ -1818,6 +1792,5 @@ static void __exit exit_wilc_driver(void)
wilc_debugfs_remove();
#endif
}
-module_exit(exit_wilc_driver);

MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4e8c4e6d499e..badcae57875c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -237,4 +237,18 @@ int wilc1000_sdio_set_default_speed(void)
}


+static int __init init_wilc_sdio_driver(void)
+{
+ wilc1000_init_driver();
+ return sdio_register_driver(&wilc_bus);
+}
+late_initcall(init_wilc_sdio_driver);

+static void __exit exit_wilc_sdio_driver(void)
+{
+ if (wilc1000_dev)
+ wilc_netdev_free(wilc1000_dev);
+ sdio_unregister_driver(&wilc_bus);
+ wilc1000_exit_driver();
+}
+module_exit(exit_wilc_sdio_driver);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 43cfeda97030..c90b741824dc 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -406,3 +406,19 @@ int wilc1000_spi_set_max_speed(void)
PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED);
return 1;
}
+
+static int __init init_wilc_spi_driver(void)
+{
+ wilc1000_init_driver();
+ return wilc_netdev_init();
+}
+late_initcall(init_wilc_spi_driver);
+
+static void __exit exit_wilc_spi_driver(void)
+{
+ if (wilc1000_dev)
+ wilc_netdev_free(wilc1000_dev);
+ spi_unregister_driver(&wilc_bus);
+ wilc1000_exit_driver();
+}
+module_exit(exit_wilc_spi_driver);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 4460c482cb7a..dd312b0b1abf 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -321,6 +321,8 @@ void wilc1000_chip_sleep_manually(u32 u32SleepTime);
int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
int wilc_netdev_init(void);
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+
void wilc_handle_isr(void);

u16 wilc1000_set_machw_change_vir_if(bool bValue);
@@ -337,5 +339,7 @@ u8 wilc1000_core_11b_ready(void);
extern bool wilc1000_enable_ps;
extern volatile int wilc1000_probe;

+void __init wilc1000_init_driver(void);
+void __exit wilc1000_exit_driver(void);

#endif
--
2.1.0.rc2


2015-10-20 22:48:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 10/19] staging/wilc1000: unify device pointer

struct wilc has two pointers to store the device, one for sdio_func
and one for spi_device. By changing the pointer to a 'struct device',
we can simplify the logic and avoid a few #ifdefs.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 29 +++++----------------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 5 +++--
drivers/staging/wilc1000/linux_wlan_spi.c | 17 +++++++++++++++-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 6 +-----
4 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index caa85442c12d..4ca045bcf537 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -474,19 +474,11 @@ int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic)
/* the firmare should be located in /lib/firmware in
* root file system with the name specified above */

-#ifdef WILC_SDIO
- if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_sdio_func->dev) != 0) {
+ if (request_firmware(&wilc_firmware, firmware, wilc1000_dev->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
-#else
- if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_spidev->dev) != 0) {
- PRINT_ER("%s - firmare not available\n", firmware);
- ret = -1;
- goto _fail_;
- }
-#endif
wilc1000_dev->wilc_firmware = wilc_firmware;

_fail_:
@@ -1008,7 +1000,7 @@ static u8 wilc1000_prepare_11b_core(struct wilc *nic)
while (!wilc1000_probe)
msleep(100);
wilc1000_probe = 0;
- wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+ wilc1000_dev->dev = &wilc1000_sdio_func->dev;
nic->ops = &wilc1000_sdio_ops;
wilc_wlan_init(nic);
}
@@ -1031,7 +1023,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
while (!wilc1000_probe)
msleep(100);
wilc1000_probe = 0;
- wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+ wilc1000_dev->dev = &wilc1000_sdio_func->dev;
wilc1000_dev->ops = &wilc1000_sdio_ops;
ret = wilc_wlan_init(wilc1000_dev);

@@ -1214,12 +1206,11 @@ int wilc1000_mac_open(struct net_device *ndev)
int i = 0;
struct wilc_priv *priv;

-#ifdef WILC_SPI
- if (!wilc1000_dev || !wilc1000_dev->wilc_spidev) {
+ if (!wilc1000_dev || !wilc1000_dev->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
-#endif
+
nic = netdev_priv(ndev);
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1712,16 +1703,6 @@ int wilc_netdev_init(void)

}

- #ifndef WILC_SDIO
- if (!wilc1000_spi_init(&wilc1000_dev->wilc_spidev)) {
- PRINT_ER("Can't initialize SPI\n");
- return -1; /* ERROR */
- }
- wilc1000_dev->wilc_spidev = wilc_spi_dev;
- #else
- wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
- #endif
-
return 0;
}

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index badcae57875c..a6ae26739dd8 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -46,7 +46,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)

int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
{
- struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+ struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
int ret;
u8 data;

@@ -78,7 +78,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)

int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
{
- struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+ struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
int size, ret;

sdio_claim_host(func);
@@ -126,6 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
+ wilc1000_dev->dev = &wilc1000_sdio_func->dev;

printk("Driver Initializing success\n");
return 0;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index c90b741824dc..b5e9a1b9f509 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -9,8 +9,11 @@
#include <linux/device.h>
#include <linux/spi/spi.h>

+#include "wilc_wfi_netdevice.h"
#include "linux_wlan_common.h"
#include "linux_wlan_spi.h"
+#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"

#define USE_SPI_DMA 0 /* johnny add */

@@ -409,8 +412,20 @@ int wilc1000_spi_set_max_speed(void)

static int __init init_wilc_spi_driver(void)
{
+ int ret;
+
wilc1000_init_driver();
- return wilc_netdev_init();
+ ret = wilc_netdev_init();
+ if (ret)
+ return ret;
+
+ if (!wilc1000_spi_init(NULL)) {
+ PRINT_ER("Can't initialize SPI\n");
+ return -ENXIO;
+ }
+ wilc1000_dev->dev = &wilc_spi_dev->dev;
+
+ return ret;
}
late_initcall(init_wilc_spi_driver);

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 485df4768e78..1e5e7dcee11d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -185,11 +185,7 @@ struct wilc {

const struct firmware *wilc_firmware;

-#ifdef WILC_SDIO
- struct sdio_func *wilc_sdio_func;
-#else
- struct spi_device *wilc_spidev;
-#endif
+ struct device *dev;
};

typedef struct {
--
2.1.0.rc2


2015-10-20 22:48:10

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 04/19] staging/wilc1000: move extern declarations to headers

'extern' declarations belong into a header file rather than
a .c file, to ensure that the definition matches the declaration.

This moves all declarations into a header file that seems
most appropriate for it.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 10 +-------
drivers/staging/wilc1000/host_interface.h | 10 ++++++++
drivers/staging/wilc1000/linux_mon.c | 3 ---
drivers/staging/wilc1000/linux_wlan.c | 16 -------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 3 ---
drivers/staging/wilc1000/linux_wlan_spi.c | 1 -
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +-----------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 1 -
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 ++++
drivers/staging/wilc1000/wilc_wlan.c | 9 +------
drivers/staging/wilc1000/wilc_wlan.h | 29 ++++++++++++++++++++++-
11 files changed, 45 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c8c5f5c602c7..99c78d395653 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4,16 +4,11 @@
#include <linux/delay.h>
#include "host_interface.h"
#include "coreconfigurator.h"
+#include "wilc_wlan.h"
#include "wilc_wlan_if.h"
#include "wilc_msgqueue.h"
#include <linux/etherdevice.h>

-extern u8 wilc1000_connecting;
-
-extern struct timer_list wilc1000_during_ip_timer;
-
-extern u8 wilc1000_initialized;
-
#define HOST_IF_MSG_SCAN 0
#define HOST_IF_MSG_CONNECT 1
#define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2
@@ -268,9 +263,6 @@ static struct host_if_drv *join_req_drv;

static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);

-extern void wilc1000_chip_sleep_manually(u32 u32SleepTime);
-extern int wilc1000_wlan_get_num_conn_ifcs(void);
-
static int add_handler_in_list(struct host_if_drv *handler)
{
int i;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 826ed0f30615..1f537ed9d7f3 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -925,4 +925,14 @@ void wilc1000_free_join_params(void *pJoinParams);

s32 wilc1000_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);

+void wilc1000_resolve_disconnect_aberration(struct host_if_drv *drvHandler);
+
+extern bool wilc1000_optaining_ip;
+extern u8 wilc1000_connected_SSID[6];
+extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc1000_connecting;
+extern u8 wilc1000_initialized;
+extern struct timer_list wilc1000_during_ip_timer;
+
#endif
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 52443f039a43..50196c3aa61d 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr {

static struct net_device *wilc_wfi_mon; /* global monitor netdev */

-extern int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
static u8 srcAdd[6];
static u8 bssid[6];
static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index be4b1b1199f8..50477d70eb24 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,13 +45,6 @@
#define _linux_wlan_device_removal() {}
#endif

-extern bool wilc1000_optaining_ip;
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-extern void wilc1000_resolve_disconnect_aberration(void *drvHandler);
-extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
-extern struct timer_list wilc1000_during_ip_timer;
-
static int linux_wlan_device_power(int on_off)
{
PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
@@ -98,14 +91,9 @@ static struct semaphore close_exit_sync;

static int wlan_deinit_locks(struct wilc *nic);
static void wlan_deinitialize_threads(struct wilc *nic);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);

static void linux_wlan_tx_complete(void *priv, int status);
static int mac_init_fn(struct net_device *ndev);
-int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc1000_mac_open(struct net_device *ndev);
-int wilc1000_mac_close(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);
@@ -1047,11 +1035,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)

#ifdef COMPLEMENT_BOOT

-extern volatile int wilc1000_probe;
-extern u8 wilc1000_core_11b_ready(void);
-
#define READY_CHECK_THRESHOLD 30
-extern void wilc_wlan_global_reset(void);
static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
{
u8 trials = 0;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 470f4bf372f1..4e8c4e6d499e 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -23,9 +23,6 @@


struct sdio_func *wilc1000_sdio_func;
-extern int wilc_netdev_init(void);
-extern void wilc_handle_isr(void);
-
static unsigned int sdio_default_speed;

#define SDIO_VENDOR_ID_WILC 0x0296
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 8d8310681658..43cfeda97030 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -42,7 +42,6 @@
static u32 SPEED = MIN_SPEED;

struct spi_device *wilc_spi_dev;
-void wilc1000_spi_deinit(void *vp);

static int __init wilc_bus_probe(struct spi_device *spi)
{
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 672741632f85..0ed05aafa5bf 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -14,6 +14,7 @@
#ifdef WILC_SDIO
#include "linux_wlan_sdio.h"
#endif
+#include "host_interface.h"
#include <linux/errno.h>

#define IS_MANAGMEMENT 0x100
@@ -21,21 +22,13 @@
#define IS_MGMT_STATUS_SUCCES 0x040
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)

-extern int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-extern int wilc1000_mac_open(struct net_device *ndev);
-extern int wilc1000_mac_close(struct net_device *ndev);
-
static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
static u32 u32LastScannedNtwrksCountShadow;
struct timer_list wilc1000_during_ip_timer;
static struct timer_list hAgingTimer;
static u8 op_ifcs;
-extern u8 wilc1000_connected_SSID[6];

u8 wilc1000_initialized = 1;
-extern bool wilc1000_optaining_ip;

#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
@@ -473,8 +466,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
}


-int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
-

/**
* @brief CfgConnectResult
@@ -2156,7 +2147,6 @@ static void WILC_WFI_add_wilcvendorspec(u8 *buff)
* @date 01 JUL 2012
* @version
*/
-extern bool wilc1000_enable_ps;
static int mgmt_tx(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
@@ -2488,9 +2478,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-void wilc1000_wlan_deinit(struct wilc *nic);
-int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
-
static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
{
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index a87982cfcd4b..ae2aaea508db 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -103,6 +103,5 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,

#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
#define DEFAULT_LINK_SPEED 72
-void wilc1000_enable_tcp_ack_filter(bool value);

#endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 700f6f343b52..28610d889c0c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -206,6 +206,10 @@ struct WILC_WFI_mon_priv {
struct net_device *real_ndev;
};

+int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
+void wilc1000_wlan_deinit(struct wilc *nic);
+int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
+
extern struct wilc *wilc1000_dev;
extern struct net_device *WILC_WFI_devs[];
void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 140778d8aab5..a147547fb66e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -8,6 +8,7 @@
/* //////////////////////////////////////////////////////////////////////////// */

#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_cfg.h"

@@ -16,14 +17,6 @@
* Global
*
********************************************/
-extern wilc_hif_func_t wilc1000_hif_sdio;
-extern wilc_hif_func_t wilc1000_hif_spi;
-extern void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
-u32 wilc_get_chipid(u8 update);
-u16 wilc1000_set_machw_change_vir_if(bool bValue);
-
-
-
typedef struct {
int quit;

diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index bd89689fbf10..64295a664ea9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -1,7 +1,7 @@
#ifndef WILC_WLAN_H
#define WILC_WLAN_H

-
+#include <linux/types.h>

#define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0)

@@ -270,6 +270,9 @@ typedef struct {
void (*hif_set_default_bus_speed)(void);
} wilc_hif_func_t;

+extern wilc_hif_func_t wilc1000_hif_spi;
+extern wilc_hif_func_t wilc1000_hif_sdio;
+
/********************************************
*
* Configuration Structure
@@ -309,4 +312,28 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
wilc_tx_complete_func_t func);
+extern void wilc_wlan_global_reset(void);
+
+void wilc1000_enable_tcp_ack_filter(bool value);
+void wilc1000_chip_sleep_manually(u32 u32SleepTime);
+int wilc1000_wlan_get_num_conn_ifcs(void);
+int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
+int wilc_netdev_init(void);
+void wilc_handle_isr(void);
+
+u16 wilc1000_set_machw_change_vir_if(bool bValue);
+
+int wilc1000_mac_open(struct net_device *ndev);
+int wilc1000_mac_close(struct net_device *ndev);
+
+void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
+
+int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
+void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
+u8 wilc1000_core_11b_ready(void);
+
+extern bool wilc1000_enable_ps;
+extern volatile int wilc1000_probe;
+
+
#endif
--
2.1.0.rc2


2015-10-20 22:48:18

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 11/19] staging/wilc1000: move wilc1000_ops to drivers

The two instances of struct wilc1000_ops reference functions that
are defined in just one file each. By moving the operations there,
we can mark all those functions as 'static' and avoid a number
of #ifdefs.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 43 ++++--------------------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 24 ++++++++++++-----
drivers/staging/wilc1000/linux_wlan_sdio.h | 11 +++-----
drivers/staging/wilc1000/linux_wlan_spi.c | 29 +++++++++++++-------
drivers/staging/wilc1000/linux_wlan_spi.h | 8 ------
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
6 files changed, 45 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 4ca045bcf537..aa6f5c7db139 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -26,11 +26,7 @@
#include <linux/version.h>
#include <linux/semaphore.h>

-#ifdef WILC_SDIO
#include "linux_wlan_sdio.h"
-#else
-#include "linux_wlan_spi.h"
-#endif

static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);

@@ -915,30 +911,6 @@ static int wlan_deinit_locks(struct wilc *nic)
return 0;
}

-#ifdef WILC_SDIO
-static const struct wilc1000_ops wilc1000_sdio_ops = {
- .io_type = HIF_SDIO,
- .io_init = wilc1000_sdio_init,
- .io_deinit = wilc1000_sdio_deinit,
- .u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
- .u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
- .u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
- .u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
-};
-#endif
-
-#ifdef WILC_SPI
-static const struct wilc1000_ops wilc1000_spi_ops = {
- .io_type = HIF_SPI,
- .io_init = wilc1000_spi_init,
- .io_deinit = wilc1000_spi_deinit,
- .u.spi.spi_tx = wilc1000_spi_write,
- .u.spi.spi_rx = wilc1000_spi_read,
- .u.spi.spi_trx = wilc1000_spi_write_read,
- .u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
-};
-#endif
-
static int wlan_initialize_threads(perInterface_wlan_t *nic)
{

@@ -1065,12 +1037,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)

wlan_init_locks(wilc1000_dev);

-#ifdef WILC_SDIO
- wilc1000_dev->ops = &wilc1000_sdio_ops;
-#else
- wilc1000_dev->ops = &wilc1000_spi_ops;
-#endif
-
ret = wilc_wlan_init(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
@@ -1622,7 +1588,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
}

-int wilc_netdev_init(void)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
{

int i;
@@ -1636,6 +1602,8 @@ int wilc_netdev_init(void)
if (!wilc1000_dev)
return -ENOMEM;

+ wilc1000_dev->ops = ops;
+
register_inetaddr_notifier(&g_dev_notifier);

for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
@@ -1672,10 +1640,9 @@ int wilc_netdev_init(void)
/*Register WiFi*/
wdev = wilc_create_wiphy(ndev);

- #ifdef WILC_SDIO
/* set netdev, tony */
- SET_NETDEV_DEV(ndev, &wilc1000_sdio_func->dev);
- #endif
+ if (dev)
+ SET_NETDEV_DEV(ndev, dev);

if (wdev == NULL) {
PRINT_ER("Can't register WILC Wiphy\n");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index a6ae26739dd8..429bdc85ed62 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,4 +1,5 @@
#include "wilc_wfi_netdevice.h"
+#include "linux_wlan_sdio.h"

#include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h>
@@ -44,7 +45,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
#endif


-int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
+static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
{
struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
int ret;
@@ -76,7 +77,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
}


-int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
+static int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
{
struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
int size, ret;
@@ -122,7 +123,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
#endif
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc1000_sdio_func = func;
- if (wilc_netdev_init()) {
+ if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
@@ -204,7 +205,7 @@ static int linux_sdio_get_speed(void)
return wilc1000_sdio_func->card->host->ios.clock;
}

-int wilc1000_sdio_init(void *pv)
+static int wilc1000_sdio_init(void *pv)
{

/**
@@ -216,7 +217,7 @@ int wilc1000_sdio_init(void *pv)
return 1;
}

-void wilc1000_sdio_deinit(void *pv)
+static void wilc1000_sdio_deinit(void *pv)
{

/**
@@ -227,16 +228,25 @@ void wilc1000_sdio_deinit(void *pv)
sdio_unregister_driver(&wilc_bus);
}

-int wilc1000_sdio_set_max_speed(void)
+static int wilc1000_sdio_set_max_speed(void)
{
return linux_sdio_set_speed(MAX_SPEED);
}

-int wilc1000_sdio_set_default_speed(void)
+static int wilc1000_sdio_set_default_speed(void)
{
return linux_sdio_set_speed(sdio_default_speed);
}

+const struct wilc1000_ops wilc1000_sdio_ops = {
+ .io_type = HIF_SDIO,
+ .io_init = wilc1000_sdio_init,
+ .io_deinit = wilc1000_sdio_deinit,
+ .u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+ .u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+ .u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+ .u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};

static int __init init_wilc_sdio_driver(void)
{
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index ff0a37b880c2..de79aff9f11c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,14 +1,9 @@
+#include <linux/mmc/sdio_func.h>
+
extern struct sdio_func *wilc1000_sdio_func;
extern struct sdio_driver wilc_bus;
+extern const struct wilc1000_ops wilc1000_sdio_ops;

-#include <linux/mmc/sdio_func.h>
-
-int wilc1000_sdio_init(void *);
-void wilc1000_sdio_deinit(void *);
-int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd);
-int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd);
int wilc1000_sdio_enable_interrupt(void);
void wilc1000_sdio_disable_interrupt(void);
-int wilc1000_sdio_set_max_speed(void);
-int wilc1000_sdio_set_default_speed(void);

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index b5e9a1b9f509..788531e314c3 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -11,7 +11,6 @@

#include "wilc_wfi_netdevice.h"
#include "linux_wlan_common.h"
-#include "linux_wlan_spi.h"
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"

@@ -83,7 +82,7 @@ struct spi_driver wilc_bus __refdata = {
};


-void wilc1000_spi_deinit(void *vp)
+static void wilc1000_spi_deinit(void *vp)
{

spi_unregister_driver(&wilc_bus);
@@ -95,7 +94,7 @@ void wilc1000_spi_deinit(void *vp)



-int wilc1000_spi_init(void *vp)
+static int wilc1000_spi_init(void *vp)
{
int ret = 1;
static int called;
@@ -118,7 +117,7 @@ int wilc1000_spi_init(void *vp)

#if defined(TXRX_PHASE_SIZE)

-int wilc1000_spi_write(u8 *b, u32 len)
+static int wilc1000_spi_write(u8 *b, u32 len)
{
int ret;

@@ -195,7 +194,7 @@ int wilc1000_spi_write(u8 *b, u32 len)
}

#else
-int wilc1000_spi_write(u8 *b, u32 len)
+static int wilc1000_spi_write(u8 *b, u32 len)
{

int ret;
@@ -246,7 +245,7 @@ int wilc1000_spi_write(u8 *b, u32 len)

#if defined(TXRX_PHASE_SIZE)

-int wilc1000_spi_read(u8 *rb, u32 rlen)
+static int wilc1000_spi_read(u8 *rb, u32 rlen)
{
int ret;

@@ -320,7 +319,7 @@ int wilc1000_spi_read(u8 *rb, u32 rlen)
}

#else
-int wilc1000_spi_read(u8 *rb, u32 rlen)
+static int wilc1000_spi_read(u8 *rb, u32 rlen)
{

int ret;
@@ -365,7 +364,7 @@ int wilc1000_spi_read(u8 *rb, u32 rlen)

#endif

-int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
{

int ret;
@@ -402,7 +401,7 @@ int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
return ret;
}

-int wilc1000_spi_set_max_speed(void)
+static int wilc1000_spi_set_max_speed(void)
{
SPEED = MAX_SPEED;

@@ -410,12 +409,22 @@ int wilc1000_spi_set_max_speed(void)
return 1;
}

+static const struct wilc1000_ops wilc1000_spi_ops = {
+ .io_type = HIF_SPI,
+ .io_init = wilc1000_spi_init,
+ .io_deinit = wilc1000_spi_deinit,
+ .u.spi.spi_tx = wilc1000_spi_write,
+ .u.spi.spi_rx = wilc1000_spi_read,
+ .u.spi.spi_trx = wilc1000_spi_write_read,
+ .u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
+
static int __init init_wilc_spi_driver(void)
{
int ret;

wilc1000_init_driver();
- ret = wilc_netdev_init();
+ ret = wilc_netdev_init(NULL, &wilc1000_spi_ops);
if (ret)
return ret;

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index efa95e3e8bfe..aa259c8ee12a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -2,13 +2,5 @@
#define LINUX_WLAN_SPI_H

#include <linux/spi/spi.h>
-extern struct spi_device *wilc_spi_dev;
-extern struct spi_driver wilc_bus;

-int wilc1000_spi_init(void *vp);
-void wilc1000_spi_deinit(void *vp);
-int wilc1000_spi_write(u8 *b, u32 len);
-int wilc1000_spi_read(u8 *rb, u32 rlen);
-int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
-int wilc1000_spi_set_max_speed(void);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index dd312b0b1abf..8c5253cce97c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ void wilc1000_enable_tcp_ack_filter(bool value);
void wilc1000_chip_sleep_manually(u32 u32SleepTime);
int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(void);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops);
void __exit wilc_netdev_free(struct wilc *wilc1000_dev);

void wilc_handle_isr(void);
--
2.1.0.rc2


2015-10-20 22:48:13

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros

The last remaining user of WILC_SDIO macro checks for the correct
time to wait in an interrupt for the PLL to settle. We can
replace this with a runtime check and remove both WILC_SDIO and
WILC_SPI, as we no longer need conditional compilation based on
the hardware type.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/Makefile | 3 +--
drivers/staging/wilc1000/wilc_wlan.c | 5 ++++-
drivers/staging/wilc1000/wilc_wlan.h | 7 ++-----
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index b96fee8f94f2..9ce30e92ea3a 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
obj-$(CONFIG_WILC1000) += wilc1000.o

-ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
+ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT

ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index d12a4e7df32c..038c9b2eee6c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1238,7 +1238,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);

/* Waiting for PLL */
- mdelay(WILC_PLL_TO);
+ if (g_wlan.io_func->io_type == HIF_SDIO)
+ mdelay(WILC_PLL_TO_SDIO);
+ else
+ mdelay(WILC_PLL_TO_SPI);

/* poll till read a valid data */
while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2e9b5d50ff7e..2f636534fc5d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -143,11 +143,8 @@
#define WILC_CFG_RSP_STATUS 2
#define WILC_CFG_RSP_SCAN 3

-#ifdef WILC_SDIO
-#define WILC_PLL_TO 4
-#else
-#define WILC_PLL_TO 2
-#endif
+#define WILC_PLL_TO_SDIO 4
+#define WILC_PLL_TO_SPI 2


#define ABORT_INT BIT(31)
--
2.1.0.rc2


2015-10-20 22:48:13

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c

The COMPLEMENT_BOOT code is used only for SDIO and is aware of
details of the SDIO implementation that don't belong into
the common linux_wlan.c file.

This moves the functions to linux_wlan_sdio.c to get them out of
the way.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 95 +++------------------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 89 +++++++++++++++++++++++--
drivers/staging/wilc1000/linux_wlan_sdio.h | 4 --
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 4 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 5 ++
6 files changed, 103 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index abcb70bb1bd7..980c2c8d300d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -483,11 +483,7 @@ _fail_:

}

-#ifdef COMPLEMENT_BOOT
-static int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
-static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
+int wilc1000_start_firmware(perInterface_wlan_t *nic)
{

int ret = 0;
@@ -502,19 +498,17 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
/* wait for mac ready */
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = linux_wlan_lock_timeout(&wilc1000_dev->sync_event, 5000);
- if (ret) {
-#ifdef COMPLEMENT_BOOT
+ if (ret && wilc1000_dev->ops->repeat_power_cycle) {
static int timeout = 5;

if (timeout--) {
PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
- ret = repeat_power_cycle(nic);
+ ret = wilc1000_dev->ops->repeat_power_cycle(nic);
} else {
timeout = 5;
ret = -1;
goto _fail_;
}
-#endif
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
}
@@ -527,7 +521,8 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
_fail_:
return ret;
}
-static int linux_wlan_firmware_download(struct wilc *p_nic)
+
+int wilc1000_firmware_download(struct wilc *p_nic)
{

int ret = 0;
@@ -954,77 +949,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
}
}

-#ifdef COMPLEMENT_BOOT
-
-#define READY_CHECK_THRESHOLD 30
-static u8 wilc1000_prepare_11b_core(struct wilc *nic)
-{
- u8 trials = 0;
-
- while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
- PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
- wilc_wlan_cleanup();
- wilc_wlan_global_reset();
- sdio_unregister_driver(&wilc_bus);
-
- sdio_register_driver(&wilc_bus);
-
- while (!wilc1000_probe)
- msleep(100);
- wilc1000_probe = 0;
- wilc1000_dev->dev = &wilc1000_sdio_func->dev;
- nic->ops = &wilc1000_sdio_ops;
- wilc_wlan_init(nic);
- }
-
- if (READY_CHECK_THRESHOLD <= trials)
- return 1;
- else
- return 0;
-
-}
-
-static int repeat_power_cycle(perInterface_wlan_t *nic)
-{
- int ret = 0;
- sdio_unregister_driver(&wilc_bus);
-
- sdio_register_driver(&wilc_bus);
-
- /* msleep(1000); */
- while (!wilc1000_probe)
- msleep(100);
- wilc1000_probe = 0;
- wilc1000_dev->dev = &wilc1000_sdio_func->dev;
- wilc1000_dev->ops = &wilc1000_sdio_ops;
- ret = wilc_wlan_init(wilc1000_dev);
-
- wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
- #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- wilc1000_sdio_enable_interrupt();
- #endif
-
- if (wilc1000_wlan_get_firmware(nic)) {
- PRINT_ER("Can't get firmware\n");
- ret = -1;
- goto __fail__;
- }
-
- /*Download firmware*/
- ret = linux_wlan_firmware_download(wilc1000_dev);
- if (ret < 0) {
- PRINT_ER("Failed to download firmware\n");
- goto __fail__;
- }
- /* Start firmware*/
- ret = linux_wlan_start_firmware(nic);
- if (ret < 0)
- PRINT_ER("Failed to start firmware\n");
-__fail__:
- return ret;
-}
-#endif
-
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
perInterface_wlan_t *nic = p_nic;
@@ -1051,13 +975,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_wilc_wlan_;
}

-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
- if (wilc1000_prepare_11b_core(wilc1000_dev)) {
+ if (wilc1000_dev->ops->prepare_11b_core &&
+ wilc1000_dev->ops->prepare_11b_core(wilc1000_dev)) {
PRINT_ER("11b Core is not ready\n");
ret = -EIO;
goto _fail_threads_;
}
-#endif

#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
if (init_irq(wilc1000_dev)) {
@@ -1082,7 +1005,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

/*Download firmware*/
- ret = linux_wlan_firmware_download(wilc1000_dev);
+ ret = wilc1000_firmware_download(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1090,7 +1013,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

/* Start firmware*/
- ret = linux_wlan_start_firmware(nic);
+ ret = wilc1000_start_firmware(nic);
if (ret < 0) {
PRINT_ER("Failed to start firmware\n");
ret = -EIO;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 429bdc85ed62..bb4a3acf16d0 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,6 @@
#include "wilc_wfi_netdevice.h"
#include "linux_wlan_sdio.h"
+#include "wilc_wfi_netdevice.h"

#include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h>
@@ -23,7 +24,7 @@
#endif


-struct sdio_func *wilc1000_sdio_func;
+static struct sdio_func *wilc1000_sdio_func;
static unsigned int sdio_default_speed;

#define SDIO_VENDOR_ID_WILC 0x0296
@@ -108,7 +109,83 @@ static int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
return 1;
}

-volatile int wilc1000_probe; /* COMPLEMENT_BOOT */
+static const struct wilc1000_ops wilc1000_sdio_ops;
+
+#ifdef COMPLEMENT_BOOT
+/* FIXME: remove all of COMPLEMENT_BOOT */
+
+static struct sdio_driver wilc_bus;
+static volatile int wilc1000_probe;
+
+#define READY_CHECK_THRESHOLD 30
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
+{
+ u8 trials = 0;
+
+ while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
+ PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
+ wilc_wlan_cleanup();
+ wilc_wlan_global_reset();
+ sdio_unregister_driver(&wilc_bus);
+
+ sdio_register_driver(&wilc_bus);
+
+ while (!wilc1000_probe)
+ msleep(100);
+ wilc1000_probe = 0;
+ wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+ nic->ops = &wilc1000_sdio_ops;
+ wilc_wlan_init(nic);
+ }
+
+ if (READY_CHECK_THRESHOLD <= trials)
+ return 1;
+ else
+ return 0;
+
+}
+
+static int repeat_power_cycle(perInterface_wlan_t *nic)
+{
+ int ret = 0;
+ sdio_unregister_driver(&wilc_bus);
+
+ sdio_register_driver(&wilc_bus);
+
+ /* msleep(1000); */
+ while (!wilc1000_probe)
+ msleep(100);
+ wilc1000_probe = 0;
+ wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+ wilc1000_dev->ops = &wilc1000_sdio_ops;
+ ret = wilc_wlan_init(wilc1000_dev);
+
+ wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
+#if !defined WILC_SDIO_IRQ_GPIO
+ wilc1000_sdio_enable_interrupt();
+#endif
+
+ if (wilc1000_wlan_get_firmware(nic)) {
+ PRINT_ER("Can't get firmware\n");
+ ret = -1;
+ goto __fail__;
+ }
+
+ /*Download firmware*/
+ ret = wilc1000_firmware_download(wilc1000_dev);
+ if (ret < 0) {
+ PRINT_ER("Failed to download firmware\n");
+ goto __fail__;
+ }
+ /* Start firmware*/
+ ret = wilc1000_start_firmware(nic);
+ if (ret < 0)
+ PRINT_ER("Failed to start firmware\n");
+__fail__:
+ return ret;
+}
+#endif
+
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
PRINT_D(INIT_DBG, "probe function\n");
@@ -141,7 +218,7 @@ static void linux_sdio_remove(struct sdio_func *func)

}

-struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc_bus = {
.name = SDIO_MODALIAS,
.id_table = wilc_sdio_ids,
.probe = linux_sdio_probe,
@@ -238,10 +315,14 @@ static int wilc1000_sdio_set_default_speed(void)
return linux_sdio_set_speed(sdio_default_speed);
}

-const struct wilc1000_ops wilc1000_sdio_ops = {
+static const struct wilc1000_ops wilc1000_sdio_ops = {
.io_type = HIF_SDIO,
.io_init = wilc1000_sdio_init,
.io_deinit = wilc1000_sdio_deinit,
+#ifdef COMPLEMENT_BOOT
+ .repeat_power_cycle = repeat_power_cycle,
+ .prepare_11b_core = wilc1000_prepare_11b_core,
+#endif
.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index de79aff9f11c..b4995a3211c7 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,9 +1,5 @@
#include <linux/mmc/sdio_func.h>

-extern struct sdio_func *wilc1000_sdio_func;
-extern struct sdio_driver wilc_bus;
-extern const struct wilc1000_ops wilc1000_sdio_ops;
-
int wilc1000_sdio_enable_interrupt(void);
void wilc1000_sdio_disable_interrupt(void);

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1e5e7dcee11d..ec5a8b1215b7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -188,7 +188,7 @@ struct wilc {
struct device *dev;
};

-typedef struct {
+typedef struct wilc_per_interface {
u8 u8IfIdx;
u8 iftype;
int monitor_flag;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2297e31b5b75..10b2a2f9e1b2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -338,7 +338,9 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
u8 wilc1000_core_11b_ready(void);

extern bool wilc1000_enable_ps;
-extern volatile int wilc1000_probe;
+
+int wilc1000_firmware_download(struct wilc *p_nic);
+int wilc1000_start_firmware(struct wilc_per_interface *nic);

void __init wilc1000_init_driver(void);
void __exit wilc1000_exit_driver(void);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index bfa1291e22ed..a4befcb74c82 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -71,10 +71,15 @@ typedef struct {
u32 block_size;
} sdio_cmd53_t;

+struct wilc;
+struct wilc_per_interface;
struct wilc1000_ops {
int io_type;
int (*io_init)(void *);
void (*io_deinit)(void *);
+ int (*repeat_power_cycle)(struct wilc_per_interface *nic);
+ u8 (*prepare_11b_core)(struct wilc *nic);
+
union {
struct {
int (*sdio_cmd52)(sdio_cmd52_t *);
--
2.1.0.rc2


2015-10-20 22:48:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

Whether the SDIO function uses an internal or external interrupt
should not be a compiletime decision but be determined at runtime.

This changes the code to pass a GPIO number from the init code
as early as possible, and leaves just one #ifdef WILC_SDIO_IRQ_GPIO
to preserve the previous behavior.

All other locations that check for the interrupt method are turned
into runtime checks based on the gpio number (>=0) or the interrupt
number (>0).

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/Makefile | 1 -
drivers/staging/wilc1000/linux_wlan.c | 66 +++++++---------
drivers/staging/wilc1000/linux_wlan_sdio.c | 26 ++++---
drivers/staging/wilc1000/linux_wlan_spi.c | 2 +-
drivers/staging/wilc1000/wilc_sdio.c | 105 +++++++++++---------------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 5 +-
drivers/staging/wilc1000/wilc_wlan.c | 8 +-
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
8 files changed, 94 insertions(+), 121 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 55b2ac2b15a8..b96fee8f94f2 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
obj-$(CONFIG_WILC1000) += wilc1000.o

ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI

ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 980c2c8d300d..beafc543aac3 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -170,7 +170,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event

}

-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
static irqreturn_t isr_uh_routine(int irq, void *user_data)
{
PRINT_D(INT_DBG, "Interrupt received UH\n");
@@ -208,16 +207,16 @@ static int init_irq(struct wilc *p_nic)

/*initialize GPIO and register IRQ num*/
/*GPIO request*/
- if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
- (gpio_direction_input(GPIO_NUM) == 0)) {
+ if ((gpio_request(nic->gpio, "WILC_INTR") == 0) &&
+ (gpio_direction_input(nic->gpio) == 0)) {
#if defined(CUSTOMER_PLATFORM)
/*
TODO : save the registerd irq number to the private wilc context in kernel.
*
- * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ * ex) nic->dev_irq_num = gpio_to_irq(nic->gpio);
*/
#else
- nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ nic->dev_irq_num = gpio_to_irq(nic->gpio);
#endif
} else {
ret = -1;
@@ -228,28 +227,25 @@ static int init_irq(struct wilc *p_nic)
IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
"WILC_IRQ", nic)) < 0) {

- PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+ PRINT_ER("Failed to request IRQ for GPIO: %d\n", nic->gpio);
ret = -1;
} else {

PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
- nic->dev_irq_num, GPIO_NUM);
+ nic->dev_irq_num, nic->gpio);
}

return ret;
}
-#endif

static void deinit_irq(struct wilc *nic)
{
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
/* Deintialize IRQ */
- if (&nic->dev_irq_num != 0) {
+ if (nic->gpio >= 0 && &nic->dev_irq_num != 0) {
free_irq(nic->dev_irq_num, wilc1000_dev);

- gpio_free(GPIO_NUM);
+ gpio_free(nic->gpio);
}
-#endif
}

/*
@@ -830,11 +826,11 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#endif

PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
- mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
- mutex_unlock(&wilc1000_dev->hif_cs);
-#endif
+ if (wilc1000_dev->gpio < 0) {
+ mutex_lock(&wilc1000_dev->hif_cs);
+ wilc1000_sdio_disable_interrupt();
+ mutex_unlock(&wilc1000_dev->hif_cs);
+ }
if (&wilc1000_dev->txq_event != NULL)
up(&wilc1000_dev->txq_event);

@@ -848,14 +844,13 @@ void wilc1000_wlan_deinit(struct wilc *nic)

PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup();
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
- PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
- mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
- mutex_unlock(&wilc1000_dev->hif_cs);
- #endif
+#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
+ if (wilc1000_dev->gpio < 0) {
+ PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
+
+ mutex_lock(&wilc1000_dev->hif_cs);
+ wilc1000_sdio_disable_interrupt();
+ mutex_unlock(&wilc1000_dev->hif_cs);
#endif

/*De-Initialize locks*/
@@ -982,21 +977,17 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_threads_;
}

-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(wilc1000_dev)) {
+ if (wilc1000_dev->gpio >= 0 && init_irq(wilc1000_dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_threads_;
}
-#endif

-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- if (wilc1000_sdio_enable_interrupt()) {
+ if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}
-#endif

if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
@@ -1048,14 +1039,12 @@ _fail_fw_start_:
wilc_wlan_stop();

_fail_irq_enable_:
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- wilc1000_sdio_disable_interrupt();
+ if (wilc1000_dev->gpio < 0)
+ wilc1000_sdio_disable_interrupt();
_fail_irq_init_:
-#endif
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(wilc1000_dev);
+ if (wilc1000_dev->gpio >= 0)
+ deinit_irq(wilc1000_dev);

-#endif
_fail_threads_:
wlan_deinitialize_threads(wilc1000_dev);
_fail_wilc_wlan_:
@@ -1511,7 +1500,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
}

-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpio)
{

int i;
@@ -1526,6 +1515,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
return -ENOMEM;

wilc1000_dev->ops = ops;
+ wilc1000_dev->gpio = gpio;

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 bb4a3acf16d0..64c8c5725277 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -7,6 +7,7 @@
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/host.h>
+#include <linux/of_gpio.h>



@@ -36,15 +37,12 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
};


-#ifndef WILC_SDIO_IRQ_GPIO
static void wilc_sdio_interrupt(struct sdio_func *func)
{
sdio_release_host(func);
wilc_handle_isr();
sdio_claim_host(func);
}
-#endif
-

static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
{
@@ -161,9 +159,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
ret = wilc_wlan_init(wilc1000_dev);

wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-#if !defined WILC_SDIO_IRQ_GPIO
- wilc1000_sdio_enable_interrupt();
-#endif
+ if (wilc1000_dev->gpio < 0)
+ wilc1000_sdio_enable_interrupt();

if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
@@ -188,6 +185,8 @@ __fail__:

static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
+ int gpio;
+
PRINT_D(INIT_DBG, "probe function\n");

#ifdef COMPLEMENT_BOOT
@@ -198,9 +197,17 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
return 0;
}
#endif
+
+ 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;
+ }
+
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc1000_sdio_func = func;
- if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops)) {
+ if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
@@ -228,7 +235,6 @@ static struct sdio_driver wilc_bus = {
int wilc1000_sdio_enable_interrupt(void)
{
int ret = 0;
-#ifndef WILC_SDIO_IRQ_GPIO

sdio_claim_host(wilc1000_sdio_func);
ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
@@ -238,14 +244,11 @@ int wilc1000_sdio_enable_interrupt(void)
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
ret = -EIO;
}
-#endif
return ret;
}

void wilc1000_sdio_disable_interrupt(void)
{
-
-#ifndef WILC_SDIO_IRQ_GPIO
int ret;

PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");
@@ -258,7 +261,6 @@ void wilc1000_sdio_disable_interrupt(void)
sdio_release_host(wilc1000_sdio_func);

PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
-#endif
}

static int linux_sdio_set_speed(int speed)
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 788531e314c3..c6ea3ef0664f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -424,7 +424,7 @@ static int __init init_wilc_spi_driver(void)
int ret;

wilc1000_init_driver();
- ret = wilc_netdev_init(NULL, &wilc1000_spi_ops);
+ ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
if (ret)
return ret;

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 2d39a5386718..69b7c72b76c5 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -16,6 +16,7 @@

typedef struct {
void *os_context;
+ bool irq_gpio;
u32 block_size;
int (*sdio_cmd52)(sdio_cmd52_t *);
int (*sdio_cmd53)(sdio_cmd53_t *);
@@ -29,10 +30,8 @@ typedef struct {

static wilc_sdio_t g_sdio;

-#ifdef WILC_SDIO_IRQ_GPIO
static int sdio_write_reg(u32 addr, u32 data);
static int sdio_read_reg(u32 addr, u32 *data);
-#endif

/********************************************
*
@@ -135,29 +134,29 @@ _fail_:

static int sdio_clear_int(void)
{
-#ifndef WILC_SDIO_IRQ_GPIO
- /* u32 sts; */
- sdio_cmd52_t cmd;
+ 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;
- g_sdio.sdio_cmd52(&cmd);
+ cmd.read_write = 0;
+ cmd.function = 1;
+ cmd.raw = 0;
+ cmd.address = 0x4;
+ cmd.data = 0;
+ g_sdio.sdio_cmd52(&cmd);

- return cmd.data;
-#else
- u32 reg;
+ return cmd.data;
+ } else {
+ u32 reg;

- if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
- g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
- return 0;
+ if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
+ 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);
+ return 1;
}
- reg &= ~0x1;
- sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
- return 1;
-#endif

}

@@ -459,8 +458,7 @@ static int sdio_sync(void)
return 0;
}

-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 reg;
int ret;

@@ -494,7 +492,6 @@ static int sdio_sync(void)
return 0;
}
}
-#endif

return 1;
}
@@ -509,6 +506,7 @@ static int sdio_init(struct wilc *inp, wilc_debug_func func)

g_sdio.dPrint = func;
g_sdio.os_context = inp;
+ g_sdio.irq_gpio = (inp->gpio >= 0);

if (inp->ops->io_init) {
if (!inp->ops->io_init(g_sdio.os_context)) {
@@ -674,36 +672,33 @@ static int sdio_read_int(u32 *int_status)
/**
* Read IRQ flags
**/
-#ifndef WILC_SDIO_IRQ_GPIO
- cmd.function = 1;
- cmd.address = 0x04;
- cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
-
- if (cmd.data & BIT(0))
- tmp |= INT_0;
- if (cmd.data & BIT(2))
- tmp |= INT_1;
- if (cmd.data & BIT(3))
- tmp |= INT_2;
- if (cmd.data & BIT(4))
- tmp |= INT_3;
- if (cmd.data & BIT(5))
- tmp |= INT_4;
- if (cmd.data & BIT(6))
- tmp |= INT_5;
- {
+ if (!g_sdio.irq_gpio) {
int i;

+ cmd.function = 1;
+ cmd.address = 0x04;
+ cmd.data = 0;
+ g_sdio.sdio_cmd52(&cmd);
+
+ if (cmd.data & BIT(0))
+ tmp |= INT_0;
+ if (cmd.data & BIT(2))
+ tmp |= INT_1;
+ if (cmd.data & BIT(3))
+ tmp |= INT_2;
+ if (cmd.data & BIT(4))
+ tmp |= INT_3;
+ if (cmd.data & BIT(5))
+ tmp |= INT_4;
+ if (cmd.data & BIT(6))
+ tmp |= INT_5;
for (i = g_sdio.nint; i < MAX_NUM_INT; i++) {
if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data);
break;
}
}
- }
-#else
- {
+ } else {
u32 irq_flags;

cmd.read_write = 0;
@@ -716,8 +711,6 @@ static int sdio_read_int(u32 *int_status)
tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
}

-#endif
-
*int_status = tmp;

return 1;
@@ -730,16 +723,14 @@ static int sdio_clear_int_ext(u32 val)
if (g_sdio.has_thrpt_enh3) {
u32 reg;

-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 flags;

flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1);
reg = flags;
+ } else {
+ reg = 0;
}
-#else
- reg = 0;
-#endif
/* select VMM table 0 */
if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
reg |= BIT(5);
@@ -766,8 +757,7 @@ static int sdio_clear_int_ext(u32 val)

}
} else {
-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
/* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */
/* Cannot clear multiple interrupts. Must clear each interrupt individually */
u32 flags;
@@ -807,7 +797,6 @@ static int sdio_clear_int_ext(u32 val)
}
}
}
-#endif /* WILC_SDIO_IRQ_GPIO */

{
u32 vmm_ctl;
@@ -874,8 +863,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
return 0;
}

-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 reg;
int ret, i;

@@ -927,7 +915,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
}
}
}
-#endif /* WILC_SDIO_IRQ_GPIO */
return 1;
}

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index ec5a8b1215b7..f1f78f51fea0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -159,9 +159,8 @@ struct wilc {
const struct wilc1000_ops *ops;
int mac_status;
int wilc1000_initialized;
- #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- unsigned short dev_irq_num;
- #endif
+ int gpio;
+ int dev_irq_num;
int close;
u8 u8NoIfcs;
struct wilc_vif strInterfaceInfo[NUM_CONCURRENT_IFC];
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7e1b892f721d..d12a4e7df32c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1369,9 +1369,6 @@ void wilc_handle_isr(void)
wilc_sleeptimer_isr_ext(int_status);

if (!(int_status & (ALL_INT_EXT))) {
-#ifdef WILC_SDIO
- PRINT_D(TX_DBG, ">> UNKNOWN_INTERRUPT - 0x%08x\n", int_status);
-#endif
wilc_unknown_isr_ext();
}
release_bus(RELEASE_ALLOW_SLEEP);
@@ -1481,9 +1478,8 @@ int wilc_wlan_start(void)
return ret;
}
reg = 0;
-#ifdef WILC_SDIO_IRQ_GPIO
- reg |= WILC_HAVE_SDIO_IRQ_GPIO;
-#endif
+ if (p->io_func->io_type == HIF_SDIO && wilc1000_dev->gpio >= 0)
+ reg |= WILC_HAVE_SDIO_IRQ_GPIO;

#ifdef WILC_DISABLE_PMU
#else
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 10b2a2f9e1b2..2e9b5d50ff7e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -321,7 +321,7 @@ void wilc1000_enable_tcp_ack_filter(bool value);
void wilc1000_chip_sleep_manually(u32 u32SleepTime);
int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
void __exit wilc_netdev_free(struct wilc *wilc1000_dev);

void wilc_handle_isr(void);
--
2.1.0.rc2


2015-10-20 22:48:18

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 17/19] staging/wilc1000: pass hif operations through initialization

The wilc1000_hif_spi and wilc1000_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 <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++-
drivers/staging/wilc1000/linux_wlan_sdio.c | 3 ++-
drivers/staging/wilc1000/linux_wlan_spi.c | 3 ++-
drivers/staging/wilc1000/wilc_sdio.c | 35 +++++++++++++--------------
drivers/staging/wilc1000/wilc_spi.c | 34 +++++++++++++-------------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
drivers/staging/wilc1000/wilc_wlan.c | 29 ++++------------------
drivers/staging/wilc1000/wilc_wlan.h | 11 +++++----
8 files changed, 53 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7b0ac31f04a2..04ebb6310070 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1503,7 +1503,8 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
}

-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpio)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
+ const struct wilc1000_hif_ops *hif_ops, int gpio)
{

int i;
@@ -1518,6 +1519,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int gpi
return -ENOMEM;

wilc1000_dev->ops = ops;
+ wilc1000_dev->hif_ops = hif_ops;
wilc1000_dev->gpio = gpio;

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 86251b907197..1f79d986be5c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -206,7 +206,8 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id

PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc1000_sdio_func = func;
- if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops, gpio)) {
+ if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops,
+ &wilc1000_hif_sdio, gpio)) {
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 c6ea3ef0664f..02b922ab86bb 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -424,7 +424,8 @@ static int __init init_wilc_spi_driver(void)
int ret;

wilc1000_init_driver();
- ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, GPIO_NUM);
+ ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, &wilc1000_hif_spi,
+ GPIO_NUM);
if (ret)
return ret;

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 69b7c72b76c5..5bfc093b6201 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -924,23 +924,22 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
*
********************************************/

-wilc_hif_func_t wilc1000_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 wilc1000_hif_ops wilc1000_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,
+ .hif_set_default_bus_speed = sdio_set_default_speed,
};

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 4c5659b72f29..a418774d7960 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1032,21 +1032,21 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
* Global spi HIF function table
*
********************************************/
-wilc_hif_func_t wilc1000_hif_spi = {
- spi_init,
- spi_deinit,
- spi_read_reg,
- spi_write_reg,
- spi_read,
- spi_write,
- spi_sync,
- spi_clear_int,
- spi_read_int,
- spi_clear_int_ext,
- spi_read_size,
- spi_write,
- spi_read,
- spi_sync_ext,
- spi_max_bus_speed,
- spi_default_bus_speed,
+const struct wilc1000_hif_ops wilc1000_hif_spi = {
+ .hif_init = spi_init,
+ .hif_deinit = spi_deinit,
+ .hif_read_reg = spi_read_reg,
+ .hif_write_reg = spi_write_reg,
+ .hif_block_rx = spi_read,
+ .hif_block_tx = spi_write,
+ .hif_sync = spi_sync,
+ .hif_clear_int = spi_clear_int,
+ .hif_read_int = spi_read_int,
+ .hif_clear_int_ext = spi_clear_int_ext,
+ .hif_read_size = spi_read_size,
+ .hif_block_rx_ext = spi_write,
+ .hif_block_tx_ext = spi_read,
+ .hif_sync_ext = spi_sync_ext,
+ .hif_set_max_bus_speed = spi_max_bus_speed,
+ .hif_set_default_bus_speed = spi_default_bus_speed,
};
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index f1f78f51fea0..791ede247465 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,6 +157,7 @@ struct wilc_vif {

struct wilc {
const struct wilc1000_ops *ops;
+ const struct wilc1000_hif_ops *hif_ops;
int mac_status;
int wilc1000_initialized;
int gpio;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 038c9b2eee6c..04d2938a383c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -28,7 +28,7 @@ typedef struct {
/**
* host interface functions
**/
- wilc_hif_func_t hif_func;
+ struct wilc1000_hif_ops hif_func;

/**
* configuration interface functions
@@ -1947,29 +1947,10 @@ int wilc_wlan_init(struct wilc *inp)
/***
* host interface init
**/
- if ((inp->ops->io_type & 0x1) == HIF_SDIO) {
- if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
- /* EIO 5 */
- ret = -5;
- goto _fail_;
- }
- memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
- } else {
- if ((inp->ops->io_type & 0x1) == HIF_SPI) {
- /**
- * TODO:
- **/
- if (!wilc1000_hif_spi.hif_init(inp, wilc_debug)) {
- /* EIO 5 */
- ret = -5;
- goto _fail_;
- }
- memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_spi, sizeof(wilc_hif_func_t));
- } else {
- /* EIO 5 */
- ret = -5;
- goto _fail_;
- }
+ g_wlan.hif_func = *inp->hif_ops;
+ if (!g_wlan.hif_func.hif_init(inp, wilc_debug)) {
+ ret = -EIO;
+ goto _fail_;
}

/***
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2f636534fc5d..f684d5bf465d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -251,7 +251,7 @@ struct rxq_entry_t {

struct wilc;

-typedef struct {
+struct wilc1000_hif_ops {
int (*hif_init)(struct wilc *, wilc_debug_func);
int (*hif_deinit)(void *);
int (*hif_read_reg)(u32, u32 *);
@@ -268,10 +268,10 @@ typedef struct {
int (*hif_sync_ext)(int);
void (*hif_set_max_bus_speed)(void);
void (*hif_set_default_bus_speed)(void);
-} wilc_hif_func_t;
+};

-extern wilc_hif_func_t wilc1000_hif_spi;
-extern wilc_hif_func_t wilc1000_hif_sdio;
+extern const struct wilc1000_hif_ops wilc1000_hif_spi;
+extern const struct wilc1000_hif_ops wilc1000_hif_sdio;

/********************************************
*
@@ -318,7 +318,8 @@ void wilc1000_enable_tcp_ack_filter(bool value);
void wilc1000_chip_sleep_manually(u32 u32SleepTime);
int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops, int gpio);
+int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
+ const struct wilc1000_hif_ops *hif_ops, int gpio);
void __exit wilc_netdev_free(struct wilc *wilc1000_dev);

void wilc_handle_isr(void);
--
2.1.0.rc2


2015-10-23 01:34:18

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups


On 2015년 10월 22일 21:23, Arnd Bergmann wrote:
> On Wednesday 21 October 2015 19:06:52 glen lee wrote:
>> Hi arnd,
>>
>> Thanks for the all the patches.
>> About the patch ( use proper naming for global symbols ),
>> We are planning to use this driver not only for wilc1000 but also for
>> other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.
>>
>> And the global variable g_linux_wlan will be placed in netdevice private data
>> and finally it will be removed. I already posted some of those patches.
> I couldn't find the patches anywhere, but I've updated my series now
> to rename the symbols to wilc_* and to remove most but not all references to
> g_linux_wlan (or wilc_dev after my rename). Do you want me to post those
> so you can integrate them, or should I have a look at what you sent first
> (please send me a copy then).

Hi arnd,

I have tested with all the patches you have posted but it does not works. firmware start timed out
in the function wilc1000_start_firmware.
I also have tested with all the patched without last one, [RFC] one, but it shows
Segmentation fault when insmod driver.
For now, I can't rebase the patches. I'd appreciate if you could help us.

The title of my first patch is,
[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure
and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
( The patches posted by [email protected] )

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

Thank you.
Glen.

> Arnd


2015-10-20 22:48:18

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 03/19] staging/wilc1000: use proper naming for global symbols

There are many global symbols in the wilc1000 driver, some of them
with names like "DEBUG_LEVEL" or "probe" that are not acceptable
for globals in the linux kernel as they may easily conflict with other
(equally broken) drivers.

This renames all the globals that do not already start with
wilc or a variation of that to start with wilc1000_ and to follow
the usual naming conventions.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 6 +-
drivers/staging/wilc1000/coreconfigurator.h | 12 +-
drivers/staging/wilc1000/host_interface.c | 162 ++++-----
drivers/staging/wilc1000/host_interface.h | 104 +++---
drivers/staging/wilc1000/linux_mon.c | 4 +-
drivers/staging/wilc1000/linux_wlan.c | 406 +++++++++++-----------
drivers/staging/wilc1000/linux_wlan_common.h | 18 +-
drivers/staging/wilc1000/linux_wlan_sdio.c | 62 ++--
drivers/staging/wilc1000/linux_wlan_sdio.h | 18 +-
drivers/staging/wilc1000/linux_wlan_spi.c | 18 +-
drivers/staging/wilc1000/linux_wlan_spi.h | 12 +-
drivers/staging/wilc1000/wilc_debugfs.c | 18 +-
drivers/staging/wilc1000/wilc_sdio.c | 2 +-
drivers/staging/wilc1000/wilc_spi.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 312 ++++++++---------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 94 ++---
drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
19 files changed, 630 insertions(+), 630 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 28ab89b3a65d..905fd3e03bfa 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -469,7 +469,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
* @date 1 Mar 2012
* @version 1.0
*/
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc1000_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
{
s32 s32Error = 0;

@@ -502,7 +502,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
* @date 2 Apr 2012
* @version 1.0
*/
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc1000_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo)
{
s32 s32Error = 0;
@@ -554,7 +554,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
* @date 2 Apr 2012
* @version 1.0
*/
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc1000_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
{
s32 s32Error = 0;

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 6294d929a800..46476f9872a0 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -129,14 +129,14 @@ typedef struct {

s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc1000_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);

-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc1000_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo);
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc1000_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);

-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_network_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_egnrl_async_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc1000_scan_complete_received(u8 *pu8Buffer, u32 u32Length);

#endif
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4e9dfb493b9f..c8c5f5c602c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -8,11 +8,11 @@
#include "wilc_msgqueue.h"
#include <linux/etherdevice.h>

-extern u8 connecting;
+extern u8 wilc1000_connecting;

-extern struct timer_list hDuringIpTimer;
+extern struct timer_list wilc1000_during_ip_timer;

-extern u8 g_wilc_initialized;
+extern u8 wilc1000_initialized;

#define HOST_IF_MSG_SCAN 0
#define HOST_IF_MSG_CONNECT 1
@@ -231,7 +231,7 @@ struct join_bss_param {

static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
struct host_if_drv *terminated_handle;
-bool g_obtainingIP;
+bool wilc1000_optaining_ip;
static u8 P2P_LISTEN_STATE;
static struct task_struct *hif_thread_handler;
static WILC_MsgQueueHandle hif_msg_q;
@@ -241,7 +241,7 @@ static struct semaphore hif_sema_wait_response;
static struct semaphore hif_sema_deinit;
static struct timer_list periodic_rssi;

-u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];

static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];

@@ -268,8 +268,8 @@ static struct host_if_drv *join_req_drv;

static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);

-extern void chip_sleep_manually(u32 u32SleepTime);
-extern int linux_wlan_get_num_conn_ifcs(void);
+extern void wilc1000_chip_sleep_manually(u32 u32SleepTime);
+extern int wilc1000_wlan_get_num_conn_ifcs(void);

static int add_handler_in_list(struct host_if_drv *handler)
{
@@ -456,7 +456,7 @@ static s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 i
kfree(strWID.val);

if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
- host_int_setup_ipaddress(hif_drv, set_ip[idx], idx);
+ wilc1000_setup_ipaddress(hif_drv, set_ip[idx], idx);

if (s32Error != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -809,7 +809,7 @@ ERRORHANDLER:

static s32 Handle_wait_msg_q_empty(void)
{
- g_wilc_initialized = 0;
+ wilc1000_initialized = 0;
up(&hif_sema_wait_response);
return 0;
}
@@ -841,7 +841,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
goto ERRORHANDLER;
}

- if (g_obtainingIP || connecting) {
+ if (wilc1000_optaining_ip || wilc1000_connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
PRINT_ER("Don't do obss scan\n");
s32Error = -EBUSY;
@@ -987,7 +987,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
return s32Error;
}

-u8 u8ConnectedSSID[6] = {0};
+u8 wilc1000_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, u8ConnectedSSID, ETH_ALEN) == 0) {
+ if (memcmp(pstrHostIFconnectAttr->bssid, wilc1000_connected_SSID, ETH_ALEN) == 0) {

s32Error = 0;
PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
@@ -1210,10 +1210,10 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");

if (pstrHostIFconnectAttr->bssid != NULL) {
- memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN);
+ memcpy(wilc1000_connected_SSID, pstrHostIFconnectAttr->bssid, ETH_ALEN);

PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid);
- PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID);
+ PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc1000_connected_SSID);
}

s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
@@ -1233,7 +1233,7 @@ ERRORHANDLER:

del_timer(&hif_drv->hConnectTimer);

- PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n");
+ PRINT_D(HOSTINF_DBG, "could not start wilc1000_connecting to the required network\n");

memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));

@@ -1387,7 +1387,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);

- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc1000_connected_SSID);

if (join_req != NULL && join_req_drv == hif_drv) {
kfree(join_req);
@@ -1482,7 +1482,7 @@ done:
pstrRcvdNetworkInfo->buffer = NULL;

if (pstrNetworkInfo != NULL) {
- DeallocateNetworkInfo(pstrNetworkInfo);
+ wilc1000_dealloc_network_info(pstrNetworkInfo);
pstrNetworkInfo = NULL;
}

@@ -1562,10 +1562,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
if (u32RcvdAssocRespInfoLen != 0) {

PRINT_D(HOSTINF_DBG, "Parsing association response\n");
- s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
+ s32Err = wilc1000_parse_assoc_resp_info(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
&pstrConnectRespInfo);
if (s32Err) {
- PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err);
+ PRINT_ER("wilc1000_parse_assoc_resp_info() returned error %d\n", s32Err);
} else {
strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus;

@@ -1582,7 +1582,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
}

if (pstrConnectRespInfo != NULL) {
- DeallocateAssocRespInfo(pstrConnectRespInfo);
+ wilc1000_dealloc_assoc_resp_info(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
}
}
@@ -1592,11 +1592,11 @@ 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(u8ConnectedSSID);
+ eth_zero_addr(wilc1000_connected_SSID);

} else if (u8MacStatus == MAC_DISCONNECTED) {
PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc1000_connected_SSID);
}

if (hif_drv->strWILC_UsrConnReq.pu8bssid != NULL) {
@@ -1629,14 +1629,14 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,

if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc1000_set_power_mgmt(hif_drv, 0, 0);

PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
hif_drv->enuHostIFstate = HOST_IF_CONNECTED;

PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n");
- g_obtainingIP = true;
- mod_timer(&hDuringIpTimer,
+ wilc1000_optaining_ip = true;
+ mod_timer(&wilc1000_during_ip_timer,
jiffies + msecs_to_jiffies(10000));
} else {
PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus);
@@ -1671,8 +1671,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
strDisconnectNotifInfo.ie_len = 0;

if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
- g_obtainingIP = false;
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc1000_optaining_ip = false;
+ wilc1000_set_power_mgmt(hif_drv, 0, 0);

hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF,
NULL,
@@ -2031,10 +2031,10 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");

- g_obtainingIP = false;
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc1000_optaining_ip = false;
+ wilc1000_set_power_mgmt(hif_drv, 0, 0);

- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc1000_connected_SSID);

s32Error = send_config_pkt(SET_CFG, &strWID, 1,
get_id_from_handler(hif_drv));
@@ -2098,13 +2098,13 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)
}


-void resolve_disconnect_aberration(struct host_if_drv *hif_drv)
+void wilc1000_resolve_disconnect_aberration(struct host_if_drv *hif_drv)
{
if (!hif_drv)
return;
if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
- host_int_disconnect(hif_drv, 1);
+ wilc1000_disconnect(hif_drv, 1);
}
}

@@ -2569,12 +2569,12 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
goto ERRORHANDLER;
}
if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
- PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n");
+ PRINT_INFO(GENERIC_DBG, "Required to remain on chan while wilc1000_connecting return\n");
s32Error = -EBUSY;
goto ERRORHANDLER;
}

- if (g_obtainingIP || connecting) {
+ if (wilc1000_optaining_ip || wilc1000_connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
s32Error = -EBUSY;
goto ERRORHANDLER;
@@ -2768,7 +2768,7 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);

if ((strHostIfSetMulti->cnt) > 0)
- memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN));
+ memcpy(pu8CurrByte, wilc1000_multicast_mac_addr_list, ((strHostIfSetMulti->cnt) * ETH_ALEN));

s32Error = send_config_pkt(SET_CFG, &strWID, 1,
get_id_from_handler(hif_drv));
@@ -2903,7 +2903,7 @@ static int hostIFthread(void *pvArg)
break;
}

- if ((!g_wilc_initialized)) {
+ if ((!wilc1000_initialized)) {
PRINT_D(GENERIC_DBG, "--WAIT--");
usleep_range(200 * 1000, 200 * 1000);
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -2963,8 +2963,8 @@ static int hostIFthread(void *pvArg)
del_timer(&hif_drv->hScanTimer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");

- if (!linux_wlan_get_num_conn_ifcs())
- chip_sleep_manually(INFINITE_SLEEP_TIME);
+ if (!wilc1000_wlan_get_num_conn_ifcs())
+ wilc1000_chip_sleep_manually(INFINITE_SLEEP_TIME);

Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);

@@ -3121,7 +3121,7 @@ static void TimerCB_Connect(unsigned long arg)
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
}

-s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
+s32 wilc1000_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
{
struct wid strWID;

@@ -3133,7 +3133,7 @@ s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
return 0;
}

-int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
+int wilc1000_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3160,7 +3160,7 @@ int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
return result;
}

-s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hif_drv, u8 u8Index)
+s32 wilc1000_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 u8Index)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3189,7 +3189,7 @@ s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hif_drv, u8 u8Index)
return s32Error;
}

-s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
+s32 wilc1000_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
const u8 *pu8WepKey,
u8 u8WepKeylen,
u8 u8Keyidx)
@@ -3225,7 +3225,7 @@ s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,

}

-s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+s32 wilc1000_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
const u8 *pu8WepKey,
u8 u8WepKeylen,
u8 u8Keyidx,
@@ -3270,7 +3270,7 @@ s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,

}

-s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
+s32 wilc1000_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
u8 u8PtkKeylen, const u8 *mac_addr,
const u8 *pu8RxMic, const u8 *pu8TxMic,
u8 mode, u8 u8Ciphermode, u8 u8Idx)
@@ -3335,7 +3335,7 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
return s32Error;
}

-s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
+s32 wilc1000_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
u8 u8GtkKeylen, u8 u8KeyIdx,
u32 u32KeyRSClen, const u8 *KeyRSC,
const u8 *pu8RxMic, const u8 *pu8TxMic,
@@ -3397,7 +3397,7 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
return s32Error;
}

-s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
+s32 wilc1000_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3431,7 +3431,7 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at
return s32Error;
}

-s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc1000_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3452,7 +3452,7 @@ s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
return s32Error;
}

-s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc1000_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3484,7 +3484,7 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
return 0;
}

-s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
+s32 wilc1000_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
@@ -3551,7 +3551,7 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
return s32Error;
}

-s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
+s32 wilc1000_flush_join_req(struct host_if_drv *hif_drv)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3580,7 +3580,7 @@ s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
return s32Error;
}

-s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
+s32 wilc1000_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3633,7 +3633,7 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8Assoc
return s32Error;
}

-int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
+int wilc1000_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
{
int result;
struct host_if_msg msg;
@@ -3657,7 +3657,7 @@ int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
return 0;
}

-int host_int_wait_msg_queue_idle(void)
+int wilc1000_wait_msg_queue_idle(void)
{
int result = 0;

@@ -3675,7 +3675,7 @@ int host_int_wait_msg_queue_idle(void)
return result;
}

-int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv)
+int wilc1000_set_wfi_drv_handler(struct host_if_drv *hif_drv)
{
int result = 0;

@@ -3694,7 +3694,7 @@ int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv)
return result;
}

-int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
+int wilc1000_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
{
int result = 0;

@@ -3713,7 +3713,7 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
return result;
}

-s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
+s32 wilc1000_get_inactive_time(struct host_if_drv *hif_drv,
const u8 *mac, u32 *pu32InactiveTime)
{
s32 s32Error = 0;
@@ -3744,7 +3744,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
+s32 wilc1000_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3772,7 +3772,7 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
return s32Error;
}

-s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+s32 wilc1000_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -3792,7 +3792,7 @@ s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrSta
return s32Error;
}

-s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
+s32 wilc1000_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
u8 u8ScanType, u8 *pu8ChnlFreqList,
u8 u8ChnlListLen, const u8 *pu8IEs,
size_t IEsLen, wilc_scan_result ScanResult,
@@ -3846,7 +3846,7 @@ s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,

}

-s32 hif_set_cfg(struct host_if_drv *hif_drv,
+s32 wilc1000_hif_set_cfg(struct host_if_drv *hif_drv,
struct cfg_param_val *pstrCfgParamVal)
{

@@ -3901,7 +3901,7 @@ static void GetPeriodicRSSI(unsigned long arg)

static u32 clients_count;

-s32 host_int_init(struct host_if_drv **hif_drv_handler)
+s32 wilc1000_init(struct host_if_drv **hif_drv_handler)
{
s32 result = 0;
struct host_if_drv *hif_drv;
@@ -3925,7 +3925,7 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
goto _fail_timer_2;
}

- g_obtainingIP = false;
+ wilc1000_optaining_ip = false;

PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
if (clients_count == 0) {
@@ -4004,7 +4004,7 @@ _fail_:
return result;
}

-s32 host_int_deinit(struct host_if_drv *hif_drv)
+s32 wilc1000_deinit(struct host_if_drv *hif_drv)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4033,7 +4033,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)

del_timer_sync(&hif_drv->hRemainOnChannel);

- host_int_set_wfi_drv_handler(NULL);
+ wilc1000_set_wfi_drv_handler(NULL);
down(&hif_sema_driver);

if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
@@ -4079,7 +4079,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv)
return s32Error;
}

-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc1000_network_info_received(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4111,7 +4111,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error);
}

-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc1000_egnrl_async_info_received(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4154,7 +4154,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
up(&hif_sema_deinit);
}

-void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc1000_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4186,7 +4186,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)

}

-s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
+s32 wilc1000_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
u32 u32duration, u16 chan,
wilc_remain_on_chan_expired RemainOnChanExpired,
wilc_remain_on_chan_ready RemainOnChanReady,
@@ -4218,7 +4218,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
return s32Error;
}

-s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID)
+s32 wilc1000_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4242,7 +4242,7 @@ s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID)
return s32Error;
}

-s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
+s32 wilc1000_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4283,7 +4283,7 @@ s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool

}

-s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
+s32 wilc1000_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
u32 u32TailLen, u8 *pu8Tail)
{
@@ -4338,7 +4338,7 @@ ERRORHANDLER:

}

-s32 host_int_del_beacon(struct host_if_drv *hif_drv)
+s32 wilc1000_del_beacon(struct host_if_drv *hif_drv)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4359,7 +4359,7 @@ s32 host_int_del_beacon(struct host_if_drv *hif_drv)
return s32Error;
}

-s32 host_int_add_station(struct host_if_drv *hif_drv,
+s32 wilc1000_add_station(struct host_if_drv *hif_drv,
struct add_sta_param *pstrStaParams)
{
s32 s32Error = 0;
@@ -4396,7 +4396,7 @@ s32 host_int_add_station(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
+s32 wilc1000_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
{
s32 s32Error = 0;
struct host_if_msg msg;
@@ -4425,7 +4425,7 @@ s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
return s32Error;
}

-s32 host_int_del_allstation(struct host_if_drv *hif_drv,
+s32 wilc1000_del_allstation(struct host_if_drv *hif_drv,
u8 pu8MacAddr[][ETH_ALEN])
{
s32 s32Error = 0;
@@ -4478,7 +4478,7 @@ s32 host_int_del_allstation(struct host_if_drv *hif_drv,

}

-s32 host_int_edit_station(struct host_if_drv *hif_drv,
+s32 wilc1000_edit_station(struct host_if_drv *hif_drv,
struct add_sta_param *pstrStaParams)
{
s32 s32Error = 0;
@@ -4515,7 +4515,7 @@ s32 host_int_edit_station(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv,
+s32 wilc1000_set_power_mgmt(struct host_if_drv *hif_drv,
bool bIsEnabled,
u32 u32Timeout)
{
@@ -4546,7 +4546,7 @@ s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv,
+s32 wilc1000_setup_multicast_filter(struct host_if_drv *hif_drv,
bool bIsEnabled,
u32 u32count)
{
@@ -4737,7 +4737,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)

}

-void host_int_freeJoinParams(void *pJoinParams)
+void wilc1000_free_join_params(void *pJoinParams)
{
if ((struct bss_param *)pJoinParams != NULL)
kfree((struct bss_param *)pJoinParams);
@@ -4745,7 +4745,7 @@ void host_int_freeJoinParams(void *pJoinParams)
PRINT_ER("Unable to FREE null pointer\n");
}

-s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
+s32 wilc1000_del_all_rx_ba_session(struct host_if_drv *hif_drv,
char *pBSSID,
char TID)
{
@@ -4775,7 +4775,7 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+s32 wilc1000_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
s32 s32Error = 0;
struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 1661eeb0a2e7..826ed0f30615 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -356,7 +356,7 @@ struct add_sta_param {
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
+s32 wilc1000_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
/**
* @brief removes WEP key
* @details valid only in BSS STA mode if External Supplicant support is enabled.
@@ -371,7 +371,7 @@ s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
* @date 8 March 2012
* @version 1.0
*/
-int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
+int wilc1000_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
/**
* @brief sets WEP deafault key
* @details Sets the index of the WEP encryption key in use,
@@ -384,7 +384,7 @@ int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hWFIDrv, u8 u8Index);
+s32 wilc1000_set_wep_default_keyid(struct host_if_drv *hWFIDrv, u8 u8Index);

/**
* @brief sets WEP deafault key
@@ -405,9 +405,9 @@ s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hWFIDrv, u8 u8Index);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
+s32 wilc1000_add_wep_key_bss_sta(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
/**
- * @brief host_int_add_wep_key_bss_ap
+ * @brief wilc1000_add_wep_key_bss_ap
* @details valid only in AP mode if External Supplicant support is enabled.
* sets WEP key entry into MAC hardware when it receives the
* corresponding request from NDIS.
@@ -420,7 +420,7 @@ s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hWFIDrv, const u8 *pu8WepKe
* @date 28 Feb 2013
* @version 1.0
*/
-s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+s32 wilc1000_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);

/**
* @brief adds ptk Key
@@ -438,11 +438,11 @@ s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
+s32 wilc1000_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);

/**
- * @brief host_int_get_inactive_time
+ * @brief wilc1000_get_inactive_time
* @details
* @param[in,out] handle to the wifi driver
* @param[in] message containing inactive time
@@ -453,7 +453,7 @@ s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeyl
* @date 15 April 2013
* @version 1.0
*/
-s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
+s32 wilc1000_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);

/**
* @brief adds Rx GTk Key
@@ -471,7 +471,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
+s32 wilc1000_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);

@@ -515,7 +515,7 @@ s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk,
* @version 1.0
*/

-s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
+s32 wilc1000_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
/**
* @brief gets mac address
* @details
@@ -527,7 +527,7 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_at
* @date 19 April 2012
* @version 1.0
*/
-s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
+s32 wilc1000_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);

/**
* @brief sets mac address
@@ -540,7 +540,7 @@ s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
* @date 16 July 2012
* @version 1.0
*/
-s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
+s32 wilc1000_set_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);

/**
* @brief wait until msg q is empty
@@ -553,7 +553,7 @@ s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
* @date 19 march 2014
* @version 1.0
*/
-int host_int_wait_msg_queue_idle(void);
+int wilc1000_wait_msg_queue_idle(void);

/**
* @brief sets a start scan request
@@ -585,7 +585,7 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
* @version 1.0
*/

-s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
+s32 wilc1000_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
@@ -605,7 +605,7 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
* @version 8.0
*/

-s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
+s32 wilc1000_flush_join_req(struct host_if_drv *hWFIDrv);


/**
@@ -619,7 +619,7 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
+s32 wilc1000_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);

/**
* @brief sets a channel
@@ -636,7 +636,7 @@ s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
* @date 8 March 2012
* @version 1.0
*/
-int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
+int wilc1000_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);

/**
* @brief gets the sta rssi
@@ -651,7 +651,7 @@ int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
+s32 wilc1000_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);

/**
* @brief scans a set of channels
@@ -670,7 +670,7 @@ s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
+s32 wilc1000_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
u8 u8ScanType, u8 *pu8ChnlFreqList,
u8 u8ChnlListLen, const u8 *pu8IEs,
size_t IEsLen, wilc_scan_result ScanResult,
@@ -687,7 +687,7 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
* @date 8 March 2012
* @version 1.0
*/
-s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
+s32 wilc1000_hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);

/*****************************************************************************/
/* Notification Functions */
@@ -702,7 +702,7 @@ s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamV
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_init(struct host_if_drv **phWFIDrv);
+s32 wilc1000_init(struct host_if_drv **phWFIDrv);

/**
* @brief host interface initialization function
@@ -713,11 +713,11 @@ s32 host_int_init(struct host_if_drv **phWFIDrv);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_deinit(struct host_if_drv *hWFIDrv);
+s32 wilc1000_deinit(struct host_if_drv *hWFIDrv);


/*!
- * @fn s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv,u8 u8Index)
+ * @fn s32 wilc1000_add_beacon(WILC_WFIDrvHandle hWFIDrv,u8 u8Index)
* @brief Sends a beacon to the firmware to be transmitted over the air
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -738,14 +738,14 @@ s32 host_int_deinit(struct host_if_drv *hWFIDrv);
* @version 1.0 Description
*
*/
-s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
+s32 wilc1000_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head,
u32 u32TailLen, u8 *pu8tail);


/*!
- * @fn s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv)
+ * @fn s32 wilc1000_del_beacon(WILC_WFIDrvHandle hWFIDrv)
* @brief Removes the beacon and stops trawilctting it over the air
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -756,10 +756,10 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
* @date 10 Julys 2012
* @version 1.0 Description
*/
-s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
+s32 wilc1000_del_beacon(struct host_if_drv *hWFIDrv);

/*!
- * @fn s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
+ * @fn s32 wilc1000_add_station(WILC_WFIDrvHandle hWFIDrv,
* struct add_sta_param *pstrStaParams)
* @brief Notifies the firmware with a new associated stations
* @details
@@ -772,11 +772,11 @@ s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
* @date 12 July 2012
* @version 1.0 Description
*/
-s32 host_int_add_station(struct host_if_drv *hWFIDrv,
+s32 wilc1000_add_station(struct host_if_drv *hWFIDrv,
struct add_sta_param *pstrStaParams);

/*!
- * @fn s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
+ * @fn s32 wilc1000_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
* @brief Deauthenticates clients when group is terminating
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -788,10 +788,10 @@ s32 host_int_add_station(struct host_if_drv *hWFIDrv,
* @date 09 April 2014
* @version 1.0 Description
*/
-s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
+s32 wilc1000_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);

/*!
- * @fn s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
+ * @fn s32 wilc1000_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
* @brief Notifies the firmware with a new deleted station
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -803,10 +803,10 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE
* @date 15 July 2012
* @version 1.0 Description
*/
-s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
+s32 wilc1000_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);

/*!
- * @fn s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
+ * @fn s32 wilc1000_edit_station(WILC_WFIDrvHandle hWFIDrv,
* struct add_sta_param *pstrStaParams)
* @brief Notifies the firmware with new parameters of an already associated station
* @details
@@ -819,11 +819,11 @@ s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
* @date 15 July 2012
* @version 1.0 Description
*/
-s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
+s32 wilc1000_edit_station(struct host_if_drv *hWFIDrv,
struct add_sta_param *pstrStaParams);

/*!
- * @fn s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
+ * @fn s32 wilc1000_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
* @brief Set the power management mode to enabled or disabled
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -837,7 +837,7 @@ s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
* @date 24 November 2012
* @version 1.0 Description
*/
-s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
+s32 wilc1000_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
/* @param[in,out] hWFIDrv handle to the wifi driver
* @param[in] bIsEnabled TRUE if enabled, FALSE otherwise
* @param[in] u8count count of mac address entries in the filter table
@@ -849,9 +849,9 @@ s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u3
* @date 24 November 2012
* @version 1.0 Description
*/
-s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
+s32 wilc1000_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
/**
- * @brief host_int_setup_ipaddress
+ * @brief wilc1000_setup_ipaddress
* @details set IP address on firmware
* @param[in]
* @return Error code.
@@ -859,7 +859,7 @@ s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled
* @date
* @version 1.0
*/
-s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
+s32 wilc1000_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);

/**
* @brief host_int_delBASession
@@ -870,10 +870,10 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx)
* @date
* @version 1.0
*/
-s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
+s32 wilc1000_del_all_rx_ba_session(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);

/**
- * @brief host_int_remain_on_channel
+ * @brief wilc1000_remain_on_channel
* @details
* @param[in]
* @return Error code.
@@ -881,10 +881,10 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, cha
* @date
* @version 1.0
*/
-s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg);
+s32 wilc1000_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg);

/**
- * @brief host_int_ListenStateExpired
+ * @brief wilc1000_listen_state_expired
* @details
* @param[in] Handle to wifi driver
* Duration to remain on channel
@@ -897,10 +897,10 @@ s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u3
* @date
* @version 1.0
*/
-s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
+s32 wilc1000_listen_state_expired(struct host_if_drv *hWFIDrv, u32 u32SessionID);

/**
- * @brief host_int_frame_register
+ * @brief wilc1000_frame_register
* @details
* @param[in]
* @return Error code.
@@ -908,9 +908,9 @@ s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
* @date
* @version 1.0
*/
-s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
+s32 wilc1000_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
/**
- * @brief host_int_set_wfi_drv_handler
+ * @brief wilc1000_set_wfi_drv_handler
* @details
* @param[in]
* @return Error code.
@@ -918,11 +918,11 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool
* @date
* @version 1.0
*/
-int host_int_set_wfi_drv_handler(struct host_if_drv *address);
-int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
+int wilc1000_set_wfi_drv_handler(struct host_if_drv *address);
+int wilc1000_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);

-void host_int_freeJoinParams(void *pJoinParams);
+void wilc1000_free_join_params(void *pJoinParams);

-s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
+s32 wilc1000_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);

#endif
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index d93594474a2d..52443f039a43 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,7 +26,7 @@ struct wilc_wfi_radiotap_cb_hdr {

static struct net_device *wilc_wfi_mon; /* global monitor netdev */

-extern int mac_xmit(struct sk_buff *skb, struct net_device *dev);
+extern int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);


static u8 srcAdd[6];
@@ -298,7 +298,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len);
dev_kfree_skb(skb);
} else
- ret = mac_xmit(skb, mon_priv->real_ndev);
+ ret = wilc1000_mac_xmit(skb, mon_priv->real_ndev);

return ret;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1b496e84100e..be4b1b1199f8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,12 +45,12 @@
#define _linux_wlan_device_removal() {}
#endif

-extern bool g_obtainingIP;
-extern u16 Set_machw_change_vir_if(bool bValue);
-extern void resolve_disconnect_aberration(void *drvHandler);
-extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+extern bool wilc1000_optaining_ip;
+extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
+extern void wilc1000_resolve_disconnect_aberration(void *drvHandler);
+extern u8 wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
void wilc1000_wlan_deinit(struct wilc *nic);
-extern struct timer_list hDuringIpTimer;
+extern struct timer_list wilc1000_during_ip_timer;

static int linux_wlan_device_power(int on_off)
{
@@ -89,7 +89,7 @@ static struct notifier_block g_dev_notifier = {
#define IRQ_WAIT 1
#define IRQ_NO_WAIT 0
/*
- * to sync between mac_close and module exit.
+ * to sync between wilc1000_mac_close and module exit.
* don't initialize or de-initialize from init/deinitlocks
* to be initialized from module wilc_netdev_init and
* deinitialized from mdoule_exit
@@ -103,9 +103,9 @@ extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);

static void linux_wlan_tx_complete(void *priv, int status);
static int mac_init_fn(struct net_device *ndev);
-int mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int mac_open(struct net_device *ndev);
-int mac_close(struct net_device *ndev);
+int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
+int wilc1000_mac_open(struct net_device *ndev);
+int wilc1000_mac_close(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);
@@ -114,14 +114,14 @@ static void wilc_set_multicast_list(struct net_device *dev);
* for now - in frmw_to_linux there should be private data to be passed to it
* and this data should be pointer to net device
*/
-struct wilc *g_linux_wlan;
-bool bEnablePS = true;
+struct wilc *wilc1000_dev;
+bool wilc1000_enable_ps = true;

static const struct net_device_ops wilc_netdev_ops = {
.ndo_init = mac_init_fn,
- .ndo_open = mac_open,
- .ndo_stop = mac_close,
- .ndo_start_xmit = mac_xmit,
+ .ndo_open = wilc1000_mac_open,
+ .ndo_stop = wilc1000_mac_close,
+ .ndo_start_xmit = wilc1000_mac_xmit,
.ndo_do_ioctl = mac_ioctl,
.ndo_get_stats = mac_stats,
.ndo_set_rx_mode = wilc_set_multicast_list,
@@ -177,19 +177,19 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
/*If we are in station mode or client mode*/
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
pstrWFIDrv->IFC_UP = 1;
- g_obtainingIP = false;
- del_timer(&hDuringIpTimer);
+ wilc1000_optaining_ip = false;
+ del_timer(&wilc1000_during_ip_timer);
PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}

- if (bEnablePS)
- host_int_set_power_mgmt(pstrWFIDrv, 1, 0);
+ if (wilc1000_enable_ps)
+ wilc1000_set_power_mgmt(pstrWFIDrv, 1, 0);

PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);

pIP_Add_buff = (char *) (&(dev_iface->ifa_address));
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]);
- host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx);
+ wilc1000_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx);

break;

@@ -199,20 +199,20 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
pstrWFIDrv->IFC_UP = 0;
- g_obtainingIP = false;
+ wilc1000_optaining_ip = false;
}

if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
- host_int_set_power_mgmt(pstrWFIDrv, 0, 0);
+ wilc1000_set_power_mgmt(pstrWFIDrv, 0, 0);

- resolve_disconnect_aberration(pstrWFIDrv);
+ wilc1000_resolve_disconnect_aberration(pstrWFIDrv);

PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);

pIP_Add_buff = null_ip;
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]);

- host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx);
+ wilc1000_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx);

break;

@@ -233,7 +233,7 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
PRINT_D(INT_DBG, "Interrupt received UH\n");

/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wilc1000_dev->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
@@ -247,7 +247,7 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
nic = (struct wilc *)userdata;

/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wilc1000_dev->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
@@ -302,7 +302,7 @@ static void deinit_irq(struct wilc *nic)
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
/* Deintialize IRQ */
if (&nic->dev_irq_num != 0) {
- free_irq(nic->dev_irq_num, g_linux_wlan);
+ free_irq(nic->dev_irq_num, wilc1000_dev);

gpio_free(GPIO_NUM);
}
@@ -334,7 +334,7 @@ void linux_wlan_mac_indicate(int flag)
/*I have to do it that way becuase there is no mean to encapsulate device pointer
* as a parameter
*/
- struct wilc *pd = g_linux_wlan;
+ struct wilc *pd = wilc1000_dev;
int status;

if (flag == WILC_MAC_INDICATE_STATUS) {
@@ -364,10 +364,10 @@ static struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid = pMacHeader + 10;
Bssid1 = pMacHeader + 4;

- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ if (!memcmp(Bssid1, wilc1000_dev->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
+ !memcmp(Bssid, wilc1000_dev->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
+ return wilc1000_dev->strInterfaceInfo[i].wilc_netdev;
}
}
PRINT_INFO(INIT_DBG, "Invalide handle\n");
@@ -375,27 +375,27 @@ static struct net_device *GetIfHandler(u8 *pMacHeader)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- PRINT_D(INIT_DBG, "Ctx [%p]\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ if (!memcmp(Bssid1, wilc1000_dev->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
+ !memcmp(Bssid, wilc1000_dev->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
+ PRINT_D(INIT_DBG, "Ctx [%p]\n", wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
+ return wilc1000_dev->strInterfaceInfo[i].wilc_netdev;
}
}
PRINT_INFO(INIT_DBG, "\n");
return NULL;
}

-int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
+int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
{
int i = 0;
int ret = -1;

PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == wilc_netdev) {
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ if (wilc1000_dev->strInterfaceInfo[i].wilc_netdev == wilc_netdev) {
PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", pBSSID[0], pBSSID[1], pBSSID[2]);
- memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, pBSSID, 6);
+ memcpy(wilc1000_dev->strInterfaceInfo[i].aBSSID, pBSSID, 6);
ret = 0;
break;
}
@@ -404,14 +404,14 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
}

/*Function to get number of connected interfaces*/
-int linux_wlan_get_num_conn_ifcs(void)
+int wilc1000_wlan_get_num_conn_ifcs(void)
{
u8 i = 0;
u8 null_bssid[6] = {0};
u8 ret_val = 0;

- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6))
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ if (memcmp(wilc1000_dev->strInterfaceInfo[i].aBSSID, null_bssid, 6))
ret_val++;
}
return ret_val;
@@ -433,17 +433,17 @@ static int linux_wlan_txq_task(void *vp)
#endif

/* inform wilc1000_wlan_init that TXQ task is started. */
- up(&g_linux_wlan->txq_thread_started);
+ up(&wilc1000_dev->txq_thread_started);
while (1) {

PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
- down(&g_linux_wlan->txq_event);
+ down(&wilc1000_dev->txq_event);
/* wait_for_completion(&pd->txq_event); */
PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");

- if (g_linux_wlan->close) {
- /*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */
- up(&g_linux_wlan->txq_thread_started);
+ if (wilc1000_dev->close) {
+ /*Unlock the mutex in the wilc1000_mac_close function to indicate the exiting of the TX thread */
+ up(&wilc1000_dev->txq_thread_started);

while (!kthread_should_stop())
schedule();
@@ -460,10 +460,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[0].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[1].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ if (netif_queue_stopped(wilc1000_dev->strInterfaceInfo[0].wilc_netdev))
+ netif_wake_queue(wilc1000_dev->strInterfaceInfo[0].wilc_netdev);
+ if (netif_queue_stopped(wilc1000_dev->strInterfaceInfo[1].wilc_netdev))
+ netif_wake_queue(wilc1000_dev->strInterfaceInfo[1].wilc_netdev);
}

if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
@@ -485,7 +485,7 @@ static int linux_wlan_txq_task(void *vp)
}
}
/*TODO: drop packets after a certain time/number of retry count. */
- } while (ret == WILC_TX_ERR_NO_BUF && !g_linux_wlan->close); /* retry sending packets if no more buffers in chip. */
+ } while (ret == WILC_TX_ERR_NO_BUF && !wilc1000_dev->close); /* retry sending packets if no more buffers in chip. */
#endif
}
return 0;
@@ -496,7 +496,7 @@ void linux_wlan_rx_complete(void)
PRINT_D(RX_DBG, "RX completed\n");
}

-int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
+int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic)
{

perInterface_wlan_t *nic = p_nic;
@@ -528,19 +528,19 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
* root file system with the name specified above */

#ifdef WILC_SDIO
- if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_sdio_func->dev) != 0) {
+ if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_sdio_func->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
#else
- if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_spidev->dev) != 0) {
+ if (request_firmware(&wilc_firmware, firmware, &wilc1000_dev->wilc_spidev->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
#endif
- g_linux_wlan->wilc_firmware = wilc_firmware;
+ wilc1000_dev->wilc_firmware = wilc_firmware;

_fail_:

@@ -566,7 +566,7 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)

/* wait for mac ready */
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
- ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000);
+ ret = linux_wlan_lock_timeout(&wilc1000_dev->sync_event, 5000);
if (ret) {
#ifdef COMPLEMENT_BOOT
static int timeout = 5;
@@ -597,7 +597,7 @@ static int linux_wlan_firmware_download(struct wilc *p_nic)

int ret = 0;

- if (g_linux_wlan->wilc_firmware == NULL) {
+ if (wilc1000_dev->wilc_firmware == NULL) {
PRINT_ER("Firmware buffer is NULL\n");
ret = -ENOBUFS;
goto _FAIL_;
@@ -606,16 +606,16 @@ static int linux_wlan_firmware_download(struct wilc *p_nic)
* do the firmware download
**/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
- ret = wilc_wlan_firmware_download(g_linux_wlan->wilc_firmware->data,
- g_linux_wlan->wilc_firmware->size);
+ ret = wilc_wlan_firmware_download(wilc1000_dev->wilc_firmware->data,
+ wilc1000_dev->wilc_firmware->size);
if (ret < 0)
goto _FAIL_;

/* Freeing FW buffer */
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
+ release_firmware(wilc1000_dev->wilc_firmware);
+ wilc1000_dev->wilc_firmware = NULL;

PRINT_D(INIT_DBG, "Download Succeeded\n");

@@ -883,7 +883,7 @@ _fail_:
void wilc1000_wlan_deinit(struct wilc *nic)
{

- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {

printk("Deinitializing wilc1000 ...\n");

@@ -901,18 +901,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)

PRINT_D(INIT_DBG, "Disabling IRQ\n");
#ifdef WILC_SDIO
- mutex_lock(&g_linux_wlan->hif_cs);
- disable_sdio_interrupt();
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc1000_dev->hif_cs);
+ wilc1000_sdio_disable_interrupt();
+ mutex_unlock(&wilc1000_dev->hif_cs);
#endif
- if (&g_linux_wlan->txq_event != NULL)
- up(&g_linux_wlan->txq_event);
+ if (&wilc1000_dev->txq_event != NULL)
+ up(&wilc1000_dev->txq_event);

PRINT_D(INIT_DBG, "Deinitializing Threads\n");
wlan_deinitialize_threads(nic);

PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
- deinit_irq(g_linux_wlan);
+ deinit_irq(wilc1000_dev);

wilc_wlan_stop();

@@ -922,18 +922,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");

- mutex_lock(&g_linux_wlan->hif_cs);
- disable_sdio_interrupt();
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc1000_dev->hif_cs);
+ wilc1000_sdio_disable_interrupt();
+ mutex_unlock(&wilc1000_dev->hif_cs);
#endif
#endif

/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(wilc1000_dev);

/* announce that wilc1000 is not initialized */
- g_linux_wlan->wilc1000_initialized = 0;
+ wilc1000_dev->wilc1000_initialized = 0;

PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");

@@ -947,18 +947,18 @@ static int wlan_init_locks(struct wilc *p_nic)

PRINT_D(INIT_DBG, "Initializing Locks ...\n");

- mutex_init(&g_linux_wlan->hif_cs);
- mutex_init(&g_linux_wlan->rxq_cs);
+ mutex_init(&wilc1000_dev->hif_cs);
+ mutex_init(&wilc1000_dev->rxq_cs);

- spin_lock_init(&g_linux_wlan->txq_spinlock);
- sema_init(&g_linux_wlan->txq_add_to_head_cs, 1);
+ spin_lock_init(&wilc1000_dev->txq_spinlock);
+ sema_init(&wilc1000_dev->txq_add_to_head_cs, 1);

- sema_init(&g_linux_wlan->txq_event, 0);
+ sema_init(&wilc1000_dev->txq_event, 0);

- sema_init(&g_linux_wlan->cfg_event, 0);
- sema_init(&g_linux_wlan->sync_event, 0);
+ sema_init(&wilc1000_dev->cfg_event, 0);
+ sema_init(&wilc1000_dev->sync_event, 0);

- sema_init(&g_linux_wlan->txq_thread_started, 0);
+ sema_init(&wilc1000_dev->txq_thread_started, 0);

return 0;
}
@@ -967,11 +967,11 @@ static int wlan_deinit_locks(struct wilc *nic)
{
PRINT_D(INIT_DBG, "De-Initializing Locks\n");

- if (&g_linux_wlan->hif_cs != NULL)
- mutex_destroy(&g_linux_wlan->hif_cs);
+ if (&wilc1000_dev->hif_cs != NULL)
+ mutex_destroy(&wilc1000_dev->hif_cs);

- if (&g_linux_wlan->rxq_cs != NULL)
- mutex_destroy(&g_linux_wlan->rxq_cs);
+ if (&wilc1000_dev->rxq_cs != NULL)
+ mutex_destroy(&wilc1000_dev->rxq_cs);

return 0;
}
@@ -985,20 +985,20 @@ static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)

#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
- nwi->io_func.io_init = linux_sdio_init;
- nwi->io_func.io_deinit = linux_sdio_deinit;
- nwi->io_func.u.sdio.sdio_cmd52 = linux_sdio_cmd52;
- nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53;
- nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
- nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
+ nwi->io_func.io_init = wilc1000_sdio_init;
+ nwi->io_func.io_deinit = wilc1000_sdio_deinit;
+ nwi->io_func.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52;
+ nwi->io_func.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53;
+ nwi->io_func.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed;
+ nwi->io_func.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed;
#else
nwi->io_func.io_type = HIF_SPI;
- nwi->io_func.io_init = linux_spi_init;
- nwi->io_func.io_deinit = linux_spi_deinit;
- nwi->io_func.u.spi.spi_tx = linux_spi_write;
- nwi->io_func.u.spi.spi_rx = linux_spi_read;
- nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
- nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
+ nwi->io_func.io_init = wilc1000_spi_init;
+ nwi->io_func.io_deinit = wilc1000_spi_deinit;
+ nwi->io_func.u.spi.spi_tx = wilc1000_spi_write;
+ nwi->io_func.u.spi.spi_rx = wilc1000_spi_read;
+ nwi->io_func.u.spi.spi_trx = wilc1000_spi_write_read;
+ nwi->io_func.u.spi.spi_max_speed = wilc1000_spi_set_max_speed;
#endif
}

@@ -1011,44 +1011,44 @@ static int wlan_initialize_threads(perInterface_wlan_t *nic)

/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
- g_linux_wlan->txq_thread = kthread_run(linux_wlan_txq_task, (void *)g_linux_wlan, "K_TXQ_TASK");
- if (g_linux_wlan->txq_thread == NULL) {
+ wilc1000_dev->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wilc1000_dev, "K_TXQ_TASK");
+ if (wilc1000_dev->txq_thread == NULL) {
PRINT_ER("couldn't create TXQ thread\n");
ret = -ENOBUFS;
goto _fail_2;
}
/* wait for TXQ task to start. */
- down(&g_linux_wlan->txq_thread_started);
+ down(&wilc1000_dev->txq_thread_started);

return 0;

_fail_2:
/*De-Initialize 2nd thread*/
- g_linux_wlan->close = 1;
+ wilc1000_dev->close = 1;

- g_linux_wlan->close = 0;
+ wilc1000_dev->close = 0;
return ret;
}

static void wlan_deinitialize_threads(struct wilc *nic)
{

- g_linux_wlan->close = 1;
+ wilc1000_dev->close = 1;
PRINT_D(INIT_DBG, "Deinitializing Threads\n");

- if (&g_linux_wlan->txq_event != NULL)
- up(&g_linux_wlan->txq_event);
+ if (&wilc1000_dev->txq_event != NULL)
+ up(&wilc1000_dev->txq_event);

- if (g_linux_wlan->txq_thread != NULL) {
- kthread_stop(g_linux_wlan->txq_thread);
- g_linux_wlan->txq_thread = NULL;
+ if (wilc1000_dev->txq_thread != NULL) {
+ kthread_stop(wilc1000_dev->txq_thread);
+ wilc1000_dev->txq_thread = NULL;
}
}

#ifdef COMPLEMENT_BOOT

-extern volatile int probe;
-extern u8 core_11b_ready(void);
+extern volatile int wilc1000_probe;
+extern u8 wilc1000_core_11b_ready(void);

#define READY_CHECK_THRESHOLD 30
extern void wilc_wlan_global_reset(void);
@@ -1056,7 +1056,7 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
{
u8 trials = 0;

- while ((core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
+ while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
wilc_wlan_cleanup();
wilc_wlan_global_reset();
@@ -1070,10 +1070,10 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)

sdio_register_driver(&wilc_bus);

- while (!probe)
+ while (!wilc1000_probe)
msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
+ wilc1000_probe = 0;
+ wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
linux_to_wlan(nwi, nic);
wilc_wlan_init(nwi);
}
@@ -1103,26 +1103,26 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
sdio_register_driver(&wilc_bus);

/* msleep(1000); */
- while (!probe)
+ while (!wilc1000_probe)
msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- linux_to_wlan(&nwi, g_linux_wlan);
+ wilc1000_probe = 0;
+ wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+ linux_to_wlan(&nwi, wilc1000_dev);
ret = wilc_wlan_init(&nwi);

- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
+ wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- enable_sdio_interrupt();
+ wilc1000_sdio_enable_interrupt();
#endif

- if (linux_wlan_get_firmware(nic)) {
+ if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
ret = -1;
goto __fail__;
}

/*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
+ ret = linux_wlan_firmware_download(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
goto __fail__;
@@ -1142,14 +1142,14 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
perInterface_wlan_t *nic = p_nic;
int ret = 0;

- if (!g_linux_wlan->wilc1000_initialized) {
- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
- g_linux_wlan->close = 0;
- g_linux_wlan->wilc1000_initialized = 0;
+ if (!wilc1000_dev->wilc1000_initialized) {
+ wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
+ wilc1000_dev->close = 0;
+ wilc1000_dev->wilc1000_initialized = 0;

- wlan_init_locks(g_linux_wlan);
+ wlan_init_locks(wilc1000_dev);

- linux_to_wlan(&nwi, g_linux_wlan);
+ linux_to_wlan(&nwi, wilc1000_dev);

ret = wilc_wlan_init(&nwi);
if (ret < 0) {
@@ -1166,7 +1166,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
- if (wilc1000_prepare_11b_core(&nwi, g_linux_wlan)) {
+ if (wilc1000_prepare_11b_core(&nwi, wilc1000_dev)) {
PRINT_ER("11b Core is not ready\n");
ret = -EIO;
goto _fail_threads_;
@@ -1174,7 +1174,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
#endif

#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(g_linux_wlan)) {
+ if (init_irq(wilc1000_dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_threads_;
@@ -1182,21 +1182,21 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
#endif

#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- if (enable_sdio_interrupt()) {
+ if (wilc1000_sdio_enable_interrupt()) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}
#endif

- if (linux_wlan_get_firmware(nic)) {
+ if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}

/*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
+ ret = linux_wlan_firmware_download(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1224,7 +1224,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
}
/* Initialize firmware with default configuration */
- ret = linux_wlan_init_test_config(dev, g_linux_wlan);
+ ret = linux_wlan_init_test_config(dev, wilc1000_dev);

if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
@@ -1232,7 +1232,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}

- g_linux_wlan->wilc1000_initialized = 1;
+ wilc1000_dev->wilc1000_initialized = 1;
return 0; /*success*/

_fail_fw_start_:
@@ -1240,19 +1240,19 @@ _fail_fw_start_:

_fail_irq_enable_:
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- disable_sdio_interrupt();
+ wilc1000_sdio_disable_interrupt();
_fail_irq_init_:
#endif
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(g_linux_wlan);
+ deinit_irq(wilc1000_dev);

#endif
_fail_threads_:
- wlan_deinitialize_threads(g_linux_wlan);
+ wlan_deinitialize_threads(wilc1000_dev);
_fail_wilc_wlan_:
wilc_wlan_cleanup();
_fail_locks_:
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(wilc1000_dev);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
@@ -1275,7 +1275,7 @@ static int mac_init_fn(struct net_device *ndev)
}

/* This fn is called, when this device is setup using ifconfig */
-int mac_open(struct net_device *ndev)
+int wilc1000_mac_open(struct net_device *ndev)
{
perInterface_wlan_t *nic;

@@ -1287,7 +1287,7 @@ int mac_open(struct net_device *ndev)
struct wilc_priv *priv;

#ifdef WILC_SPI
- if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
+ if (!wilc1000_dev || !wilc1000_dev->wilc_spidev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
@@ -1312,22 +1312,22 @@ int mac_open(struct net_device *ndev)
return ret;
}

- Set_machw_change_vir_if(false);
+ wilc1000_set_machw_change_vir_if(false);

- host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add);
+ wilc1000_get_mac_address(priv->hWILCWFIDrv, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);

/* loop through the NUM of supported devices and set the MAC address */
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) {
- memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN);
- g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv;
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ if (ndev == wilc1000_dev->strInterfaceInfo[i].wilc_netdev) {
+ memcpy(wilc1000_dev->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN);
+ wilc1000_dev->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv;
break;
}
}

/* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/
- memcpy(ndev->dev_addr, g_linux_wlan->strInterfaceInfo[i].aSrcAddress, ETH_ALEN);
+ memcpy(ndev->dev_addr, wilc1000_dev->strInterfaceInfo[i].aSrcAddress, ETH_ALEN);

if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
@@ -1340,13 +1340,13 @@ int mac_open(struct net_device *ndev)
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
- g_linux_wlan->open_ifcs++;
+ wilc1000_dev->open_ifcs++;
nic->mac_opened = 1;
return 0;

_err_:
wilc_deinit_host_int(ndev);
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(wilc1000_dev);
return ret;
}

@@ -1387,27 +1387,27 @@ static void wilc_set_multicast_list(struct net_device *dev)
if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
/* get all multicast packets */
- host_int_setup_multicast_filter(pstrWFIDrv, false, 0);
+ wilc1000_setup_multicast_filter(pstrWFIDrv, false, 0);
return;
}

/* No multicast? Just get our own stuff */
if ((dev->mc.count) == 0) {
PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
- host_int_setup_multicast_filter(pstrWFIDrv, true, 0);
+ wilc1000_setup_multicast_filter(pstrWFIDrv, true, 0);
return;
}

/* Store all of the multicast addresses in the hardware filter */
netdev_for_each_mc_addr(ha, dev)
{
- memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN);
+ memcpy(wilc1000_multicast_mac_addr_list[i], ha->addr, ETH_ALEN);
PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i,
- gau8MulticastMacAddrList[i][0], gau8MulticastMacAddrList[i][1], gau8MulticastMacAddrList[i][2], gau8MulticastMacAddrList[i][3], gau8MulticastMacAddrList[i][4], gau8MulticastMacAddrList[i][5]);
+ wilc1000_multicast_mac_addr_list[i][0], wilc1000_multicast_mac_addr_list[i][1], wilc1000_multicast_mac_addr_list[i][2], wilc1000_multicast_mac_addr_list[i][3], wilc1000_multicast_mac_addr_list[i][4], wilc1000_multicast_mac_addr_list[i][5]);
i++;
}

- host_int_setup_multicast_filter(pstrWFIDrv, true, (dev->mc.count));
+ wilc1000_setup_multicast_filter(pstrWFIDrv, true, (dev->mc.count));

return;

@@ -1427,7 +1427,7 @@ static void linux_wlan_tx_complete(void *priv, int status)
kfree(pv_data);
}

-int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
+int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
{
perInterface_wlan_t *nic;
struct tx_complete_data *tx_data = NULL;
@@ -1479,20 +1479,20 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = g_linux_wlan->strInterfaceInfo[nic->u8IfIdx].aBSSID;
+ tx_data->pBssid = wilc1000_dev->strInterfaceInfo[nic->u8IfIdx].aBSSID;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
tx_data->size,
linux_wlan_tx_complete);

if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ netif_stop_queue(wilc1000_dev->strInterfaceInfo[0].wilc_netdev);
+ netif_stop_queue(wilc1000_dev->strInterfaceInfo[1].wilc_netdev);
}

return 0;
}

-int mac_close(struct net_device *ndev)
+int wilc1000_mac_close(struct net_device *ndev)
{
struct wilc_priv *priv;
perInterface_wlan_t *nic;
@@ -1516,8 +1516,8 @@ int mac_close(struct net_device *ndev)

PRINT_D(GENERIC_DBG, "Mac close\n");

- if (g_linux_wlan == NULL) {
- PRINT_ER("g_linux_wlan = NULL\n");
+ if (wilc1000_dev == NULL) {
+ PRINT_ER("wilc1000_dev = NULL\n");
return 0;
}

@@ -1526,8 +1526,8 @@ int mac_close(struct net_device *ndev)
return 0;
}

- if ((g_linux_wlan->open_ifcs) > 0) {
- g_linux_wlan->open_ifcs--;
+ if ((wilc1000_dev->open_ifcs) > 0) {
+ wilc1000_dev->open_ifcs--;
} else {
PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
return 0;
@@ -1540,10 +1540,10 @@ int mac_close(struct net_device *ndev)
wilc_deinit_host_int(nic->wilc_netdev);
}

- if (g_linux_wlan->open_ifcs == 0) {
+ if (wilc1000_dev->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
- g_linux_wlan->close = 1;
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_dev->close = 1;
+ wilc1000_wlan_deinit(wilc1000_dev);
WILC_WFI_deinit_mon_interface();
}

@@ -1566,7 +1566,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
nic = netdev_priv(ndev);

- if (!g_linux_wlan->wilc1000_initialized)
+ if (!wilc1000_dev->wilc1000_initialized)
return 0;

switch (cmd) {
@@ -1586,7 +1586,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)

if (strncasecmp(buff, "RSSI", length) == 0) {
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
- s32Error = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi));
+ s32Error = wilc1000_get_rssi(priv->hWILCWFIDrv, &(rssi));
if (s32Error)
PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
@@ -1650,8 +1650,8 @@ void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
return;
}

- if (g_linux_wlan == NULL || wilc_netdev == NULL)
- PRINT_ER("wilc_netdev in g_linux_wlan is NULL");
+ if (wilc1000_dev == NULL || wilc_netdev == NULL)
+ PRINT_ER("wilc_netdev in wilc1000_dev is NULL");
skb->dev = wilc_netdev;

if (skb->dev == NULL)
@@ -1689,18 +1689,18 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)

/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ for (i = 0; i < wilc1000_dev->u8NoIfcs; i++) {
+ nic = netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}

- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); /* p2p0 */
+ nic = netdev_priv(wilc1000_dev->strInterfaceInfo[1].wilc_netdev); /* p2p0 */
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
(buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
- WILC_WFI_p2p_rx(g_linux_wlan->strInterfaceInfo[1].wilc_netdev, buff, size);
+ WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, buff, size);
}

int wilc_netdev_init(void)
@@ -1713,8 +1713,8 @@ int wilc_netdev_init(void)
sema_init(&close_exit_sync, 0);

/*create the common structure*/
- g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
- if (!g_linux_wlan)
+ wilc1000_dev = kzalloc(sizeof(*wilc1000_dev), GFP_KERNEL);
+ if (!wilc1000_dev)
return -ENOMEM;

register_inetaddr_notifier(&g_dev_notifier);
@@ -1742,10 +1742,10 @@ int wilc_netdev_init(void)
} else
strcpy(ndev->name, "p2p%d");

- nic->u8IfIdx = g_linux_wlan->u8NoIfcs;
+ nic->u8IfIdx = wilc1000_dev->u8NoIfcs;
nic->wilc_netdev = ndev;
- g_linux_wlan->strInterfaceInfo[g_linux_wlan->u8NoIfcs].wilc_netdev = ndev;
- g_linux_wlan->u8NoIfcs++;
+ wilc1000_dev->strInterfaceInfo[wilc1000_dev->u8NoIfcs].wilc_netdev = ndev;
+ wilc1000_dev->u8NoIfcs++;
ndev->netdev_ops = &wilc_netdev_ops;

{
@@ -1755,7 +1755,7 @@ int wilc_netdev_init(void)

#ifdef WILC_SDIO
/* set netdev, tony */
- SET_NETDEV_DEV(ndev, &local_sdio_func->dev);
+ SET_NETDEV_DEV(ndev, &wilc1000_sdio_func->dev);
#endif

if (wdev == NULL) {
@@ -1785,13 +1785,13 @@ int wilc_netdev_init(void)
}

#ifndef WILC_SDIO
- if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) {
+ if (!wilc1000_spi_init(&wilc1000_dev->wilc_spidev)) {
PRINT_ER("Can't initialize SPI\n");
return -1; /* ERROR */
}
- g_linux_wlan->wilc_spidev = wilc_spi_dev;
+ wilc1000_dev->wilc_spidev = wilc_spi_dev;
#else
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
+ wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
#endif

return 0;
@@ -1839,22 +1839,22 @@ static void __exit exit_wilc_driver(void)
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
#define CLOSE_TIMEOUT (12 * 1000)

- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
+ || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
unregister_inetaddr_notifier(&g_dev_notifier);

for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ nic[i] = netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}

- if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
+ if ((wilc1000_dev != NULL) && wilc1000_dev->wilc_firmware != NULL) {
+ release_firmware(wilc1000_dev->wilc_firmware);
+ wilc1000_dev->wilc_firmware = NULL;
}

- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
- PRINT_D(INIT_DBG, "Waiting for mac_close ....\n");
+ if ((wilc1000_dev != NULL) && (((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
+ || ((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+ PRINT_D(INIT_DBG, "Waiting for wilc1000_mac_close ....\n");

if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
PRINT_D(INIT_DBG, "Closed TimedOUT\n");
@@ -1863,18 +1863,18 @@ static void __exit exit_wilc_driver(void)

for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
/* close all opened interfaces */
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) {
+ if (wilc1000_dev->strInterfaceInfo[i].wilc_netdev != NULL) {
if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ wilc1000_mac_close(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}
}
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- unregister_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ PRINT_D(INIT_DBG, "Unregistering netdev %p\n", wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
+ unregister_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
- wilc_free_wiphy(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ wilc_free_wiphy(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
PRINT_D(INIT_DBG, "Freeing netdev...\n");
- free_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ free_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}
}

@@ -1886,8 +1886,8 @@ static void __exit exit_wilc_driver(void)
sdio_unregister_driver(&wilc_bus);
#endif

- kfree(g_linux_wlan);
- g_linux_wlan = NULL;
+ kfree(wilc1000_dev);
+ wilc1000_dev = NULL;
printk("Module_exit Done.\n");

#if defined(WILC_DEBUGFS)
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h
index 2b76e41ebd4d..7bd626196e10 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -41,8 +41,8 @@ enum debug_region {
int wilc_debugfs_init(void);
void wilc_debugfs_remove(void);

-extern atomic_t REGION;
-extern atomic_t DEBUG_LEVEL;
+extern atomic_t WILC1000_REGION;
+extern atomic_t WILC1000_DEBUG_LEVEL;

#define DEBUG BIT(0)
#define INFO BIT(1)
@@ -51,8 +51,8 @@ extern atomic_t DEBUG_LEVEL;

#define PRINT_D(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & DEBUG) && \
- ((atomic_read(&REGION)) & (region))) { \
+ if ((atomic_read(&WILC1000_DEBUG_LEVEL) & DEBUG) && \
+ ((atomic_read(&WILC1000_REGION)) & (region))) { \
printk("DBG [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
@@ -60,8 +60,8 @@ extern atomic_t DEBUG_LEVEL;

#define PRINT_INFO(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & INFO) && \
- ((atomic_read(&REGION)) & (region))) { \
+ if ((atomic_read(&WILC1000_DEBUG_LEVEL) & INFO) && \
+ ((atomic_read(&WILC1000_REGION)) & (region))) { \
printk("INFO [%s]", __func__); \
printk(__VA_ARGS__); \
} \
@@ -69,8 +69,8 @@ extern atomic_t DEBUG_LEVEL;

#define PRINT_WRN(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & WRN) && \
- ((atomic_read(&REGION)) & (region))) { \
+ if ((atomic_read(&WILC1000_DEBUG_LEVEL) & WRN) && \
+ ((atomic_read(&WILC1000_REGION)) & (region))) { \
printk("WRN [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
@@ -78,7 +78,7 @@ extern atomic_t DEBUG_LEVEL;

#define PRINT_ER(...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & ERR)) { \
+ if ((atomic_read(&WILC1000_DEBUG_LEVEL) & ERR)) { \
printk("ERR [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 96558accf877..470f4bf372f1 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -22,7 +22,7 @@
#endif


-struct sdio_func *local_sdio_func;
+struct sdio_func *wilc1000_sdio_func;
extern int wilc_netdev_init(void);
extern void wilc_handle_isr(void);

@@ -47,9 +47,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
#endif


-int linux_sdio_cmd52(sdio_cmd52_t *cmd)
+int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
{
- struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
+ struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
int ret;
u8 data;

@@ -79,9 +79,9 @@ int linux_sdio_cmd52(sdio_cmd52_t *cmd)
}


-int linux_sdio_cmd53(sdio_cmd53_t *cmd)
+int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
{
- struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
+ struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
int size, ret;

sdio_claim_host(func);
@@ -110,21 +110,21 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
return 1;
}

-volatile int probe; /* COMPLEMENT_BOOT */
+volatile int wilc1000_probe; /* COMPLEMENT_BOOT */
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
PRINT_D(INIT_DBG, "probe function\n");

#ifdef COMPLEMENT_BOOT
- if (local_sdio_func != NULL) {
- local_sdio_func = func;
- probe = 1;
- PRINT_D(INIT_DBG, "local_sdio_func isn't NULL\n");
+ if (wilc1000_sdio_func != NULL) {
+ wilc1000_sdio_func = func;
+ wilc1000_probe = 1;
+ PRINT_D(INIT_DBG, "wilc1000_sdio_func isn't NULL\n");
return 0;
}
#endif
PRINT_D(INIT_DBG, "Initializing netdev\n");
- local_sdio_func = func;
+ wilc1000_sdio_func = func;
if (wilc_netdev_init()) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
@@ -149,14 +149,14 @@ struct sdio_driver wilc_bus = {
.remove = linux_sdio_remove,
};

-int enable_sdio_interrupt(void)
+int wilc1000_sdio_enable_interrupt(void)
{
int ret = 0;
#ifndef WILC_SDIO_IRQ_GPIO

- sdio_claim_host(local_sdio_func);
- ret = sdio_claim_irq(local_sdio_func, wilc_sdio_interrupt);
- sdio_release_host(local_sdio_func);
+ sdio_claim_host(wilc1000_sdio_func);
+ ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
+ sdio_release_host(wilc1000_sdio_func);

if (ret < 0) {
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
@@ -166,22 +166,22 @@ int enable_sdio_interrupt(void)
return ret;
}

-void disable_sdio_interrupt(void)
+void wilc1000_sdio_disable_interrupt(void)
{

#ifndef WILC_SDIO_IRQ_GPIO
int ret;

- PRINT_D(INIT_DBG, "disable_sdio_interrupt IN\n");
+ PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");

- sdio_claim_host(local_sdio_func);
- ret = sdio_release_irq(local_sdio_func);
+ sdio_claim_host(wilc1000_sdio_func);
+ ret = sdio_release_irq(wilc1000_sdio_func);
if (ret < 0) {
PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
}
- sdio_release_host(local_sdio_func);
+ sdio_release_host(wilc1000_sdio_func);

- PRINT_D(INIT_DBG, "disable_sdio_interrupt OUT\n");
+ PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
#endif
}

@@ -189,13 +189,13 @@ static int linux_sdio_set_speed(int speed)
{
struct mmc_ios ios;

- sdio_claim_host(local_sdio_func);
+ sdio_claim_host(wilc1000_sdio_func);

- memcpy((void *)&ios, (void *)&local_sdio_func->card->host->ios, sizeof(struct mmc_ios));
- local_sdio_func->card->host->ios.clock = speed;
+ memcpy((void *)&ios, (void *)&wilc1000_sdio_func->card->host->ios, sizeof(struct mmc_ios));
+ wilc1000_sdio_func->card->host->ios.clock = speed;
ios.clock = speed;
- local_sdio_func->card->host->ops->set_ios(local_sdio_func->card->host, &ios);
- sdio_release_host(local_sdio_func);
+ wilc1000_sdio_func->card->host->ops->set_ios(wilc1000_sdio_func->card->host, &ios);
+ sdio_release_host(wilc1000_sdio_func);
PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed);

return 1;
@@ -203,10 +203,10 @@ static int linux_sdio_set_speed(int speed)

static int linux_sdio_get_speed(void)
{
- return local_sdio_func->card->host->ios.clock;
+ return wilc1000_sdio_func->card->host->ios.clock;
}

-int linux_sdio_init(void *pv)
+int wilc1000_sdio_init(void *pv)
{

/**
@@ -218,7 +218,7 @@ int linux_sdio_init(void *pv)
return 1;
}

-void linux_sdio_deinit(void *pv)
+void wilc1000_sdio_deinit(void *pv)
{

/**
@@ -229,12 +229,12 @@ void linux_sdio_deinit(void *pv)
sdio_unregister_driver(&wilc_bus);
}

-int linux_sdio_set_max_speed(void)
+int wilc1000_sdio_set_max_speed(void)
{
return linux_sdio_set_speed(MAX_SPEED);
}

-int linux_sdio_set_default_speed(void)
+int wilc1000_sdio_set_default_speed(void)
{
return linux_sdio_set_speed(sdio_default_speed);
}
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 4b515f5108e7..ff0a37b880c2 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,14 +1,14 @@
-extern struct sdio_func *local_sdio_func;
+extern struct sdio_func *wilc1000_sdio_func;
extern struct sdio_driver wilc_bus;

#include <linux/mmc/sdio_func.h>

-int linux_sdio_init(void *);
-void linux_sdio_deinit(void *);
-int linux_sdio_cmd52(sdio_cmd52_t *cmd);
-int linux_sdio_cmd53(sdio_cmd53_t *cmd);
-int enable_sdio_interrupt(void);
-void disable_sdio_interrupt(void);
-int linux_sdio_set_max_speed(void);
-int linux_sdio_set_default_speed(void);
+int wilc1000_sdio_init(void *);
+void wilc1000_sdio_deinit(void *);
+int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd);
+int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd);
+int wilc1000_sdio_enable_interrupt(void);
+void wilc1000_sdio_disable_interrupt(void);
+int wilc1000_sdio_set_max_speed(void);
+int wilc1000_sdio_set_default_speed(void);

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 039d06192d6b..8d8310681658 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -42,7 +42,7 @@
static u32 SPEED = MIN_SPEED;

struct spi_device *wilc_spi_dev;
-void linux_spi_deinit(void *vp);
+void wilc1000_spi_deinit(void *vp);

static int __init wilc_bus_probe(struct spi_device *spi)
{
@@ -81,7 +81,7 @@ struct spi_driver wilc_bus __refdata = {
};


-void linux_spi_deinit(void *vp)
+void wilc1000_spi_deinit(void *vp)
{

spi_unregister_driver(&wilc_bus);
@@ -93,7 +93,7 @@ void linux_spi_deinit(void *vp)



-int linux_spi_init(void *vp)
+int wilc1000_spi_init(void *vp)
{
int ret = 1;
static int called;
@@ -116,7 +116,7 @@ int linux_spi_init(void *vp)

#if defined(TXRX_PHASE_SIZE)

-int linux_spi_write(u8 *b, u32 len)
+int wilc1000_spi_write(u8 *b, u32 len)
{
int ret;

@@ -193,7 +193,7 @@ int linux_spi_write(u8 *b, u32 len)
}

#else
-int linux_spi_write(u8 *b, u32 len)
+int wilc1000_spi_write(u8 *b, u32 len)
{

int ret;
@@ -244,7 +244,7 @@ int linux_spi_write(u8 *b, u32 len)

#if defined(TXRX_PHASE_SIZE)

-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc1000_spi_read(u8 *rb, u32 rlen)
{
int ret;

@@ -318,7 +318,7 @@ int linux_spi_read(u8 *rb, u32 rlen)
}

#else
-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc1000_spi_read(u8 *rb, u32 rlen)
{

int ret;
@@ -363,7 +363,7 @@ int linux_spi_read(u8 *rb, u32 rlen)

#endif

-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
{

int ret;
@@ -400,7 +400,7 @@ int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
return ret;
}

-int linux_spi_set_max_speed(void)
+int wilc1000_spi_set_max_speed(void)
{
SPEED = MAX_SPEED;

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index 7356785296f9..efa95e3e8bfe 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -5,10 +5,10 @@
extern struct spi_device *wilc_spi_dev;
extern struct spi_driver wilc_bus;

-int linux_spi_init(void *vp);
-void linux_spi_deinit(void *vp);
-int linux_spi_write(u8 *b, u32 len);
-int linux_spi_read(u8 *rb, u32 rlen);
-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
-int linux_spi_set_max_speed(void);
+int wilc1000_spi_init(void *vp);
+void wilc1000_spi_deinit(void *vp);
+int wilc1000_spi_write(u8 *b, u32 len);
+int wilc1000_spi_read(u8 *rb, u32 rlen);
+int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
+int wilc1000_spi_set_max_speed(void);
#endif
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index ae111862e7a9..c22f0ca10250 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -26,8 +26,8 @@ static struct dentry *wilc_dir;

#define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
-atomic_t REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
-atomic_t DEBUG_LEVEL = ATOMIC_INIT(ERR);
+atomic_t WILC1000_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+atomic_t WILC1000_DEBUG_LEVEL = ATOMIC_INIT(ERR);

/*
* --------------------------------------------------------------------------------
@@ -43,7 +43,7 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si
if (*ppos > 0)
return 0;

- res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&DEBUG_LEVEL));
+ res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC1000_DEBUG_LEVEL));

return simple_read_from_buffer(userbuf, count, ppos, buf, res);
}
@@ -59,11 +59,11 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf,
return ret;

if (flag > DBG_LEVEL_ALL) {
- printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));
+ printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC1000_DEBUG_LEVEL));
return -EINVAL;
}

- atomic_set(&DEBUG_LEVEL, (int)flag);
+ atomic_set(&WILC1000_DEBUG_LEVEL, (int)flag);

if (flag == 0)
printk("Debug-level disabled\n");
@@ -82,7 +82,7 @@ static ssize_t wilc_debug_region_read(struct file *file, char __user *userbuf, s
if (*ppos > 0)
return 0;

- res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&REGION));
+ res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&WILC1000_REGION));

return simple_read_from_buffer(userbuf, count, ppos, buf, res);
}
@@ -102,12 +102,12 @@ static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_
flag = buffer[0] - '0';

if (flag > DBG_REGION_ALL) {
- printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&REGION));
+ printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC1000_REGION));
return -EFAULT;
}

- atomic_set(&REGION, (int)flag);
- printk("new debug-region is %x\n", atomic_read(&REGION));
+ atomic_set(&WILC1000_REGION, (int)flag);
+ printk("new debug-region is %x\n", atomic_read(&WILC1000_REGION));

return count;
}
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 4425b5f369e0..91b626ac8797 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -936,7 +936,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
*
********************************************/

-wilc_hif_func_t hif_sdio = {
+wilc_hif_func_t wilc1000_hif_sdio = {
sdio_init,
sdio_deinit,
sdio_read_reg,
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 732c3f8c7f32..bb7ee37171ce 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1031,7 +1031,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
* Global spi HIF function table
*
********************************************/
-wilc_hif_func_t hif_spi = {
+wilc_hif_func_t wilc1000_hif_spi = {
spi_init,
spi_deinit,
spi_read_reg,
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c54c9fce41e7..672741632f85 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -21,21 +21,21 @@
#define IS_MGMT_STATUS_SUCCES 0x040
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)

-extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern u16 Set_machw_change_vir_if(bool bValue);
+extern int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic);
+extern u16 wilc1000_set_machw_change_vir_if(bool bValue);

-extern int mac_open(struct net_device *ndev);
-extern int mac_close(struct net_device *ndev);
+extern int wilc1000_mac_open(struct net_device *ndev);
+extern int wilc1000_mac_close(struct net_device *ndev);

static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
static u32 u32LastScannedNtwrksCountShadow;
-struct timer_list hDuringIpTimer;
+struct timer_list wilc1000_during_ip_timer;
static struct timer_list hAgingTimer;
static u8 op_ifcs;
-extern u8 u8ConnectedSSID[6];
+extern u8 wilc1000_connected_SSID[6];

-u8 g_wilc_initialized = 1;
-extern bool g_obtainingIP;
+u8 wilc1000_initialized = 1;
+extern bool wilc1000_optaining_ip;

#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
@@ -142,7 +142,7 @@ static void clear_shadow_scan(void *pUserVoid)
astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL;
}

- host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams);
+ wilc1000_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
astrLastScannedNtwrksShadow[i].pJoinParams = NULL;
}
u32LastScannedNtwrksCountShadow = 0;
@@ -235,7 +235,7 @@ static void remove_network_from_shadow(unsigned long arg)
kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
astrLastScannedNtwrksShadow[i].pu8IEs = NULL;

- host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams);
+ wilc1000_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);

for (j = i; (j < u32LastScannedNtwrksCountShadow - 1); j++) {
astrLastScannedNtwrksShadow[j] = astrLastScannedNtwrksShadow[j + 1];
@@ -256,7 +256,7 @@ static void remove_network_from_shadow(unsigned long arg)
static void clear_duringIP(unsigned long arg)
{
PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n");
- g_obtainingIP = false;
+ wilc1000_optaining_ip = false;
}

static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
@@ -334,7 +334,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserV
astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScanCached = jiffies;
astrLastScannedNtwrksShadow[ap_index].u8Found = 1;
if (ap_found != -1)
- host_int_freeJoinParams(astrLastScannedNtwrksShadow[ap_index].pJoinParams);
+ wilc1000_free_join_params(astrLastScannedNtwrksShadow[ap_index].pJoinParams);
astrLastScannedNtwrksShadow[ap_index].pJoinParams = pJoinParams;

}
@@ -473,7 +473,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
}


-int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
+int wilc1000_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);


/**
@@ -490,7 +490,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
* @date 01 MAR 2012
* @version 1.0
*/
-int connecting;
+int wilc1000_connecting;

static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
tstrConnectInfo *pstrConnectInfo,
@@ -503,7 +503,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};

- connecting = 0;
+ wilc1000_connecting = 0;

priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
@@ -522,8 +522,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
/* The case here is that our station was waiting for association response frame and has just received it containing status code
* = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */
u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
- linux_wlan_set_bssid(priv->dev, NullBssid);
- eth_zero_addr(u8ConnectedSSID);
+ wilc1000_wlan_set_bssid(priv->dev, NullBssid);
+ eth_zero_addr(wilc1000_connected_SSID);

/*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->u8P2PConnect)
@@ -574,27 +574,27 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */
/* be replaced by pstrConnectInfo->u16ConnectStatus */
} else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
- g_obtainingIP = false;
+ wilc1000_optaining_ip = false;
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
pstrDisconnectNotifInfo->u16reason, priv->dev);
u8P2Plocalrandom = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
eth_zero_addr(priv->au8AssociatedBss);
- linux_wlan_set_bssid(priv->dev, NullBssid);
- eth_zero_addr(u8ConnectedSSID);
+ wilc1000_wlan_set_bssid(priv->dev, NullBssid);
+ eth_zero_addr(wilc1000_connected_SSID);

/*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->u8P2PConnect)
u8WLANChannel = INVALID_CHANNEL;
/*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change
* virtual interface to station*/
- if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->strInterfaceInfo[1].wilc_netdev)) {
+ if ((pstrWFIDrv->IFC_UP) && (dev == wilc1000_dev->strInterfaceInfo[1].wilc_netdev)) {
pstrDisconnectNotifInfo->u16reason = 3;
}
/*Incase "P2P CLIENT during connection(not connected)" send deauthentication reason by 1 to force the WPA_SUPPLICANT
* to scan again and retry the connection*/
- else if ((!pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->strInterfaceInfo[1].wilc_netdev)) {
+ else if ((!pstrWFIDrv->IFC_UP) && (dev == wilc1000_dev->strInterfaceInfo[1].wilc_netdev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
@@ -632,7 +632,7 @@ static int set_channel(struct wiphy *wiphy,
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);

curr_channel = channelnum;
- result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+ result = wilc1000_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);

if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
@@ -667,7 +667,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)

priv->u32RcvdChCount = 0;

- host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc1000_set_wfi_drv_handler(priv->hWILCWFIDrv);


reset_shadow_found(priv);
@@ -704,13 +704,13 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
}
}
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc1000_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, &strHiddenNetwork);
} else {
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc1000_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, NULL);
@@ -757,11 +757,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
tstrNetworkInfo *pstrNetworkInfo = NULL;


- connecting = 1;
+ wilc1000_connecting = 1;
priv = wiphy_priv(wiphy);
pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);

- host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc1000_set_wfi_drv_handler(priv->hWILCWFIDrv);

PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -853,8 +853,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, sme->key_idx);
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc1000_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
+ wilc1000_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
pcgroup_encrypt_val = "WEP104";
@@ -870,8 +870,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;

- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, sme->key_idx);
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc1000_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
+ wilc1000_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) {
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
@@ -963,15 +963,15 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
u8WLANChannel = pstrNetworkInfo->u8channel;
}

- linux_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
+ wilc1000_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);

- s32Error = host_int_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
+ s32Error = wilc1000_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
CfgConnectResult, (void *)priv, u8security,
tenuAuth_type, pstrNetworkInfo->u8channel,
pstrNetworkInfo->pJoinParams);
if (s32Error != 0) {
- PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error);
+ PRINT_ER("wilc1000_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
goto done;
}
@@ -998,14 +998,14 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};

- connecting = 0;
+ wilc1000_connecting = 0;
priv = wiphy_priv(wiphy);

/*Invalidate u8WLANChannel value on wlan0 disconnect*/
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!pstrWFIDrv->u8P2PConnect)
u8WLANChannel = INVALID_CHANNEL;
- linux_wlan_set_bssid(priv->dev, NullBssid);
+ wilc1000_wlan_set_bssid(priv->dev, NullBssid);

PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code);

@@ -1014,7 +1014,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
bWilc_ie = false;
pstrWFIDrv->u64P2p_MgmtTimeout = 0;

- s32Error = host_int_disconnect(priv->hWILCWFIDrv, reason_code);
+ s32Error = wilc1000_disconnect(priv->hWILCWFIDrv, reason_code);
if (s32Error != 0) {
PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
s32Error = -EINVAL;
@@ -1081,7 +1081,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
else
u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;

- host_int_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
+ wilc1000_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
@@ -1095,7 +1095,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
for (i = 0; i < params->key_len; i++)
PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]);
}
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
+ wilc1000_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
}

break;
@@ -1158,7 +1158,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}


- host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc1000_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode);

} else {
@@ -1203,7 +1203,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wilc_ptk[key_index]->key_len = params->key_len;
priv->wilc_ptk[key_index]->seq_len = params->seq_len;

- host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc1000_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index);
}
break;
@@ -1220,7 +1220,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}

/*save keys only on interface 0 (wifi interface)*/
- if (!g_gtk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_gtk_keys_saved && netdev == wilc1000_dev->strInterfaceInfo[0].wilc_netdev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1245,7 +1245,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_gtk_keys_saved = true;
}

- host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc1000_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -1256,7 +1256,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
}

/*save keys only on interface 0 (wifi interface)*/
- if (!g_ptk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_ptk_keys_saved && netdev == wilc1000_dev->strInterfaceInfo[0].wilc_netdev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
if (!mac_addr) {
@@ -1281,7 +1281,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
g_ptk_keys_saved = true;
}

- host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc1000_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index);
PRINT_D(CFG80211_DBG, "Adding pairwise key\n");
if (INFO) {
@@ -1321,7 +1321,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv = wiphy_priv(wiphy);

/*delete saved keys, if any*/
- if (netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (netdev == wilc1000_dev->strInterfaceInfo[0].wilc_netdev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;
@@ -1366,7 +1366,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
g_key_gtk_params.seq = NULL;

/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- Set_machw_change_vir_if(false);
+ wilc1000_set_machw_change_vir_if(false);
}

if (key_index >= 0 && key_index <= 3) {
@@ -1374,10 +1374,10 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->WILC_WFI_wep_key_len[key_index] = 0;

PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index);
- host_int_remove_wep_key(priv->hWILCWFIDrv, key_index);
+ wilc1000_remove_wep_key(priv->hWILCWFIDrv, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
- host_int_remove_key(priv->hWILCWFIDrv, mac_addr);
+ wilc1000_remove_key(priv->hWILCWFIDrv, mac_addr);
}

return 0;
@@ -1455,7 +1455,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke

if (key_index != priv->WILC_WFI_wep_default) {

- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, key_index);
+ wilc1000_set_wep_default_keyid(priv->hWILCWFIDrv, key_index);
}

return 0;
@@ -1503,7 +1503,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,

sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);

- host_int_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
+ wilc1000_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
sinfo->inactive_time = 1000 * inactive_time;
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);

@@ -1512,7 +1512,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
if (nic->iftype == STATION_MODE) {
struct rf_info strStatistics;

- host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics);
+ wilc1000_get_statistics(priv->hWILCWFIDrv, &strStatistics);

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1527,9 +1527,9 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10;

if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED))
- Enable_TCP_ACK_Filter(true);
+ wilc1000_enable_tcp_ack_filter(true);
else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)
- Enable_TCP_ACK_Filter(false);
+ wilc1000_enable_tcp_ack_filter(false);

PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets,
sinfo->tx_failed, sinfo->txrate.legacy);
@@ -1616,7 +1616,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
}

PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
- s32Error = hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
+ s32Error = wilc1000_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
if (s32Error)
PRINT_ER("Error in setting WIPHY PARAMS\n");

@@ -1671,7 +1671,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,

if (!s32Error) {
PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n");
- s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
+ s32Error = wilc1000_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
}
return s32Error;
}
@@ -2094,7 +2094,7 @@ static int remain_on_channel(struct wiphy *wiphy,
priv->strRemainOnChanParams.u32ListenDuration = duration;
priv->strRemainOnChanParams.u32ListenSessionID++;

- s32Error = host_int_remain_on_channel(priv->hWILCWFIDrv
+ s32Error = wilc1000_remain_on_channel(priv->hWILCWFIDrv
, priv->strRemainOnChanParams.u32ListenSessionID
, duration
, chan->hw_value
@@ -2129,7 +2129,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,

PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");

- s32Error = host_int_ListenStateExpired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
+ s32Error = wilc1000_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
return s32Error;
}
/**
@@ -2156,7 +2156,7 @@ static void WILC_WFI_add_wilcvendorspec(u8 *buff)
* @date 01 JUL 2012
* @version
*/
-extern bool bEnablePS;
+extern bool wilc1000_enable_ps;
static int mgmt_tx(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
@@ -2203,7 +2203,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "TX: Probe Response\n");
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc1000_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
curr_channel = chan->hw_value;
} else if (ieee80211_is_action(mgmt->frame_control)) {
@@ -2218,7 +2218,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC ||
buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) {
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc1000_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
curr_channel = chan->hw_value;
}
@@ -2383,11 +2383,11 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,

}
/*If mac is closed, then return*/
- if (!g_linux_wlan->wilc1000_initialized) {
+ if (!wilc1000_dev->wilc1000_initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
- host_int_frame_register(priv->hWILCWFIDrv, frame_type, reg);
+ wilc1000_frame_register(priv->hWILCWFIDrv, frame_type, reg);


}
@@ -2438,7 +2438,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,

sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);

- host_int_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
+ wilc1000_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));

return 0;

@@ -2470,8 +2470,8 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
return -EIO;
}

- if (bEnablePS)
- host_int_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
+ if (wilc1000_enable_ps)
+ wilc1000_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);


return 0;
@@ -2510,17 +2510,17 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

bWilc_ie = false;

- g_obtainingIP = false;
- del_timer(&hDuringIpTimer);
+ wilc1000_optaining_ip = false;
+ del_timer(&wilc1000_during_ip_timer);
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
/*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
- Set_machw_change_vir_if(true);
+ wilc1000_set_machw_change_vir_if(true);
}

switch (type) {
case NL80211_IFTYPE_STATION:
- connecting = 0;
+ wilc1000_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n");

/* send delba over wlan interface */
@@ -2536,30 +2536,30 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
interface_type = nic->iftype;
nic->iftype = STATION_MODE;

- if (g_linux_wlan->wilc1000_initialized) {
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ if (wilc1000_dev->wilc1000_initialized) {
+ wilc1000_del_all_rx_ba_session(priv->hWILCWFIDrv, wilc1000_dev->strInterfaceInfo[0].aBSSID, TID);
/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
+ wilc1000_wait_msg_queue_idle();

/*Eliminate host interface blocking state*/
- up(&g_linux_wlan->cfg_event);
+ up(&wilc1000_dev->cfg_event);

- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(wilc1000_dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc1000_initialized = 1;
nic->iftype = interface_type;

/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
- host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc1000_set_wfi_drv_handler(wilc1000_dev->strInterfaceInfo[0].drvHandler);
+ wilc1000_set_mac_address(wilc1000_dev->strInterfaceInfo[0].drvHandler,
+ wilc1000_dev->strInterfaceInfo[0].aSrcAddress);
+ wilc1000_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);

/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_set_wep_default_keyid(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_add_wep_key_bss_sta(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2567,7 +2567,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc1000_flush_join_req(priv->hWILCWFIDrv);

/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2577,43 +2577,43 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0],
g_key_gtk_params.key[1],
g_key_gtk_params.key[2]);
- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_ptk_key_params.key_idx,
g_add_ptk_key_params.pairwise,
g_add_ptk_key_params.mac_addr,
(struct key_params *)(&g_key_ptk_params));

- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
(struct key_params *)(&g_key_gtk_params));
}

- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc1000_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
}

- bEnablePS = true;
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
+ wilc1000_enable_ps = true;
+ wilc1000_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
}
break;

case NL80211_IFTYPE_P2P_CLIENT:
- bEnablePS = false;
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
- connecting = 0;
+ wilc1000_enable_ps = false;
+ wilc1000_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+ wilc1000_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");

- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ wilc1000_del_all_rx_ba_session(priv->hWILCWFIDrv, wilc1000_dev->strInterfaceInfo[0].aBSSID, TID);

dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2623,24 +2623,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
nic->iftype = CLIENT_MODE;


- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {
/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
+ wilc1000_wait_msg_queue_idle();

- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(wilc1000_dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc1000_initialized = 1;

- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
- host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc1000_set_wfi_drv_handler(wilc1000_dev->strInterfaceInfo[0].drvHandler);
+ wilc1000_set_mac_address(wilc1000_dev->strInterfaceInfo[0].drvHandler,
+ wilc1000_dev->strInterfaceInfo[0].aSrcAddress);
+ wilc1000_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);

/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_set_wep_default_keyid(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_add_wep_key_bss_sta(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2648,7 +2648,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc1000_flush_join_req(priv->hWILCWFIDrv);

/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2658,15 +2658,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0],
g_key_gtk_params.key[1],
g_key_gtk_params.key[2]);
- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_ptk_key_params.key_idx,
g_add_ptk_key_params.pairwise,
g_add_ptk_key_params.mac_addr,
(struct key_params *)(&g_key_ptk_params));

- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
@@ -2675,13 +2675,13 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

/*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/
refresh_scan(priv, 1, true);
- Set_machw_change_vir_if(false);
+ wilc1000_set_machw_change_vir_if(false);

- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc1000_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2690,7 +2690,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
break;

case NL80211_IFTYPE_AP:
- bEnablePS = false;
+ wilc1000_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_AP %d\n", type);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2698,18 +2698,18 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);

PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
- linux_wlan_get_firmware(nic);
+ wilc1000_wlan_get_firmware(nic);
/*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {
nic->iftype = AP_MODE;
- g_linux_wlan->wilc1000_initialized = 1;
- mac_close(dev);
- mac_open(dev);
+ wilc1000_dev->wilc1000_initialized = 1;
+ wilc1000_mac_close(dev);
+ wilc1000_mac_open(dev);

for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc1000_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2719,15 +2719,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
case NL80211_IFTYPE_P2P_GO:
PRINT_D(GENERIC_DBG, "start duringIP timer\n");

- g_obtainingIP = true;
- mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME));
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+ wilc1000_optaining_ip = true;
+ mod_timer(&wilc1000_during_ip_timer, jiffies + msecs_to_jiffies(duringIP_TIME));
+ wilc1000_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*/
/*hWaitResponse semaphore, which allows previous config*/
/*packets to actually take action on old FW*/
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
- bEnablePS = false;
+ wilc1000_del_all_rx_ba_session(priv->hWILCWFIDrv, wilc1000_dev->strInterfaceInfo[0].aBSSID, TID);
+ wilc1000_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2740,23 +2740,23 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
nic->iftype = GO_MODE;

/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wait_msg_queue_idle();
+ wilc1000_wlan_deinit(wilc1000_dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc1000_initialized = 1;


/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
- host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
+ wilc1000_set_wfi_drv_handler(wilc1000_dev->strInterfaceInfo[0].drvHandler);
+ wilc1000_set_mac_address(wilc1000_dev->strInterfaceInfo[0].drvHandler,
+ wilc1000_dev->strInterfaceInfo[0].aSrcAddress);
+ wilc1000_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);

/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_set_wep_default_keyid(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ wilc1000_add_wep_key_bss_sta(wilc1000_dev->strInterfaceInfo[0].drvHandler,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2764,7 +2764,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,

/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc1000_flush_join_req(priv->hWILCWFIDrv);

/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2776,26 +2776,26 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
g_key_gtk_params.key[1],
g_key_gtk_params.key[2],
g_key_gtk_params.cipher);
- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_ptk_key_params.key_idx,
g_add_ptk_key_params.pairwise,
g_add_ptk_key_params.mac_addr,
(struct key_params *)(&g_key_ptk_params));

- add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
+ add_key(wilc1000_dev->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
+ wilc1000_dev->strInterfaceInfo[0].wilc_netdev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
(struct key_params *)(&g_key_gtk_params));
}

- if (g_linux_wlan->wilc1000_initialized) {
+ if (wilc1000_dev->wilc1000_initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc1000_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2854,9 +2854,9 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");

- linux_wlan_set_bssid(dev, g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ wilc1000_wlan_set_bssid(dev, wilc1000_dev->strInterfaceInfo[0].aSrcAddress);

- s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc1000_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
settings->dtim_period,
beacon->head_len, (u8 *)beacon->head,
@@ -2887,7 +2887,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Setting beacon\n");


- s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc1000_add_beacon(priv->hWILCWFIDrv,
0,
0,
beacon->head_len, (u8 *)beacon->head,
@@ -2918,9 +2918,9 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)

PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");

- linux_wlan_set_bssid(dev, NullBssid);
+ wilc1000_wlan_set_bssid(dev, NullBssid);

- s32Error = host_int_del_beacon(priv->hWILCWFIDrv);
+ s32Error = wilc1000_del_beacon(priv->hWILCWFIDrv);

if (s32Error)
PRINT_ER("Host delete beacon fail\n");
@@ -2989,7 +2989,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask);
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet);

- s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc1000_add_station(priv->hWILCWFIDrv, &strStaParams);
if (s32Error)
PRINT_ER("Host add station fail\n");
}
@@ -3026,12 +3026,12 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,

if (mac == NULL) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n");
- s32Error = host_int_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
+ s32Error = wilc1000_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
} else {
PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

- s32Error = host_int_del_station(priv->hWILCWFIDrv, mac);
+ s32Error = wilc1000_del_station(priv->hWILCWFIDrv, mac);

if (s32Error)
PRINT_ER("Host delete station fail\n");
@@ -3101,7 +3101,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask);
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet);

- s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc1000_edit_station(priv->hWILCWFIDrv, &strStaParams);
if (s32Error)
PRINT_ER("Host edit station fail\n");
}
@@ -3361,7 +3361,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
wdev->wiphy->interface_modes, wdev->iftype);

#ifdef WILC_SDIO
- set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev);
+ set_wiphy_dev(wdev->wiphy, &wilc1000_sdio_func->dev);
#endif

/*Register wiphy structure*/
@@ -3398,7 +3398,7 @@ int wilc_init_host_int(struct net_device *net)
priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) {
setup_timer(&hAgingTimer, remove_network_from_shadow, 0);
- setup_timer(&hDuringIpTimer, clear_duringIP, 0);
+ setup_timer(&wilc1000_during_ip_timer, clear_duringIP, 0);
}
op_ifcs++;
if (s32Error < 0) {
@@ -3411,7 +3411,7 @@ int wilc_init_host_int(struct net_device *net)
priv->bInP2PlistenState = false;

sema_init(&(priv->hSemScanReq), 1);
- s32Error = host_int_init(&priv->hWILCWFIDrv);
+ s32Error = wilc1000_init(&priv->hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");

@@ -3441,13 +3441,13 @@ int wilc_deinit_host_int(struct net_device *net)

op_ifcs--;

- s32Error = host_int_deinit(priv->hWILCWFIDrv);
+ s32Error = wilc1000_deinit(priv->hWILCWFIDrv);

/* Clear the Shadow scan */
clear_shadow_scan(priv);
if (op_ifcs == 0) {
PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
- del_timer_sync(&hDuringIpTimer);
+ del_timer_sync(&wilc1000_during_ip_timer);
}

if (s32Error)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index e7ea397644de..a87982cfcd4b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -103,6 +103,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,

#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
#define DEFAULT_LINK_SPEED 72
-void Enable_TCP_ACK_Filter(bool value);
+void wilc1000_enable_tcp_ack_filter(bool value);

#endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index c5061fd07312..700f6f343b52 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -206,7 +206,7 @@ struct WILC_WFI_mon_priv {
struct net_device *real_ndev;
};

-extern struct wilc *g_linux_wlan;
+extern struct wilc *wilc1000_dev;
extern struct net_device *WILC_WFI_devs[];
void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
void linux_wlan_mac_indicate(int flag);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 83fd41a4f521..140778d8aab5 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -16,11 +16,11 @@
* Global
*
********************************************/
-extern wilc_hif_func_t hif_sdio;
-extern wilc_hif_func_t hif_spi;
+extern wilc_hif_func_t wilc1000_hif_sdio;
+extern wilc_hif_func_t wilc1000_hif_spi;
extern void WILC_WFI_mgmt_rx(u8 *buff, u32 size);
u32 wilc_get_chipid(u8 update);
-u16 Set_machw_change_vir_if(bool bValue);
+u16 wilc1000_set_machw_change_vir_if(bool bValue);



@@ -116,7 +116,7 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
static inline void acquire_bus(BUS_ACQUIRE_T acquire)
{

- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc1000_dev->hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (genuChipPSstate != CHIP_WAKEDUP)
#endif
@@ -132,7 +132,7 @@ static inline void release_bus(BUS_RELEASE_T release)
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wilc1000_dev->hif_cs);
}
/********************************************
*
@@ -171,7 +171,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);
if (p->txq_head) {
tqe = p->txq_head;
p->txq_head = tqe->next;
@@ -186,7 +186,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
} else {
tqe = NULL;
}
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);
return tqe;
}

@@ -194,7 +194,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
{
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -210,25 +210,25 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);

- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);

/**
* wake up TX queue
**/
PRINT_D(TX_DBG, "Wake the txq_handling\n");

- up(&g_linux_wlan->txq_event);
+ up(&wilc1000_dev->txq_event);
}

static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
{
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+ if (linux_wlan_lock_timeout(&wilc1000_dev->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT))
return -1;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -244,14 +244,14 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);

- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
- up(&g_linux_wlan->txq_add_to_head_cs);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);
+ up(&wilc1000_dev->txq_add_to_head_cs);


/**
* wake up TX queue
**/
- up(&g_linux_wlan->txq_event);
+ up(&wilc1000_dev->txq_event);
PRINT_D(TX_DBG, "Wake up the txq_handler\n");

return 0;
@@ -338,9 +338,9 @@ static inline int remove_TCP_related(void)
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);
return 0;
}

@@ -354,7 +354,7 @@ static inline int tcp_process(struct txq_entry_t *tqe)
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)&eth_hdr_ptr[12]));
@@ -402,7 +402,7 @@ static inline int tcp_process(struct txq_entry_t *tqe)
} else {
ret = 0;
}
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);
return ret;
}

@@ -414,7 +414,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
u32 Dropped = 0;
wilc_wlan_dev_t *p = &g_wlan;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, p->txq_spinlock_flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, p->txq_spinlock_flags);
for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) {
if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) {
struct txq_entry_t *tqe;
@@ -440,12 +440,12 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
PendingAcks_arrBase = 0;


- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock,
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock,
p->txq_spinlock_flags);

while (Dropped > 0) {
/*consume the semaphore count of the removed packet*/
- linux_wlan_lock_timeout(&g_linux_wlan->txq_event, 1);
+ linux_wlan_lock_timeout(&wilc1000_dev->txq_event, 1);
Dropped--;
}

@@ -455,7 +455,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)

static bool EnableTCPAckFilter = false;

-void Enable_TCP_ACK_Filter(bool value)
+void wilc1000_enable_tcp_ack_filter(bool value)
{
EnableTCPAckFilter = value;
}
@@ -475,7 +475,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
PRINT_D(TX_DBG, "Adding config packet ...\n");
if (p->quit) {
PRINT_D(TX_DBG, "Return due to clear function\n");
- up(&g_linux_wlan->cfg_event);
+ up(&wilc1000_dev->cfg_event);
return 0;
}

@@ -565,11 +565,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
struct txq_entry_t *tqe;
unsigned long flags;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

tqe = p->txq_head;

- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);


return tqe;
@@ -578,10 +578,10 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe)
{
unsigned long flags;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc1000_dev->txq_spinlock, flags);

tqe = tqe->next;
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc1000_dev->txq_spinlock, flags);


return tqe;
@@ -594,7 +594,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
if (p->quit)
return 0;

- mutex_lock(&g_linux_wlan->rxq_cs);
+ mutex_lock(&wilc1000_dev->rxq_cs);
if (p->rxq_head == NULL) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
@@ -608,7 +608,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
}
p->rxq_entries += 1;
PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries);
- mutex_unlock(&g_linux_wlan->rxq_cs);
+ mutex_unlock(&wilc1000_dev->rxq_cs);
return p->rxq_entries;
}

@@ -620,12 +620,12 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
if (p->rxq_head) {
struct rxq_entry_t *rqe;

- mutex_lock(&g_linux_wlan->rxq_cs);
+ mutex_lock(&wilc1000_dev->rxq_cs);
rqe = p->rxq_head;
p->rxq_head = p->rxq_head->next;
p->rxq_entries -= 1;
PRINT_D(RX_DBG, "RXQ entries decreased\n");
- mutex_unlock(&g_linux_wlan->rxq_cs);
+ mutex_unlock(&wilc1000_dev->rxq_cs);
return rqe;
}
PRINT_D(RX_DBG, "Nothing to get from Q\n");
@@ -790,7 +790,7 @@ static inline void chip_wakeup(void)
genuChipPSstate = CHIP_WAKEDUP;
}
#endif
-void chip_sleep_manually(u32 u32SleepTime)
+void wilc1000_chip_sleep_manually(u32 u32SleepTime)
{
if (genuChipPSstate != CHIP_WAKEDUP) {
/* chip is already sleeping. Do nothing */
@@ -836,7 +836,7 @@ int wilc_wlan_handle_txq(u32 *pu32TxqCount)
if (p->quit)
break;

- linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+ linux_wlan_lock_timeout(&wilc1000_dev->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
#ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack();
@@ -1100,7 +1100,7 @@ _end_:
if (ret != 1)
break;
} while (0);
- up(&g_linux_wlan->txq_add_to_head_cs);
+ up(&wilc1000_dev->txq_add_to_head_cs);

p->txq_exit = 1;
PRINT_D(TX_DBG, "THREAD: Exiting txq\n");
@@ -1124,7 +1124,7 @@ static void wilc_wlan_handle_rxq(void)
do {
if (p->quit) {
PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n");
- up(&g_linux_wlan->cfg_event);
+ up(&wilc1000_dev->cfg_event);
break;
}
rqe = wilc_wlan_rxq_remove();
@@ -1196,7 +1196,7 @@ static void wilc_wlan_handle_rxq(void)
**/
PRINT_D(RX_DBG, "p->cfg_seq_no = %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no);
if (p->cfg_seq_no == rsp.seq_no)
- up(&g_linux_wlan->cfg_event);
+ up(&wilc1000_dev->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
/**
* Call back to indicate status...
@@ -1766,7 +1766,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
ret_size = 0;

- if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ if (linux_wlan_lock_timeout(&wilc1000_dev->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Set Timed Out\n");
ret_size = 0;
@@ -1804,7 +1804,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
ret_size = 0;


- if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ if (linux_wlan_lock_timeout(&wilc1000_dev->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Get Timed Out\n");
ret_size = 0;
@@ -1922,7 +1922,7 @@ _fail_:
}

#ifdef COMPLEMENT_BOOT
-u8 core_11b_ready(void)
+u8 wilc1000_core_11b_ready(void)
{
u32 reg_val;

@@ -1956,23 +1956,23 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp)
* host interface init
**/
if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
- if (!hif_sdio.hif_init(inp, wilc_debug)) {
+ if (!wilc1000_hif_sdio.hif_init(inp, wilc_debug)) {
/* EIO 5 */
ret = -5;
goto _fail_;
}
- memcpy((void *)&g_wlan.hif_func, &hif_sdio, sizeof(wilc_hif_func_t));
+ memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_sdio, sizeof(wilc_hif_func_t));
} else {
if ((inp->io_func.io_type & 0x1) == HIF_SPI) {
/**
* TODO:
**/
- if (!hif_spi.hif_init(inp, wilc_debug)) {
+ if (!wilc1000_hif_spi.hif_init(inp, wilc_debug)) {
/* EIO 5 */
ret = -5;
goto _fail_;
}
- memcpy((void *)&g_wlan.hif_func, &hif_spi, sizeof(wilc_hif_func_t));
+ memcpy((void *)&g_wlan.hif_func, &wilc1000_hif_spi, sizeof(wilc_hif_func_t));
} else {
/* EIO 5 */
ret = -5;
@@ -2040,13 +2040,13 @@ _fail_:

}

-u16 Set_machw_change_vir_if(bool bValue)
+u16 wilc1000_set_machw_change_vir_if(bool bValue)
{
u16 ret;
u32 reg;

/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc1000_dev->hif_cs);
ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, &reg);
if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -2061,7 +2061,7 @@ u16 Set_machw_change_vir_if(bool bValue)
if (!ret)
PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n");

- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wilc1000_dev->hif_cs);

return ret;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index a34a81cdeb5e..d3e3ad617dfb 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -532,17 +532,17 @@ int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp)
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
PRINT_INFO(RX_DBG, "Info message received\n");
- GnrlAsyncInfoReceived(frame - 4, size + 4);
+ wilc1000_egnrl_async_info_received(frame - 4, size + 4);
break;

case 'N':
- NetworkInfoReceived(frame - 4, size + 4);
+ wilc1000_network_info_received(frame - 4, size + 4);
rsp->type = 0;
break;

case 'S':
PRINT_INFO(RX_DBG, "Scan Notification Received\n");
- host_int_ScanCompleteReceived(frame - 4, size + 4);
+ wilc1000_scan_complete_received(frame - 4, size + 4);
break;

default:
--
2.1.0.rc2


2015-10-20 22:48:18

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 15/19] staging/wilc1000: turn enable_irq/disable_irq into callbacks

As a preparation for turning the SDIO side of wilc1000 into a separate
module, this removes the last direct caller from the core module into
the sdio specific portion. All calls to wilc1000_sdio_enable_interrupt()
and wilc1000_sdio_disable_interrupt() now go through a function pointer
in wilc1000_ops. We also change arguments slightly to pass the device,
as we are already touching those lines and the change will be needed
later to remove the global variables.

The linux_wlan_sdio.h file is now unused and gets deleted.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 21 ++++++++++++---------
drivers/staging/wilc1000/linux_wlan_sdio.c | 23 +++++++++++++----------
drivers/staging/wilc1000/linux_wlan_sdio.h | 5 -----
drivers/staging/wilc1000/wilc_wlan_if.h | 2 ++
4 files changed, 27 insertions(+), 24 deletions(-)
delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index beafc543aac3..7b0ac31f04a2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -26,8 +26,6 @@
#include <linux/version.h>
#include <linux/semaphore.h>

-#include "linux_wlan_sdio.h"
-
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);

static struct notifier_block g_dev_notifier = {
@@ -826,9 +824,10 @@ void wilc1000_wlan_deinit(struct wilc *nic)
#endif

PRINT_D(INIT_DBG, "Disabling IRQ\n");
- if (wilc1000_dev->gpio < 0) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt) {
mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(&wilc1000_dev->hif_cs);
}
if (&wilc1000_dev->txq_event != NULL)
@@ -845,11 +844,12 @@ void wilc1000_wlan_deinit(struct wilc *nic)
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup();
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
- if (wilc1000_dev->gpio < 0) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt) {
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");

mutex_lock(&wilc1000_dev->hif_cs);
- wilc1000_sdio_disable_interrupt();
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(&wilc1000_dev->hif_cs);
#endif

@@ -983,7 +983,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_threads_;
}

- if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) {
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->enable_interrupt &&
+ wilc1000_dev->ops->enable_interrupt(wilc1000_dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
@@ -1039,8 +1041,9 @@ _fail_fw_start_:
wilc_wlan_stop();

_fail_irq_enable_:
- if (wilc1000_dev->gpio < 0)
- wilc1000_sdio_disable_interrupt();
+ if (wilc1000_dev->gpio < 0 &&
+ wilc1000_dev->ops->disable_interrupt)
+ wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
_fail_irq_init_:
if (wilc1000_dev->gpio >= 0)
deinit_irq(wilc1000_dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 64c8c5725277..86251b907197 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,4 @@
#include "wilc_wfi_netdevice.h"
-#include "linux_wlan_sdio.h"
#include "wilc_wfi_netdevice.h"

#include <linux/mmc/sdio_func.h>
@@ -160,7 +159,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)

wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
if (wilc1000_dev->gpio < 0)
- wilc1000_sdio_enable_interrupt();
+ wilc1000_dev->ops->enable_interrupt(wilc1000_dev);

if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
@@ -232,13 +231,14 @@ static struct sdio_driver wilc_bus = {
.remove = linux_sdio_remove,
};

-int wilc1000_sdio_enable_interrupt(void)
+static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
{
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret = 0;

- sdio_claim_host(wilc1000_sdio_func);
- ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
- sdio_release_host(wilc1000_sdio_func);
+ sdio_claim_host(func);
+ ret = sdio_claim_irq(func, wilc_sdio_interrupt);
+ sdio_release_host(func);

if (ret < 0) {
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
@@ -247,18 +247,19 @@ int wilc1000_sdio_enable_interrupt(void)
return ret;
}

-void wilc1000_sdio_disable_interrupt(void)
+static void wilc1000_sdio_disable_interrupt(struct wilc *dev)
{
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret;

PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt IN\n");

- sdio_claim_host(wilc1000_sdio_func);
- ret = sdio_release_irq(wilc1000_sdio_func);
+ sdio_claim_host(func);
+ ret = sdio_release_irq(func);
if (ret < 0) {
PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
}
- sdio_release_host(wilc1000_sdio_func);
+ sdio_release_host(func);

PRINT_D(INIT_DBG, "wilc1000_sdio_disable_interrupt OUT\n");
}
@@ -325,6 +326,8 @@ static const struct wilc1000_ops wilc1000_sdio_ops = {
.repeat_power_cycle = repeat_power_cycle,
.prepare_11b_core = wilc1000_prepare_11b_core,
#endif
+ .enable_interrupt = wilc1000_sdio_enable_interrupt,
+ .disable_interrupt = wilc1000_sdio_disable_interrupt,
.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
deleted file mode 100644
index b4995a3211c7..000000000000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/mmc/sdio_func.h>
-
-int wilc1000_sdio_enable_interrupt(void);
-void wilc1000_sdio_disable_interrupt(void);
-
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index a4befcb74c82..2fdf411d6e13 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -79,6 +79,8 @@ struct wilc1000_ops {
void (*io_deinit)(void *);
int (*repeat_power_cycle)(struct wilc_per_interface *nic);
u8 (*prepare_11b_core)(struct wilc *nic);
+ int (*enable_interrupt)(struct wilc *nic);
+ void (*disable_interrupt)(struct wilc *nic);

union {
struct {
--
2.1.0.rc2


2015-10-20 22:48:10

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 01/19] staging/wilc1000: remove unused functions

A number of symbols in the wilc1000 driver are completely unused
and can be removed.
This includes two variables that are only written but not read.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 311 ----------------------
drivers/staging/wilc1000/host_interface.h | 208 +--------------
drivers/staging/wilc1000/wilc_sdio.c | 56 ----
drivers/staging/wilc1000/wilc_spi.c | 225 ----------------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 ---
drivers/staging/wilc1000/wilc_wlan.c | 4 -
6 files changed, 1 insertion(+), 838 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 38fead44cce0..194ca3d3e920 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3421,36 +3421,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at
return s32Error;
}

-s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
- u8 *pu8PmkidInfoArray,
- u32 u32PmkidInfoLen)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_PMKID_INFO;
- strWID.type = WID_STR;
- strWID.size = u32PmkidInfoLen;
- strWID.val = pu8PmkidInfoArray;
-
- return 0;
-}
-
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
- u8 *pu8PassPhrase,
- u8 u8Psklength)
-{
- struct wid strWID;
-
- if ((u8Psklength > 7) && (u8Psklength < 65)) {
- strWID.id = (u16)WID_11I_PSK;
- strWID.type = WID_STR;
- strWID.val = pu8PassPhrase;
- strWID.size = u8Psklength;
- }
-
- return 0;
-}
-
s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
s32 s32Error = 0;
@@ -3492,19 +3462,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)

}

-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
- u8 *pu8PassPhrase, u8 u8Psklength)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_11I_PSK;
- strWID.type = WID_STR;
- strWID.size = u8Psklength;
- strWID.val = pu8PassPhrase;
-
- return 0;
-}
-
s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
{
struct wid strWID;
@@ -3517,18 +3474,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
return 0;
}

-s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_START_SCAN_REQ;
- strWID.type = WID_CHAR;
- strWID.val = (s8 *)pu8ScanSource;
- strWID.size = sizeof(char);
-
- return 0;
-}
-
s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
@@ -3649,31 +3594,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
return s32Error;
}

-s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_DISCONNECT;
- strWID.type = WID_CHAR;
- strWID.val = (s8 *)&assoc_id;
- strWID.size = sizeof(char);
-
- return 0;
-}
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo,
- u32 u32AssocReqInfoLen)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_ASSOC_REQ_INFO;
- strWID.type = WID_STR;
- strWID.val = pu8AssocReqInfo;
- strWID.size = u32AssocReqInfoLen;
-
- return 0;
-}
-
s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
{
@@ -3703,19 +3623,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInf
return s32Error;
}

-s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 *pu8RxPowerLevel,
- u32 u32RxPowerLevelLen)
-{
- struct wid strWID;
-
- strWID.id = (u16)WID_RX_POWER_LEVEL;
- strWID.type = WID_STR;
- strWID.val = pu8RxPowerLevel;
- strWID.size = u32RxPowerLevelLen;
-
- return 0;
-}
-
int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
{
int result;
@@ -3796,33 +3703,6 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
return result;
}

-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
- s32 s32Error = 0;
- struct host_if_msg msg;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_GET_CHNL;
- msg.drv = hif_drv;
-
- s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (s32Error)
- PRINT_ER("wilc mq send fail\n");
- down(&hif_drv->hSemGetCHNL);
-
- *pu8ChNo = ch_no;
-
- return s32Error;
-
-
-}
-
s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
const u8 *mac, u32 *pu32InactiveTime)
{
@@ -3854,36 +3734,6 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
-{
-
- s32 s32Error = 0;
- struct wid strWID;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- strWID.id = (u16)WID_MEMORY_ADDRESS;
- strWID.type = WID_INT;
- strWID.val = (s8 *)pu32TestMemAddr;
- strWID.size = sizeof(u32);
-
- s32Error = send_config_pkt(GET_CFG, &strWID, 1,
- get_id_from_handler(hif_drv));
-
- if (s32Error) {
- PRINT_ER("Failed to get wid value\n");
- return -EINVAL;
- } else {
- PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
-
- }
-
- return s32Error;
-}
-
s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
{
s32 s32Error = 0;
@@ -3912,34 +3762,6 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
return s32Error;
}

-s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
-{
- struct host_if_msg msg;
- s32 s32Error = 0;
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_GET_LINKSPEED;
- msg.drv = hif_drv;
-
- s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (s32Error) {
- PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
- return -EFAULT;
- }
-
- down(&hif_drv->hSemGetLINKSPEED);
-
-
- if (ps8lnkspd == NULL) {
- PRINT_ER("LINKSPEED pointer value is null");
- return -EFAULT;
- }
-
- *ps8lnkspd = link_speed;
-
- return s32Error;
-}
-
s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
s32 s32Error = 0;
@@ -4038,106 +3860,6 @@ s32 hif_set_cfg(struct host_if_drv *hif_drv,

}

-s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
-{
- s32 s32Error = 0;
-
- down(&hif_drv->gtOsCfgValuesSem);
-
- if (!hif_drv) {
- PRINT_ER("hif_drv NULL\n");
- return -EFAULT;
- }
- PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
- switch (u16WID) {
-
- case WID_BSS_TYPE:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type;
- break;
-
- case WID_AUTH_TYPE:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type;
- break;
-
- case WID_AUTH_TIMEOUT:
- *pu16WID_Value = hif_drv->strCfgValues.auth_timeout;
- break;
-
- case WID_POWER_MANAGEMENT:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode;
- break;
-
- case WID_SHORT_RETRY_LIMIT:
- *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit;
- break;
-
- case WID_LONG_RETRY_LIMIT:
- *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit;
- break;
-
- case WID_FRAG_THRESHOLD:
- *pu16WID_Value = hif_drv->strCfgValues.frag_threshold;
- break;
-
- case WID_RTS_THRESHOLD:
- *pu16WID_Value = hif_drv->strCfgValues.rts_threshold;
- break;
-
- case WID_PREAMBLE:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type;
- break;
-
- case WID_SHORT_SLOT_ALLOWED:
- *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed;
- break;
-
- case WID_11N_TXOP_PROT_DISABLE:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled;
- break;
-
- case WID_BEACON_INTERVAL:
- *pu16WID_Value = hif_drv->strCfgValues.beacon_interval;
- break;
-
- case WID_DTIM_PERIOD:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period;
- break;
-
- case WID_SITE_SURVEY:
- *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled;
- break;
-
- case WID_SITE_SURVEY_SCAN_TIME:
- *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time;
- break;
-
- case WID_ACTIVE_SCAN_TIME:
- *pu16WID_Value = hif_drv->strCfgValues.active_scan_time;
- break;
-
- case WID_PASSIVE_SCAN_TIME:
- *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time;
- break;
-
- case WID_CURRENT_TX_RATE:
- *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate;
- break;
-
- default:
- break;
- }
-
- up(&hif_drv->gtOsCfgValuesSem);
-
- return s32Error;
-
-}
-
-void host_int_send_join_leave_info_to_host
- (u16 assocId, u8 *stationAddr, bool joining)
-{
-}
-
static void GetPeriodicRSSI(unsigned long arg)
{
struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
@@ -4167,11 +3889,6 @@ static void GetPeriodicRSSI(unsigned long arg)
}


-void host_int_send_network_info_to_host
- (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
-{
-}
-
static u32 clients_count;

s32 host_int_init(struct host_if_drv **hif_drv_handler)
@@ -5018,34 +4735,6 @@ void host_int_freeJoinParams(void *pJoinParams)
PRINT_ER("Unable to FREE null pointer\n");
}

-s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
-{
- s32 s32Error = 0;
- struct host_if_msg msg;
- struct ba_session_info *pBASessionInfo = &msg.body.session_info;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_DEL_BA_SESSION;
-
- memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
- pBASessionInfo->u8Ted = TID;
- msg.drv = hif_drv;
-
- s32Error = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (s32Error)
- PRINT_ER("wilc_mq_send fail\n");
-
- down(&hif_sema_wait_response);
-
- return s32Error;
-}
-
s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
char *pBSSID,
char TID)
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 146a60f52cb7..3df74f1bf9ff 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -517,65 +517,6 @@ s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk,

s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
/**
- * @brief gets the cached the pmkid info
- * @details valid only in BSS STA mode if External Supplicant
- * support is enabled. This Function sets the PMKID in firmware
- * when host drivr receives the corresponding request from NDIS.
- * The firmware then includes theset PMKID in the appropriate
- * management frames
- * @param[in,out] handle to the wifi driver,
- *
- * message containing PMKID Info in the following format
- *|-----------------------------------------------------------------|
- *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] |
- *|-----------|------------|----------|-------|----------|----------|
- | 1 | 6 | 16 | ... | 6 | 16 |
- ||-----------------------------------------------------------------|
- * @param[in]
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
- u32 u32PmkidInfoLen);
-
-/**
- * @brief sets the pass phrase
- * @details AP/STA mode. This function gives the pass phrase used to
- * generate the Pre-Shared Key when WPA/WPA2 is enabled
- * The length of the field can vary from 8 to 64 bytes,
- * the lower layer should get the
- * @param[in,out] handle to the wifi driver,
- * @param[in] String containing PSK
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
- u8 u8Psklength);
-/**
- * @brief gets the pass phrase
- * @details AP/STA mode. This function gets the pass phrase used to
- * generate the Pre-Shared Key when WPA/WPA2 is enabled
- * The length of the field can vary from 8 to 64 bytes,
- * the lower layer should get the
- * @param[in,out] handle to the wifi driver,
- * String containing PSK
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
- u8 *pu8PassPhrase, u8 u8Psklength);
-
-/**
* @brief gets mac address
* @details
* @param[in,out] handle to the wifi driver,
@@ -631,22 +572,6 @@ int host_int_wait_msg_queue_idle(void);
*/

s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
-/**
- * @brief gets scan source of the last scan
- * @details
- * @param[in,out] handle to the wifi driver,
- * Scan Source one of the following values
- * DEFAULT_SCAN 0
- * USER_SCAN BIT0
- * OBSS_PERIODIC_SCAN BIT1
- * OBSS_ONETIME_SCAN BIT2
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);

/**
* @brief sets a join request
@@ -697,46 +622,6 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);

/**
- * @brief disconnects a sta
- * @details
- * @param[in,out] handle to the wifi driver,
- * @param[in] Association Id of the station to be disconnected
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
-/**
- * @brief gets a Association request info
- * @details
- * @param[in,out] handle to the wifi driver,
- * Message containg assoc. req info in the following format
- * ------------------------------------------------------------------------
- | Management Frame Format |
- ||-------------------------------------------------------------------|
- ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
- ||-------------|--------|--|--|-----|----------------|----------|----|
- | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 |
- ||-------------------------------------------------------------------|
- | |
- | Association Request Frame - Frame Body |
- ||-------------------------------------------------------------------|
- | Capability Information | Listen Interval | SSID | Supported Rates |
- ||------------------------|-----------------|------|-----------------|
- | 2 | 2 | 2-34 | 3-10 |
- | ---------------------------------------------------------------------
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
- u32 u32AssocReqInfoLen);
-/**
* @brief gets a Association Response info
* @details
* @param[in,out] handle to the wifi driver,
@@ -750,23 +635,6 @@ s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo

s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
-/**
- * @brief gets a Association Response info
- * @details Valid only in STA mode. This function gives the RSSI
- * values observed in all the channels at the time of scanning.
- * The length of the field is 1 greater that the total number of
- * channels supported. Byte 0 contains the number of channels while
- * each of Byte N contains the observed RSSI value for the channel index N.
- * @param[in,out] handle to the wifi driver,
- * array of scanned channels' RSSI
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
- u32 u32RxPowerLevelLen);

/**
* @brief sets a channel
@@ -786,22 +654,6 @@ s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel
int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);

/**
- * @brief gets the current channel index
- * @details
- * @param[in,out] handle to the wifi driver,
- * current channel index
- *|-----------------------------------------------------------------------|
- | CHANNEL1 CHANNEL2 .... CHANNEL14 |
- | Input: 1 2 14 |
- ||-----------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
-/**
* @brief gets the sta rssi
* @details gets the currently maintained RSSI value for the station.
* The received signal strength value in dB.
@@ -815,7 +667,7 @@ s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
* @version 1.0
*/
s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
-s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
+
/**
* @brief scans a set of channels
* @details
@@ -852,55 +704,9 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
*/
s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);

-/**
- * @brief gets configuration wids values
- * @details
- * @param[in,out] handle to the wifi driver,
- * WID value
- * @param[in] WID,
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
/*****************************************************************************/
/* Notification Functions */
/*****************************************************************************/
-/**
- * @brief notifies host with join and leave requests
- * @details This function prepares an Information frame having the
- * information about a joining/leaving station.
- * @param[in,out] handle to the wifi driver,
- * @param[in] 6 byte Sta Adress
- * Join or leave flag:
- * Join = 1,
- * Leave =0
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-void host_int_send_join_leave_info_to_host
- (u16 assocId, u8 *stationAddr, bool joining);
-
-/**
- * @brief notifies host with stations found in scan
- * @details sends the beacon/probe response from scan
- * @param[in,out] handle to the wifi driver,
- * @param[in] Sta Address,
- * Frame length,
- * Rssi of the Station found
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-void host_int_send_network_info_to_host
- (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi);

/**
* @brief host interface initialization function
@@ -1070,18 +876,6 @@ s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled
*/
s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);

-
-/**
- * @brief host_int_delBASession
- * @details Delete single Rx BA session
- * @param[in]
- * @return Error code.
- * @author Abdelrahman Sobhy
- * @date
- * @version 1.0
- */
-s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
-
/**
* @brief host_int_delBASession
* @details Delete all Rx BA session
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 300c571e4e2d..4425b5f369e0 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -160,67 +160,11 @@ static int sdio_clear_int(void)

}

-u32 sdio_xfer_cnt(void)
-{
- u32 cnt = 0;
- sdio_cmd52_t cmd;
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1C;
- cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
- cnt = cmd.data;
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1D;
- cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
- cnt |= (cmd.data << 8);
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1E;
- cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
- cnt |= (cmd.data << 16);
-
- return cnt;
-}
-
/********************************************
*
* Sdio interfaces
*
********************************************/
-int sdio_check_bs(void)
-{
- sdio_cmd52_t cmd;
-
- /**
- * poll until BS is 0
- **/
- cmd.read_write = 0;
- cmd.function = 0;
- cmd.raw = 0;
- cmd.address = 0xc;
- cmd.data = 0;
- if (!g_sdio.sdio_cmd52(&cmd)) {
- g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n");
- goto _fail_;
- }
-
- return 1;
-
-_fail_:
-
- return 0;
-}
-
static int sdio_write_reg(u32 addr, u32 data)
{
#ifdef BIG_ENDIAN
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 599508beabf8..732c3f8c7f32 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -111,163 +111,6 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len)
#define DATA_PKT_SZ_8K (8 * 1024)
#define DATA_PKT_SZ DATA_PKT_SZ_8K

-static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless)
-{
- u8 bc[9];
- int len = 5;
- int result = N_OK;
-
- bc[0] = cmd;
- switch (cmd) {
- case CMD_SINGLE_READ: /* single word (4 bytes) read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- len = 5;
- break;
-
- case CMD_INTERNAL_READ: /* internal register read */
- bc[1] = (u8)(adr >> 8);
- if (clockless)
- bc[1] |= BIT(7);
- bc[2] = (u8)adr;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_TERMINATE: /* termination */
- bc[1] = 0x00;
- bc[2] = 0x00;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_REPEAT: /* repeat */
- bc[1] = 0x00;
- bc[2] = 0x00;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_RESET: /* reset */
- bc[1] = 0xff;
- bc[2] = 0xff;
- bc[3] = 0xff;
- len = 5;
- break;
-
- case CMD_DMA_WRITE: /* dma write */
- case CMD_DMA_READ: /* dma read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- bc[4] = (u8)(sz >> 8);
- bc[5] = (u8)(sz);
- len = 7;
- break;
-
- case CMD_DMA_EXT_WRITE: /* dma extended write */
- case CMD_DMA_EXT_READ: /* dma extended read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- bc[4] = (u8)(sz >> 16);
- bc[5] = (u8)(sz >> 8);
- bc[6] = (u8)(sz);
- len = 8;
- break;
-
- case CMD_INTERNAL_WRITE: /* internal register write */
- bc[1] = (u8)(adr >> 8);
- if (clockless)
- bc[1] |= BIT(7);
- bc[2] = (u8)(adr);
- bc[3] = (u8)(data >> 24);
- bc[4] = (u8)(data >> 16);
- bc[5] = (u8)(data >> 8);
- bc[6] = (u8)(data);
- len = 8;
- break;
-
- case CMD_SINGLE_WRITE: /* single word write */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)(adr);
- bc[4] = (u8)(data >> 24);
- bc[5] = (u8)(data >> 16);
- bc[6] = (u8)(data >> 8);
- bc[7] = (u8)(data);
- len = 9;
- break;
-
- default:
- result = N_FAIL;
- break;
- }
-
- if (result) {
- if (!g_spi.crc_off)
- bc[len - 1] = (crc7(0x7f, (const u8 *)&bc[0], len - 1)) << 1;
- else
- len -= 1;
-
- if (!g_spi.spi_tx(bc, len)) {
- PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
- result = N_FAIL;
- }
- }
-
- return result;
-}
-
-static int spi_cmd_rsp(u8 cmd)
-{
- u8 rsp;
- int result = N_OK;
-
- /**
- * Command/Control response
- **/
- if ((cmd == CMD_RESET) ||
- (cmd == CMD_TERMINATE) ||
- (cmd == CMD_REPEAT)) {
- if (!g_spi.spi_rx(&rsp, 1)) {
- result = N_FAIL;
- goto _fail_;
- }
- }
-
- if (!g_spi.spi_rx(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n");
- result = N_FAIL;
- goto _fail_;
- }
-
- if (rsp != cmd) {
- PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp);
- result = N_FAIL;
- goto _fail_;
- }
-
- /**
- * State response
- **/
- if (!g_spi.spi_rx(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n");
- result = N_FAIL;
- goto _fail_;
- }
-
- if (rsp != 0x00) {
- PRINT_ER("[wilc spi]: Failed cmd state response state (%02x)\n", rsp);
- result = N_FAIL;
- }
-
-_fail_:
-
- return result;
-}
-
static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
{
u8 wb[32], rb[32];
@@ -607,74 +450,6 @@ _error_:
return result;
}

-static int spi_data_read(u8 *b, u32 sz)
-{
- int retry, ix, nbytes;
- int result = N_OK;
- u8 crc[2];
- u8 rsp;
-
- /**
- * Data
- **/
- ix = 0;
- do {
- if (sz <= DATA_PKT_SZ)
- nbytes = sz;
- else
- nbytes = DATA_PKT_SZ;
-
- /**
- * Data Respnose header
- **/
- retry = 10;
- do {
- if (!g_spi.spi_rx(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
- result = N_FAIL;
- break;
- }
- if (((rsp >> 4) & 0xf) == 0xf)
- break;
- } while (retry--);
-
- if (result == N_FAIL)
- break;
-
- if (retry <= 0) {
- PRINT_ER("[wilc spi]: Failed data response read...(%02x)\n", rsp);
- result = N_FAIL;
- break;
- }
-
- /**
- * Read bytes
- **/
- if (!g_spi.spi_rx(&b[ix], nbytes)) {
- PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
- result = N_FAIL;
- break;
- }
-
- /**
- * Read Crc
- **/
- if (!g_spi.crc_off) {
- if (!g_spi.spi_rx(crc, 2)) {
- PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
- result = N_FAIL;
- break;
- }
- }
-
- ix += nbytes;
- sz -= nbytes;
-
- } while (sz);
-
- return result;
-}
-
static int spi_data_write(u8 *b, u32 sz)
{
int ix, nbytes;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index bcbf1bd29a50..18e40e515a48 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -473,41 +473,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet
}


-/**
- * @brief WILC_WFI_Set_PMKSA
- * @details Check if pmksa is cached and set it.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv)
-{
- u32 i;
- s32 s32Error = 0;
-
-
- for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
-
- if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid,
- ETH_ALEN)) {
- PRINT_D(CFG80211_DBG, "PMKID successful comparison");
-
- /*If bssid is found, set the values*/
- s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
-
- if (s32Error != 0)
- PRINT_ER("Error in pmkid\n");
-
- break;
- }
- }
-
- return s32Error;
-
-
-}
int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);


diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c73164165323..c8564249092c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -254,8 +254,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)

}

-u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0;
-
#ifdef TCP_ACK_FILTER
struct Ack_session_info;
struct Ack_session_info {
@@ -319,7 +317,6 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack)
}
static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe)
{
- Statisitcs_totalAcks++;
if (Pending_Acks < MAX_PENDING_ACKS) {
Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack;
Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe;
@@ -422,7 +419,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
tqe = Pending_Acks_info[i].txqe;
if (tqe) {
wilc_wlan_txq_remove(tqe);
- Statisitcs_DroppedAcks++;
tqe->status = 1; /* mark the packet send */
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, tqe->status);
--
2.1.0.rc2


2015-10-20 22:48:21

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 19/19] [RFC] staging/wilc1000: use more regular probing

So far, my patches tried to do equivalent conversions of the
existing code. This one goes beyond that by restructuring
how the devices get probed. In particular, the spi driver
no longer creates the netdev until the device is probed,
and I've removed the global wilc1000_sdio_func and wilc_spi_dev
variables in favor of retrieving them from the wilc1000_dev
variable that will eventually get passed through all functions
instead of using a global.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 30 ++++----
drivers/staging/wilc1000/linux_wlan_sdio.c | 54 ++++---------
drivers/staging/wilc1000/linux_wlan_spi.c | 118 ++++++++++-------------------
drivers/staging/wilc1000/wilc_wlan.h | 5 +-
4 files changed, 72 insertions(+), 135 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..6e16c0b32f43 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,19 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
}
EXPORT_SYMBOL_GPL(wilc_netdev_init);

-void __init wilc1000_init_driver(void)
-{
-#if defined(WILC_DEBUGFS)
- if (wilc_debugfs_init() < 0)
- PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
-#endif
-
- printk("IN INIT FUNCTION\n");
- printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-}
-EXPORT_SYMBOL_GPL(wilc1000_init_driver);
-
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
{
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,16 +1641,28 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
}
EXPORT_SYMBOL_GPL(wilc_netdev_free);

+int __init wilc1000_init_driver(void)
+{
+ int ret = 0;
+#if defined(WILC_DEBUGFS)
+ ret = wilc_debugfs_init();
+ if (ret < 0)
+ PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
+#endif
+ return ret;
+
+}
+module_init(wilc1000_init_driver);
+
void __exit wilc1000_exit_driver(void)
{
kfree(wilc1000_dev);
wilc1000_dev = NULL;
- printk("Module_exit Done.\n");

#if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
#endif
}
-EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
+module_exit(wilc1000_exit_driver);

MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f343ac72530..916c2a1d189d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -24,7 +24,6 @@
#endif


-static struct sdio_func *wilc1000_sdio_func;
static unsigned int sdio_default_speed;

#define SDIO_VENDOR_ID_WILC 0x0296
@@ -113,6 +112,7 @@ static const struct wilc1000_ops wilc1000_sdio_ops;

static struct sdio_driver wilc_bus;
static volatile int wilc1000_probe;
+static struct sdio_func *wilc1000_sdio_func;

#define READY_CHECK_THRESHOLD 30
static u8 wilc1000_prepare_11b_core(struct wilc *nic)
@@ -195,6 +195,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
PRINT_D(INIT_DBG, "wilc1000_sdio_func isn't NULL\n");
return 0;
}
+ wilc1000_sdio_func = func;
#endif

gpio = -1;
@@ -205,13 +206,13 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
}

PRINT_D(INIT_DBG, "Initializing netdev\n");
- wilc1000_sdio_func = func;
if (wilc_netdev_init(&func->dev, &wilc1000_sdio_ops,
&wilc1000_hif_sdio, gpio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
- wilc1000_dev->dev = &wilc1000_sdio_func->dev;
+ wilc1000_dev->dev = &func->dev;
+ sdio_set_drvdata(func, wilc1000_dev);

printk("Driver Initializing success\n");
return 0;
@@ -219,18 +220,17 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id

static void linux_sdio_remove(struct sdio_func *func)
{
- /**
- * TODO
- **/
-
+ wilc_netdev_free(sdio_get_drvdata(func));
}

-static struct sdio_driver wilc_bus = {
+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");

static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
{
@@ -268,14 +268,15 @@ static void wilc1000_sdio_disable_interrupt(struct wilc *dev)
static int linux_sdio_set_speed(int speed)
{
struct mmc_ios ios;
+ struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);

- sdio_claim_host(wilc1000_sdio_func);
+ sdio_claim_host(func);

- memcpy((void *)&ios, (void *)&wilc1000_sdio_func->card->host->ios, sizeof(struct mmc_ios));
- wilc1000_sdio_func->card->host->ios.clock = speed;
+ memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios));
+ func->card->host->ios.clock = speed;
ios.clock = speed;
- wilc1000_sdio_func->card->host->ops->set_ios(wilc1000_sdio_func->card->host, &ios);
- sdio_release_host(wilc1000_sdio_func);
+ 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;
@@ -283,7 +284,8 @@ static int linux_sdio_set_speed(int speed)

static int linux_sdio_get_speed(void)
{
- return wilc1000_sdio_func->card->host->ios.clock;
+ struct sdio_func *func = container_of(wilc1000_dev->dev, struct sdio_func, dev);
+ return func->card->host->ios.clock;
}

static int wilc1000_sdio_init(void *pv)
@@ -300,13 +302,6 @@ static int wilc1000_sdio_init(void *pv)

static void wilc1000_sdio_deinit(void *pv)
{
-
- /**
- * TODO :
- **/
-
-
- sdio_unregister_driver(&wilc_bus);
}

static int wilc1000_sdio_set_max_speed(void)
@@ -334,20 +329,3 @@ static const struct wilc1000_ops wilc1000_sdio_ops = {
.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
.u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
};
-
-static int __init init_wilc_sdio_driver(void)
-{
- wilc1000_init_driver();
- return sdio_register_driver(&wilc_bus);
-}
-late_initcall(init_wilc_sdio_driver);
-
-static void __exit exit_wilc_sdio_driver(void)
-{
- if (wilc1000_dev)
- wilc_netdev_free(wilc1000_dev);
- sdio_unregister_driver(&wilc_bus);
- wilc1000_exit_driver();
-}
-module_exit(exit_wilc_sdio_driver);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index c0e0e6be6b0b..d472edcfdf9d 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -8,6 +8,7 @@
#include <linux/uaccess.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
+#include <linux/of_gpio.h>

#include "wilc_wfi_netdevice.h"
#include "linux_wlan_common.h"
@@ -43,72 +44,61 @@

static u32 SPEED = MIN_SPEED;

-struct spi_device *wilc_spi_dev;
+static const struct wilc1000_ops wilc1000_spi_ops;

static int __init wilc_bus_probe(struct spi_device *spi)
{
+ int ret, gpio;

- PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias);
- PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz);
- wilc_spi_dev = spi;
+ gpio = of_get_gpio(spi->dev.of_node, 0);
+ if (gpio < 0)
+ gpio = GPIO_NUM;
+
+ ret = wilc_netdev_init(&spi->dev, &wilc1000_spi_ops, &wilc1000_hif_spi,
+ gpio);
+ if (ret)
+ return ret;
+
+ spi_set_drvdata(spi, wilc1000_dev);
+ wilc1000_dev->dev = &spi->dev;

- printk("Driver Initializing success\n");
return 0;
}

-static int __exit wilc_bus_remove(struct spi_device *spi)
+static int wilc_bus_remove(struct spi_device *spi)
{
-
+ wilc_netdev_free(spi_get_drvdata(spi));
return 0;
}

-#ifdef CONFIG_OF
static const struct of_device_id wilc1000_of_match[] = {
{ .compatible = "atmel,wilc_spi", },
{}
};
MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-#endif

-struct spi_driver wilc_bus __refdata = {
+struct spi_driver wilc1000_spi_driver __refdata = {
.driver = {
.name = MODALIAS,
-#ifdef CONFIG_OF
.of_match_table = wilc1000_of_match,
-#endif
},
.probe = wilc_bus_probe,
- .remove = __exit_p(wilc_bus_remove),
+ .remove = wilc_bus_remove,
};
-
+module_spi_driver(wilc1000_spi_driver);
+MODULE_LICENSE("GPL");

static void wilc1000_spi_deinit(void *vp)
{
-
- spi_unregister_driver(&wilc_bus);
-
SPEED = MIN_SPEED;
PRINT_ER("@@@@@@@@@@@@ restore SPI speed to %d @@@@@@@@@\n", SPEED);
-
}



static int wilc1000_spi_init(void *vp)
{
- int ret = 1;
- static int called;
-
-
- if (called == 0) {
- called++;
- ret = spi_register_driver(&wilc_bus);
- }
-
- /* change return value to match WILC interface */
- (ret < 0) ? (ret = 0) : (ret = 1);
-
- return ret;
+ return 1;
}

#if defined(PLAT_WMS8304)
@@ -119,6 +109,7 @@ static int wilc1000_spi_init(void *vp)

static int wilc1000_spi_write(u8 *b, u32 len)
{
+ struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
int ret;

if (len > 0 && b != NULL) {
@@ -145,11 +136,11 @@ static int wilc1000_spi_write(u8 *b, u32 len)

memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;

spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -170,11 +161,11 @@ static int wilc1000_spi_write(u8 *b, u32 len)

memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA; /* rachel */

spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -196,7 +187,7 @@ static int wilc1000_spi_write(u8 *b, u32 len)
#else
static int wilc1000_spi_write(u8 *b, u32 len)
{
-
+ struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
int ret;
struct spi_message msg;

@@ -217,12 +208,12 @@ static int wilc1000_spi_write(u8 *b, u32 len)
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
/* [[johnny add */
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
/* ]] */
spi_message_add_tail(&tr, &msg);

- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -247,6 +238,7 @@ static int wilc1000_spi_write(u8 *b, u32 len)

static int wilc1000_spi_read(u8 *rb, u32 rlen)
{
+ struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
int ret;

if (rlen > 0) {
@@ -273,11 +265,11 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)

memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;

spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -297,11 +289,11 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)

memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA; /* rachel */

spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -321,7 +313,7 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
#else
static int wilc1000_spi_read(u8 *rb, u32 rlen)
{
-
+ struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
int ret;

if (rlen > 0) {
@@ -342,12 +334,12 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
/* [[ johnny add */
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
/* ]] */
spi_message_add_tail(&tr, &msg);

- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -366,7 +358,7 @@ static int wilc1000_spi_read(u8 *rb, u32 rlen)

static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
{
-
+ struct spi_device *spi = to_spi_device(wilc1000_dev->dev);
int ret;

if (rlen > 0) {
@@ -383,11 +375,11 @@ static int wilc1000_spi_write_read(u8 *wb, u8 *rb, u32 rlen)

memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;

spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -418,33 +410,3 @@ static const struct wilc1000_ops wilc1000_spi_ops = {
.u.spi.spi_trx = wilc1000_spi_write_read,
.u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
};
-
-static int __init init_wilc_spi_driver(void)
-{
- int ret;
-
- wilc1000_init_driver();
- ret = wilc_netdev_init(NULL, &wilc1000_spi_ops, &wilc1000_hif_spi,
- GPIO_NUM);
- if (ret)
- return ret;
-
- if (!wilc1000_spi_init(NULL)) {
- PRINT_ER("Can't initialize SPI\n");
- return -ENXIO;
- }
- wilc1000_dev->dev = &wilc_spi_dev->dev;
-
- return ret;
-}
-late_initcall(init_wilc_spi_driver);
-
-static void __exit exit_wilc_spi_driver(void)
-{
- if (wilc1000_dev)
- wilc_netdev_free(wilc1000_dev);
- spi_unregister_driver(&wilc_bus);
- wilc1000_exit_driver();
-}
-module_exit(exit_wilc_spi_driver);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..a551e6810ff3 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);

void wilc_handle_isr(void);

@@ -340,7 +340,4 @@ extern bool wilc1000_enable_ps;
int wilc1000_firmware_download(struct wilc *p_nic);
int wilc1000_start_firmware(struct wilc_per_interface *nic);

-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
-
#endif
--
2.1.0.rc2


2015-10-23 07:51:31

by Tony Cho

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

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

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

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

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

Thanks,
Tony.

On 2015년 10월 23일 10:37, glen lee wrote:
>
> On 2015년 10월 22일 21:23, Arnd Bergmann wrote:
>> On Wednesday 21 October 2015 19:06:52 glen lee wrote:
>>> Hi arnd,
>>>
>>> Thanks for the all the patches.
>>> About the patch ( use proper naming for global symbols ),
>>> We are planning to use this driver not only for wilc1000 but also for
>>> other atmel wireless driver. I'd appreciate if you could use wl
>>> instead of wilc1000.
>>>
>>> And the global variable g_linux_wlan will be placed in netdevice
>>> private data
>>> and finally it will be removed. I already posted some of those patches.
>> I couldn't find the patches anywhere, but I've updated my series now
>> to rename the symbols to wilc_* and to remove most but not all
>> references to
>> g_linux_wlan (or wilc_dev after my rename). Do you want me to post those
>> so you can integrate them, or should I have a look at what you sent
>> first
>> (please send me a copy then).
>
> Hi arnd,
>
> I have tested with all the patches you have posted but it does not
> works. firmware start timed out
> in the function wilc1000_start_firmware.
> I also have tested with all the patched without last one, [RFC] one,
> but it shows
> Segmentation fault when insmod driver.
> For now, I can't rebase the patches. I'd appreciate if you could help us.
>
> The title of my first patch is,
> [PATCH 01/13] staging: wilc1000: add wilc to netdev private data
> structure
> and also refer to [PATCH 00/12] WILC1000 V2 for the g_linux_wlan
> ( The patches posted by [email protected] )
>
> By the way, deleting feature COMPLEMENT_BOOT patch already posted but
> not yet accepted.
>
> Thank you.
> Glen.
>
>> Arnd
>


2015-10-20 22:48:09

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power,device_detection}

The driver provides an interface for custom power management
and detection that is meant to be filled by people customizing
the driver. The default implementation of this is empty, and
we don't actually want people to have to modify the source code.

If anybody needs this, they need to describe the respective
hardware specifics using device tree or platform data and make
the driver handle this is a more general way.

This removes the empty stubs.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 62 -----------------------------------
1 file changed, 62 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d3cc255cd91b..eb4c6cba4575 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -32,47 +32,6 @@
#include "linux_wlan_spi.h"
#endif

-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : Write power control functions as customer platform.
- */
-#else
-
- #define _linux_wlan_device_power_on() {}
- #define _linux_wlan_device_power_off() {}
-
- #define _linux_wlan_device_detection() {}
- #define _linux_wlan_device_removal() {}
-#endif
-
-static int linux_wlan_device_power(int on_off)
-{
- PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
- if (on_off) {
- _linux_wlan_device_power_on();
- } else {
- _linux_wlan_device_power_off();
- }
-
- return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
- PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
- if (on_off) {
- _linux_wlan_device_detection();
- } else {
- _linux_wlan_device_removal();
- }
-#endif
-
- return 0;
-}
-
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);

static struct notifier_block g_dev_notifier = {
@@ -1046,12 +1005,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
wilc_wlan_global_reset();
sdio_unregister_driver(&wilc_bus);

- linux_wlan_device_detection(0);
-
- mdelay(100);
-
- linux_wlan_device_detection(1);
-
sdio_register_driver(&wilc_bus);

while (!wilc1000_probe)
@@ -1076,14 +1029,6 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)

sdio_unregister_driver(&wilc_bus);

- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
- msleep(100);
- linux_wlan_device_power(1);
- msleep(80);
- linux_wlan_device_detection(1);
- msleep(20);
-
sdio_register_driver(&wilc_bus);

/* msleep(1000); */
@@ -1794,10 +1739,6 @@ static int __init init_wilc_driver(void)
printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");

- linux_wlan_device_power(1);
- msleep(100);
- linux_wlan_device_detection(1);
-
#ifdef WILC_SDIO
{
int ret;
@@ -1877,9 +1818,6 @@ static void __exit exit_wilc_driver(void)
#if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
#endif
-
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
}
module_exit(exit_wilc_driver);

--
2.1.0.rc2


2015-10-20 22:48:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

The linux_wlan.c file uses a set of enums from wilc_wlan_if.h,
with the exception of the NO_ENCRYPT that comes from
wilc_wfi_cfgoperations.h. The two sets of enums clearly have
the same intention but are defined a bit different.

To prepare to clean up the ones in wilc_wfi_cfgoperations.h, this
first changes over the only other user.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 50477d70eb24..d3cc255cd91b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -701,7 +701,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;

- c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
+ c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;

--
2.1.0.rc2


2015-10-20 22:48:14

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 18/19] staging/wilc1000: split out bus specific modules

The SPI and SDIO specific code is now separate enough that
we just need to restructure the Makefile and Kconfig logic
a bit and export a couple of symbols from the common module
to have separate bus glue drivers.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/Kconfig | 66 +++++++++++++-----------------
drivers/staging/wilc1000/Makefile | 9 ++--
drivers/staging/wilc1000/linux_wlan.c | 6 +++
drivers/staging/wilc1000/linux_wlan_sdio.c | 1 +
drivers/staging/wilc1000/linux_wlan_spi.c | 1 +
drivers/staging/wilc1000/wilc_debugfs.c | 2 +
drivers/staging/wilc1000/wilc_wlan.c | 1 +
7 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index ee51b4278088..2923122346ef 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,41 +1,12 @@
-config WILC1000_DRIVER
- bool "WILC1000 support (WiFi only)"
- depends on CFG80211 && WEXT_CORE && INET
- ---help---
- This module only support IEEE 802.11n WiFi.
-
-if WILC1000_DRIVER
-
config WILC1000
tristate
-
-choice
- prompt "Memory Allocation"
- default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
- bool "Preallocate memory at loading driver"
+ select WIRELESS_EXT
---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
-
-choice
- prompt "Bus Type"
- default WILC1000_SDIO
+ This module only support IEEE 802.11n WiFi.

config WILC1000_SDIO
- bool "SDIO support"
- depends on MMC
+ tristate "Atmel WILC1000 SDIO (WiFi only)"
+ depends on CFG80211 && INET && MMC
select WILC1000
---help---
This module adds support for the SDIO interface of adapters using
@@ -48,9 +19,9 @@ config WILC1000_SDIO
this if your platform is using the SDIO bus.

config WILC1000_SPI
- depends on SPI
+ tristate "Atmel WILC1000 SPI (WiFi only)"
+ depends on CFG80211 && INET && SPI
select WILC1000
- bool "SPI support"
---help---
This module adds support for the SPI interface of adapters using
WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
@@ -59,10 +30,31 @@ config WILC1000_SPI
full-duplex slave synchronous serial interface that is available
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 "Use out of band interrupt"
+ bool "WILC1000 out of band interrupt"
depends on WILC1000_SDIO
default n
---help---
@@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR
mechanism for SDIO host controllers that don't support SDIO interrupt.
Select this option If the SDIO host controller in your platform
doesn't support SDIO time devision interrupt.
-
-endif
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 9ce30e92ea3a..198d536da57c 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -18,8 +18,11 @@ 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 \
- wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \
+ wilc_wlan_cfg.o wilc_debugfs.o \
wilc_wlan.o

-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += linux_wlan_sdio.o 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.c b/drivers/staging/wilc1000/linux_wlan.c
index 04ebb6310070..8a5f4673c5d0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -56,6 +56,8 @@ static void wilc_set_multicast_list(struct net_device *dev);
* and this data should be pointer to net device
*/
struct wilc *wilc1000_dev;
+EXPORT_SYMBOL_GPL(wilc1000_dev);
+
bool wilc1000_enable_ps = true;

static const struct net_device_ops wilc_netdev_ops = {
@@ -1590,6 +1592,7 @@ int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,

return 0;
}
+EXPORT_SYMBOL_GPL(wilc_netdev_init);

void __init wilc1000_init_driver(void)
{
@@ -1601,6 +1604,7 @@ void __init wilc1000_init_driver(void)
printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
}
+EXPORT_SYMBOL_GPL(wilc1000_init_driver);

void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
{
@@ -1647,6 +1651,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
}
}
}
+EXPORT_SYMBOL_GPL(wilc_netdev_free);

void __exit wilc1000_exit_driver(void)
{
@@ -1658,5 +1663,6 @@ void __exit wilc1000_exit_driver(void)
wilc_debugfs_remove();
#endif
}
+EXPORT_SYMBOL_GPL(wilc1000_exit_driver);

MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f79d986be5c..1f343ac72530 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -350,3 +350,4 @@ static void __exit exit_wilc_sdio_driver(void)
wilc1000_exit_driver();
}
module_exit(exit_wilc_sdio_driver);
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 02b922ab86bb..c0e0e6be6b0b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -447,3 +447,4 @@ static void __exit exit_wilc_spi_driver(void)
wilc1000_exit_driver();
}
module_exit(exit_wilc_spi_driver);
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index c22f0ca10250..6f37b6491de7 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -27,7 +27,9 @@ static struct dentry *wilc_dir;
#define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
atomic_t WILC1000_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+EXPORT_SYMBOL_GPL(WILC1000_REGION);
atomic_t WILC1000_DEBUG_LEVEL = ATOMIC_INIT(ERR);
+EXPORT_SYMBOL_GPL(WILC1000_DEBUG_LEVEL);

/*
* --------------------------------------------------------------------------------
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 04d2938a383c..bebc0880cc02 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1376,6 +1376,7 @@ void wilc_handle_isr(void)
}
release_bus(RELEASE_ALLOW_SLEEP);
}
+EXPORT_SYMBOL_GPL(wilc_handle_isr);

/********************************************
*
--
2.1.0.rc2


2015-10-22 12:24:08

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

On Wednesday 21 October 2015 19:06:52 glen lee wrote:
> Hi arnd,
>
> Thanks for the all the patches.
> About the patch ( use proper naming for global symbols ),
> We are planning to use this driver not only for wilc1000 but also for
> other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.
>
> And the global variable g_linux_wlan will be placed in netdevice private data
> and finally it will be removed. I already posted some of those patches.

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

Arnd

2015-10-20 22:48:12

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 02/19] staging/wilc1000: make symbols static if possible

All symbols that are only referenced in the file that defines
them can be declared 'static' to avoid namespace pollution,
to produce better object code, and to make the source more
readable.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/Makefile | 3 +-
drivers/staging/wilc1000/coreconfigurator.c | 6 +--
drivers/staging/wilc1000/host_interface.c | 28 +++++++----
drivers/staging/wilc1000/host_interface.h | 29 ------------
drivers/staging/wilc1000/linux_mon.c | 6 +--
drivers/staging/wilc1000/linux_wlan.c | 25 +++++-----
drivers/staging/wilc1000/linux_wlan_sdio.c | 4 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 58 +++++++++++------------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 1 -
drivers/staging/wilc1000/wilc_wlan.c | 26 ++++++----
10 files changed, 85 insertions(+), 101 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 64c2f1b83dfb..55b2ac2b15a8 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -8,8 +8,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 \
- -Wno-unused-function -DWILC_DEBUGFS
+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 \
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 427adfd295da..28ab89b3a65d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -287,7 +287,7 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
}

-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
{
u16 u16index;

@@ -315,7 +315,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)

/* This function gets the current channel information from
* the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
{
u16 index;

@@ -333,7 +333,7 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
return 0; /* no MIB here */
}

-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
{
/* Extract current channel information from */
/* the beacon/probe response frame */
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 194ca3d3e920..4e9dfb493b9f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -232,7 +232,7 @@ struct join_bss_param {
static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
struct host_if_drv *terminated_handle;
bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+static u8 P2P_LISTEN_STATE;
static struct task_struct *hif_thread_handler;
static WILC_MsgQueueHandle hif_msg_q;
static struct semaphore hif_sema_thread;
@@ -256,10 +256,10 @@ static u32 inactive_time;
static u8 del_beacon;

static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
static u32 info_element_size;
static struct host_if_drv *join_req_drv;
#define REAL_JOIN_REQ 0
@@ -398,7 +398,9 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
return s32Error;
}

-s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+
+static s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
{

s32 s32Error = 0;
@@ -433,7 +435,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
return s32Error;
}

-s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
{

s32 s32Error = 0;
@@ -812,6 +814,9 @@ static s32 Handle_wait_msg_q_empty(void)
return 0;
}

+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+ enum scan_event enuEvent);
+
static s32 Handle_Scan(struct host_if_drv *hif_drv,
struct scan_attr *pstrHostIFscanAttr)
{
@@ -1484,6 +1489,11 @@ done:
return s32Error;
}

+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+ u8 *pu8AssocRespInfo,
+ u32 u32MaxAssocRespInfoLen,
+ u32 *pu32RcvdAssocRespInfoLen);
+
static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
{
@@ -2178,7 +2188,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)

}

-s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
struct wid strWIDList[5];
u32 u32WidsCount = 0, s32Error = 0;
@@ -3594,7 +3604,7 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
return s32Error;
}

-s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
{
s32 s32Error = 0;
@@ -4794,7 +4804,7 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)

}

-s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
s32 s32Error = 0;
struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 3df74f1bf9ff..1661eeb0a2e7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -622,21 +622,6 @@ s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);

/**
- * @brief gets a Association Response info
- * @details
- * @param[in,out] handle to the wifi driver,
- * Message containg assoc. resp info
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
- u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
-
-/**
* @brief sets a channel
* @details
* @param[in,out] handle to the wifi driver,
@@ -887,18 +872,6 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx)
*/
s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);

-
-/**
- * @brief host_int_get_ipaddress
- * @details get IP address on firmware
- * @param[in]
- * @return Error code.
- * @author Abdelrahman Sobhy
- * @date
- * @version 1.0
- */
-s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
-
/**
* @brief host_int_remain_on_channel
* @details
@@ -948,8 +921,6 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool
int host_int_set_wfi_drv_handler(struct host_if_drv *address);
int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);

-static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
-
void host_int_freeJoinParams(void *pJoinParams);

s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 450af1b77f99..d93594474a2d 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -29,9 +29,9 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */
extern int mac_xmit(struct sk_buff *skb, struct net_device *dev);


-u8 srcAdd[6];
-u8 bssid[6];
-u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static u8 srcAdd[6];
+static u8 bssid[6];
+static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
/**
* @brief WILC_WFI_monitor_rx
* @details
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b879b8be0f3f..1b496e84100e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -239,9 +239,8 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
}
return IRQ_WAKE_THREAD;
}
-#endif

-irqreturn_t isr_bh_routine(int irq, void *userdata)
+static irqreturn_t isr_bh_routine(int irq, void *userdata)
{
struct wilc *nic;

@@ -259,7 +258,6 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
}

-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
static int init_irq(struct wilc *p_nic)
{
int ret = 0;
@@ -358,7 +356,7 @@ void linux_wlan_mac_indicate(int flag)

}

-struct net_device *GetIfHandler(u8 *pMacHeader)
+static struct net_device *GetIfHandler(u8 *pMacHeader)
{
u8 *Bssid, *Bssid1;
int i = 0;
@@ -551,7 +549,7 @@ _fail_:
}

#ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
+static int repeat_power_cycle(perInterface_wlan_t *nic);
#endif

static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
@@ -944,7 +942,7 @@ void wilc1000_wlan_deinit(struct wilc *nic)
}
}

-int wlan_init_locks(struct wilc *p_nic)
+static int wlan_init_locks(struct wilc *p_nic)
{

PRINT_D(INIT_DBG, "Initializing Locks ...\n");
@@ -977,7 +975,8 @@ static int wlan_deinit_locks(struct wilc *nic)

return 0;
}
-void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
+
+static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
{

PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
@@ -1003,7 +1002,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
#endif
}

-int wlan_initialize_threads(perInterface_wlan_t *nic)
+static int wlan_initialize_threads(perInterface_wlan_t *nic)
{

int ret = 0;
@@ -1053,7 +1052,7 @@ extern u8 core_11b_ready(void);

#define READY_CHECK_THRESHOLD 30
extern void wilc_wlan_global_reset(void);
-u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
{
u8 trials = 0;

@@ -1086,7 +1085,7 @@ u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)

}

-int repeat_power_cycle(perInterface_wlan_t *nic)
+static int repeat_power_cycle(perInterface_wlan_t *nic)
{
int ret = 0;
wilc_wlan_inp_t nwi;
@@ -1265,7 +1264,7 @@ _fail_locks_:
* - this function will be called automatically by OS when module inserted.
*/

-int mac_init_fn(struct net_device *ndev)
+static int mac_init_fn(struct net_device *ndev)
{

/*Why we do this !!!*/
@@ -1351,7 +1350,7 @@ _err_:
return ret;
}

-struct net_device_stats *mac_stats(struct net_device *dev)
+static struct net_device_stats *mac_stats(struct net_device *dev)
{
perInterface_wlan_t *nic = netdev_priv(dev);

@@ -1554,7 +1553,7 @@ int mac_close(struct net_device *ndev)
return 0;
}

-int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
+static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
{

u8 *buff = NULL;
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index ebacd297abca..96558accf877 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -37,14 +37,14 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
};


+#ifndef WILC_SDIO_IRQ_GPIO
static void wilc_sdio_interrupt(struct sdio_func *func)
{
-#ifndef WILC_SDIO_IRQ_GPIO
sdio_release_host(func);
wilc_handle_isr();
sdio_claim_host(func);
-#endif
}
+#endif


int linux_sdio_cmd52(sdio_cmd52_t *cmd)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 18e40e515a48..c54c9fce41e7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -27,10 +27,10 @@ extern u16 Set_machw_change_vir_if(bool bValue);
extern int mac_open(struct net_device *ndev);
extern int mac_close(struct net_device *ndev);

-tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
-u32 u32LastScannedNtwrksCountShadow;
+static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
+static u32 u32LastScannedNtwrksCountShadow;
struct timer_list hDuringIpTimer;
-struct timer_list hAgingTimer;
+static struct timer_list hAgingTimer;
static u8 op_ifcs;
extern u8 u8ConnectedSSID[6];

@@ -93,15 +93,15 @@ struct p2p_mgmt_data {
};

/*Global variable used to state the current connected STA channel*/
-u8 u8WLANChannel = INVALID_CHANNEL;
+static u8 u8WLANChannel = INVALID_CHANNEL;

-u8 curr_channel;
+static u8 curr_channel;

-u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-u8 u8P2Plocalrandom = 0x01;
-u8 u8P2Precvrandom = 0x00;
-u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-bool bWilc_ie;
+static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
+static u8 u8P2Plocalrandom = 0x01;
+static u8 u8P2Precvrandom = 0x00;
+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,
@@ -116,19 +116,19 @@ struct add_key_params {
bool pairwise;
u8 *mac_addr;
};
-struct add_key_params g_add_gtk_key_params;
-struct wilc_wfi_key g_key_gtk_params;
-struct add_key_params g_add_ptk_key_params;
-struct wilc_wfi_key g_key_ptk_params;
-struct wilc_wfi_wep_key g_key_wep_params;
-bool g_ptk_keys_saved;
-bool g_gtk_keys_saved;
-bool g_wep_keys_saved;
+static struct add_key_params g_add_gtk_key_params;
+static struct wilc_wfi_key g_key_gtk_params;
+static struct add_key_params g_add_ptk_key_params;
+static struct wilc_wfi_key g_key_ptk_params;
+static struct wilc_wfi_wep_key g_key_wep_params;
+static bool g_ptk_keys_saved;
+static bool g_gtk_keys_saved;
+static bool g_wep_keys_saved;

#define AGING_TIME (9 * 1000)
#define duringIP_TIME 15000

-void clear_shadow_scan(void *pUserVoid)
+static void clear_shadow_scan(void *pUserVoid)
{
int i;

@@ -150,7 +150,7 @@ void clear_shadow_scan(void *pUserVoid)

}

-u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
+static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
{
u8 i;
int rssi_v = 0;
@@ -163,7 +163,7 @@ u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
return rssi_v;
}

-void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
+static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
{
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -203,7 +203,7 @@ void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)

}

-void reset_shadow_found(void *pUserVoid)
+static void reset_shadow_found(void *pUserVoid)
{
int i;

@@ -213,7 +213,7 @@ void reset_shadow_found(void *pUserVoid)
}
}

-void update_scan_time(void *pUserVoid)
+static void update_scan_time(void *pUserVoid)
{
int i;

@@ -259,7 +259,7 @@ static void clear_duringIP(unsigned long arg)
g_obtainingIP = false;
}

-int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
{
int state = -1;
int i;
@@ -282,7 +282,7 @@ int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
return state;
}

-void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
+static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
{
int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
u32 ap_index = 0;
@@ -1759,7 +1759,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
* @version
*/

-void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
+static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
{
u32 index = 0;
u32 i = 0, j = 0;
@@ -1811,7 +1811,7 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
* @date 12 DEC 2012
* @version
*/
-void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
+static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
{
u32 index = 0;
u32 i = 0, j = 0;
@@ -2142,7 +2142,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
* @date 01 JAN 2014
* @version 1.0
*/
-void WILC_WFI_add_wilcvendorspec(u8 *buff)
+static void WILC_WFI_add_wilcvendorspec(u8 *buff)
{
memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec));
}
@@ -3259,7 +3259,7 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
* @date 01 MAR 2012
* @version 1.0
*/
-struct wireless_dev *WILC_WFI_CfgAlloc(void)
+static struct wireless_dev *WILC_WFI_CfgAlloc(void)
{

struct wireless_dev *wdev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 39cd8e1b5675..e7ea397644de 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -90,7 +90,6 @@ static const struct ieee80211_txrx_stypes
#define WILC_WFI_DWELL_PASSIVE 100
#define WILC_WFI_DWELL_ACTIVE 40

-struct wireless_dev *WILC_WFI_CfgAlloc(void);
struct wireless_dev *wilc_create_wiphy(struct net_device *net);
void wilc_free_wiphy(struct net_device *net);
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c8564249092c..83fd41a4f521 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -82,7 +82,9 @@ typedef struct {

static wilc_wlan_dev_t g_wlan;

+#ifdef WILC_OPTIMIZE_SLEEP_INT
static inline void chip_allow_sleep(void);
+#endif
static inline void chip_wakeup(void);
/********************************************
*
@@ -138,6 +140,7 @@ static inline void release_bus(BUS_RELEASE_T release)
*
********************************************/

+#ifdef TCP_ACK_FILTER
static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
{

@@ -160,6 +163,7 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
p->txq_entries -= 1;

}
+#endif

static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
{
@@ -273,19 +277,19 @@ typedef struct {



-struct Ack_session_info *Free_head;
-struct Ack_session_info *Alloc_head;
+static struct Ack_session_info *Free_head;
+static struct Ack_session_info *Alloc_head;

#define NOT_TCP_ACK (-1)

#define MAX_TCP_SESSION 25
#define MAX_PENDING_ACKS 256
-struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
-Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
+static struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
+static Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];

-u32 PendingAcks_arrBase;
-u32 Opened_TCP_session;
-u32 Pending_Acks;
+static u32 PendingAcks_arrBase;
+static u32 Opened_TCP_session;
+static u32 Pending_Acks;



@@ -449,17 +453,19 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
}
#endif

-bool EnableTCPAckFilter = false;
+static bool EnableTCPAckFilter = false;

void Enable_TCP_ACK_Filter(bool value)
{
EnableTCPAckFilter = value;
}

-bool is_TCP_ACK_Filter_Enabled(void)
+#ifdef TCP_ACK_FILTER
+static bool is_TCP_ACK_Filter_Enabled(void)
{
return EnableTCPAckFilter;
}
+#endif

static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
{
@@ -1834,7 +1840,7 @@ void wilc_bus_set_default_speed(void)
/* Restore bus speed to default. */
g_wlan.hif_func.hif_set_default_bus_speed();
}
-u32 init_chip(void)
+static u32 init_chip(void)
{
u32 chipid;
u32 reg, ret = 0;
--
2.1.0.rc2


2015-10-20 22:48:11

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 06/19] staging/wilc1000: avoid static definitions in header

The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes
and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c
and should not be shared in a header file.

This moves over all that data into the .c file, and also moves all
the macro definitions from the file that are also not needed here.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++++++++++++++++++++++
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 83 ----------------------
2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0ed05aafa5bf..702c40c1df4b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -17,6 +17,90 @@
#include "host_interface.h"
#include <linux/errno.h>

+/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
+#define NO_ENCRYPT 0
+#define ENCRYPT_ENABLED BIT(0)
+#define WEP BIT(1)
+#define WEP_EXTENDED BIT(2)
+#define WPA BIT(3)
+#define WPA2 BIT(4)
+#define AES BIT(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
+#define OPERCHAN_ATTR_ID 0x11
+#define PUB_ACTION_ATTR_ID 0x04
+#define P2PELEM_ATTR_ID 0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF 0x02
+#define P2P_INV_REQ 0x03
+#define P2P_INV_RSP 0x04
+#define PUBLIC_ACT_VENDORSPEC 0x09
+#define GAS_INTIAL_REQ 0x0a
+#define GAS_INTIAL_RSP 0x0b
+
+#define INVALID_CHANNEL 0
+
+#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
+#define SCAN_RESULT_EXPIRE (40 * HZ)
+
+static const u32 cipher_suites[] = {
+ WLAN_CIPHER_SUITE_WEP40,
+ WLAN_CIPHER_SUITE_WEP104,
+ WLAN_CIPHER_SUITE_TKIP,
+ WLAN_CIPHER_SUITE_CCMP,
+ WLAN_CIPHER_SUITE_AES_CMAC,
+};
+
+static const struct ieee80211_txrx_stypes
+ wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+ [NL80211_IFTYPE_STATION] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+ },
+ [NL80211_IFTYPE_AP] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+ [NL80211_IFTYPE_P2P_CLIENT] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4)
+ }
+};
+
+/* Time to stay on the channel */
+#define WILC_WFI_DWELL_PASSIVE 100
+#define WILC_WFI_DWELL_ACTIVE 40
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
+#define DEFAULT_LINK_SPEED 72
+
+
#define IS_MANAGMEMENT 0x100
#define IS_MANAGMEMENT_CALLBACK 0x080
#define IS_MGMT_STATUS_SUCCES 0x040
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index ae2aaea508db..158d98c0eb87 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,86 +10,6 @@
#define NM_WFI_CFGOPERATIONS
#include "wilc_wfi_netdevice.h"

-/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLED BIT(0)
-#define WEP BIT(1)
-#define WEP_EXTENDED BIT(2)
-#define WPA BIT(3)
-#define WPA2 BIT(4)
-#define AES BIT(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
-#define OPERCHAN_ATTR_ID 0x11
-#define PUB_ACTION_ATTR_ID 0x04
-#define P2PELEM_ATTR_ID 0xdd
-
-/*Public action subtype values*/
-#define GO_NEG_REQ 0x00
-#define GO_NEG_RSP 0x01
-#define GO_NEG_CONF 0x02
-#define P2P_INV_REQ 0x03
-#define P2P_INV_RSP 0x04
-#define PUBLIC_ACT_VENDORSPEC 0x09
-#define GAS_INTIAL_REQ 0x0a
-#define GAS_INTIAL_RSP 0x0b
-
-#define INVALID_CHANNEL 0
-
-#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
-#define SCAN_RESULT_EXPIRE (40 * HZ)
-
-static const u32 cipher_suites[] = {
- WLAN_CIPHER_SUITE_WEP40,
- WLAN_CIPHER_SUITE_WEP104,
- WLAN_CIPHER_SUITE_TKIP,
- WLAN_CIPHER_SUITE_CCMP,
- WLAN_CIPHER_SUITE_AES_CMAC,
-};
-
-static const struct ieee80211_txrx_stypes
- wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
- [NL80211_IFTYPE_STATION] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
- },
- [NL80211_IFTYPE_AP] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4) |
- BIT(IEEE80211_STYPE_ACTION >> 4)
- },
- [NL80211_IFTYPE_P2P_CLIENT] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4)
- }
-};
-
-/* Time to stay on the channel */
-#define WILC_WFI_DWELL_PASSIVE 100
-#define WILC_WFI_DWELL_ACTIVE 40
-
struct wireless_dev *wilc_create_wiphy(struct net_device *net);
void wilc_free_wiphy(struct net_device *net);
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
@@ -101,7 +21,4 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi
void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
u16 frame_type, bool reg);

-#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
-#define DEFAULT_LINK_SPEED 72
-
#endif
--
2.1.0.rc2


2015-10-21 10:53:55

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

On Wednesday 21 October 2015 19:06:52 glen lee wrote:
> Hi arnd,
>
> Thanks for the all the patches.
> About the patch ( use proper naming for global symbols ),
> We are planning to use this driver not only for wilc1000 but also for
> other atmel wireless driver. I'd appreciate if you could use wl instead of wilc1000.

Hmm, while I see that 'wilc1000' is too specific here, using just 'wl' might be
a little too general. The same namespace is used by drivers/mtd/ubi/wl.c,
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c, and a number of local
identifiers in other drivers.

Would 'wilc' work as a prefix for all devices you are interested in here?

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

Ok, so we need to coordinate a bit here. My patches also go in that direction
and remove the global variables from linux_wlan_sdio.c and linux_wlan_spi.c,
but did not remove the one from linux_wlan.c, because doing that depends on
the last [RFC] patch in my series, and I felt I had spent enough time on it
at that point ;-)

Would you be ok with taking my patches and rebasing them on top of yours
with the changes you want, or do you need help from me with that?

Arnd

2015-11-17 09:28:39

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 09/19] staging/wilc1000: move init/exit functions to driver files

Hi Arnd,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on next-20151117]
[cannot apply to v4.4-rc1]

url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/staging-wilc1000-cleanups/20151116-221148
config: x86_64-randconfig-s1-11171709 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

Note: the linux-review/Arnd-Bergmann/staging-wilc1000-cleanups/20151116-221148 HEAD 4f5bc10a2d185cc4ec5ab4741a5b3c6badbd4773 builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

drivers/staging/wilc1000/linux_wlan.c: In function 'wilc_netdev_init':
>> drivers/staging/wilc1000/linux_wlan.c:1513:26: error: 'wilc_spi_dev' undeclared (first use in this function)
wilc_dev->wilc_spidev = wilc_spi_dev;
^
drivers/staging/wilc1000/linux_wlan.c:1513:26: note: each undeclared identifier is reported only once for each function it appears in

vim +/wilc_spi_dev +1513 drivers/staging/wilc1000/linux_wlan.c

c5c77ba1 Johnny Kim 2015-05-11 1507
c5c77ba1 Johnny Kim 2015-05-11 1508 #ifndef WILC_SDIO
412cfe78 Arnd Bergmann 2015-11-16 1509 if (!wilc_spi_init()) {
c5c77ba1 Johnny Kim 2015-05-11 1510 PRINT_ER("Can't initialize SPI\n");
98b89847 Leo Kim 2015-11-05 1511 return -1;
c5c77ba1 Johnny Kim 2015-05-11 1512 }
412cfe78 Arnd Bergmann 2015-11-16 @1513 wilc_dev->wilc_spidev = wilc_spi_dev;
c5c77ba1 Johnny Kim 2015-05-11 1514 #else
412cfe78 Arnd Bergmann 2015-11-16 1515 wilc_dev->wilc_sdio_func = wilc_sdio_func;
c5c77ba1 Johnny Kim 2015-05-11 1516 #endif

:::::: The code at line 1513 was first introduced by commit
:::::: 412cfe7872b71d3699593bb3afd7ad804bd57c7a staging/wilc1000: use proper naming for global symbols

:::::: TO: Arnd Bergmann <[email protected]>
:::::: CC: 0day robot <[email protected]>

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


Attachments:
(No filename) (2.04 kB)
.config.gz (24.59 kB)
Download all attachments

2015-11-02 21:35:08

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/19] staging/wilc1000 cleanups

On Friday 23 October 2015 16:51:13 Tony Cho wrote:
> Hi Arnd,
> First of all, I would like to say "thank you" for your efforts and
> contributions.
> We are updating the driver because new revision came up and making new
> patches
> to make it stable and elegant as Linux driver. In these days, we are
> sending big changes
> while testing such patches and also doing updates at once.
>
> As you did, we are scheduled to provide the patches making device tree
> and delete all of platform
> dependencies as you removed WILC_SDIO_IRQ_GPIO as well as other things.
> So, I would like to
> discuss with you for your series of patch.
>
> In this time, I think it's important to make the driver to be compiled
> even if the link problem
> happens as you reported. So, how about deleting all of SPI related files
> from source tree and
> even from Kconfig for the time being because new bus driver will come or
> revert
> the Kconfig and then can we expect the best patch in the near feature?
>
> I respect your efforts and patches, so your opinion is very important to me.

Hi Tony,

I've seen you have merged the patches that you mentioned into Greg's
tree. I have now rebased my patches on top, including the separate SPI
driver. Once we merge those, it should work fine, and having multiple
front-end drivers gives a nice template for adding future hardware
specific variations like another bus, or a newer model on the same
bus. I'll post my patches after some more testing.

Arnd