2015-10-30 03:07:43

by Glen Lee

[permalink] [raw]
Subject: [PATCH 01/17] staging: wilc1000: define wiphy private data priv in struct host_if_drv

This patch defines wiphy private data priv in struct host_if_drv and set
priv to priv in host_if_drv to reference it's wiphy private data.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.h | 1 +
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 72c4797..f9efb5a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -260,6 +260,7 @@ enum p2p_listen_state {
};

struct host_if_drv {
+ struct wilc_priv *priv;
struct user_scan_req usr_scan_req;
struct user_conn_req usr_conn_req;
struct remain_ch remain_on_ch;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 32b93d3..8554f6f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3478,6 +3478,7 @@ int wilc_init_host_int(struct net_device *net)
s32Error = host_int_init(net, &priv->hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
+ priv->hWILCWFIDrv->priv = priv;

return s32Error;
}
--
1.9.1



2015-10-30 03:09:16

by Glen Lee

[permalink] [raw]
Subject: [PATCH 16/17] staging: wilc1000: linux_wlan_get_num_conn_ifcs: add argument net_device

This patch add new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 +---
drivers/staging/wilc1000/linux_wlan.c | 10 +++++++---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 1263b5e..2a8330e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -271,8 +271,6 @@ static struct host_if_drv *join_req_drv;

static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);

-extern int linux_wlan_get_num_conn_ifcs(void);
-
static int add_handler_in_list(struct host_if_drv *handler)
{
int i;
@@ -2991,7 +2989,7 @@ static int hostIFthread(void *pvArg)
del_timer(&hif_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");

- if (!linux_wlan_get_num_conn_ifcs())
+ if (!linux_wlan_get_num_conn_ifcs(hif_drv->priv->dev))
chip_sleep_manually(hif_drv->priv->dev,
INFINITE_SLEEP_TIME);

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2226ddb..3801a00 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -421,14 +421,18 @@ 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 linux_wlan_get_num_conn_ifcs(struct net_device *dev)
{
u8 i = 0;
u8 null_bssid[6] = {0};
u8 ret_val = 0;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;

- for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
+ wilc = nic->wilc;
+
+ for (i = 0; i < wilc->vif_num; i++)
+ if (memcmp(wilc->vif[i].bssid, null_bssid, 6))
ret_val++;

return ret_val;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 07917ea..31d5ac9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -219,4 +219,5 @@ void wilc1000_wlan_deinit(struct net_device *dev);
void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue);
int linux_wlan_get_firmware(struct net_device *dev);
+int linux_wlan_get_num_conn_ifcs(struct net_device *dev);
#endif
--
1.9.1


2015-10-30 03:08:58

by Glen Lee

[permalink] [raw]
Subject: [PATCH 13/17] staging: wilc1000: wilc_wlan_start: add argument struct net_device

This patch adds new argument struct net_device and pass dev to the function.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index bb37f5b..2226ddb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -584,7 +584,7 @@ static int linux_wlan_start_firmware(struct net_device *dev)

/* start firmware */
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
- ret = wilc_wlan_start();
+ ret = wilc_wlan_start(dev);
if (ret < 0) {
PRINT_ER("Failed to start Firmware\n");
goto _fail_;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 93fae34..894466f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1489,7 +1489,7 @@ _fail_1:
* Common
*
********************************************/
-int wilc_wlan_start(void)
+int wilc_wlan_start(struct net_device *dev)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index c948c25..73e01a7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -297,7 +297,7 @@ typedef struct {

int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
u32 buffer_size);
-int wilc_wlan_start(void);
+int wilc_wlan_start(struct net_device *dev);
int wilc_wlan_stop(struct net_device *dev);
int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
--
1.9.1


2015-10-30 08:35:57

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan

On Fri, Oct 30, 2015 at 12:10:42PM +0900, Glen Lee wrote:
> /*create the common structure*/
> - g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
> - if (!g_linux_wlan)
> + wl = kzalloc(sizeof(struct wilc), GFP_KERNEL);

This introduces a checkpatch.pl warning. The prefered style is:

wl = kzalloc(sizeof(*wl), GFP_KERNEL);

But the larger point is that please use checkpatch.pl.

regards,
dan carpenter


2015-10-30 03:08:11

by Glen Lee

[permalink] [raw]
Subject: [PATCH 05/17] staging: wilc1000: wilc_wlan_cfg_commit: add argument struct net_device

Add argument struct net_device and pass dev to the functions as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a72fa8c..75b0616 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1732,7 +1732,8 @@ void wilc_wlan_cleanup(struct net_device *dev)

}

-static int wilc_wlan_cfg_commit(int type, u32 drvHandler)
+static int wilc_wlan_cfg_commit(struct net_device *dev,
+ int type, u32 drvHandler)
{
wilc_wlan_dev_t *p = &g_wlan;
wilc_cfg_frame_t *cfg = &p->cfg_frame;
@@ -1796,7 +1797,7 @@ int wilc_wlan_cfg_set(struct net_device *dev, int start, u32 wid, u8 *buffer,
PRINT_D(RX_DBG, "Processing cfg_set()\n");
p->cfg_frame_in_use = 1;

- if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
+ if (wilc_wlan_cfg_commit(dev, WILC_CFG_SET, drvHandler))
ret_size = 0;

if (linux_wlan_lock_timeout(&wilc->cfg_event,
@@ -1837,7 +1838,7 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
if (commit) {
p->cfg_frame_in_use = 1;

- if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler))
+ if (wilc_wlan_cfg_commit(dev, WILC_CFG_QUERY, drvHandler))
ret_size = 0;


--
1.9.1


2015-10-30 03:08:34

by Glen Lee

[permalink] [raw]
Subject: [PATCH 09/17] staging: wilc1000: wilc_wlan_stop: add argument struct net_device

This patch adds new argument struct net_device and pass dev to the functions.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 6ffa2a1..1019a19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -935,7 +935,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);

- wilc_wlan_stop();
+ wilc_wlan_stop(dev);

PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
@@ -1176,7 +1176,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
return 0; /*success*/

_fail_fw_start_:
- wilc_wlan_stop();
+ wilc_wlan_stop(dev);

_fail_irq_enable_:
#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 c8ce1f6..d4eef3d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1598,7 +1598,7 @@ void wilc_wlan_global_reset(void)
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
release_bus(RELEASE_ONLY);
}
-int wilc_wlan_stop(void)
+int wilc_wlan_stop(struct net_device *dev)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 519f352..fa66783 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -297,7 +297,7 @@ typedef struct {

int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
int wilc_wlan_start(void);
-int wilc_wlan_stop(void);
+int wilc_wlan_stop(struct net_device *dev);
int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
--
1.9.1


2015-10-30 08:47:05

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan



On 2015년 10월 30일 17:35, Dan Carpenter wrote:
> On Fri, Oct 30, 2015 at 12:10:42PM +0900, Glen Lee wrote:
>> /*create the common structure*/
>> - g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
>> - if (!g_linux_wlan)
>> + wl = kzalloc(sizeof(struct wilc), GFP_KERNEL);
> This introduces a checkpatch.pl warning. The prefered style is:
>
> wl = kzalloc(sizeof(*wl), GFP_KERNEL);
>
> But the larger point is that please use checkpatch.pl.

Thank you for the review, I will use preferred style in v2.

regards,

glen lee

>
> regards,
> dan carpenter
>


2015-10-30 03:09:22

by Glen Lee

[permalink] [raw]
Subject: [PATCH 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan

Use wilc instead of g_linux_wlan. g_liux_wlan is not used anymore, just
delete it.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 22 +++++++++++-----------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 3801a00..5d4e64f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -112,7 +112,6 @@ 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;

static const struct net_device_ops wilc_netdev_ops = {
@@ -1702,15 +1701,16 @@ int wilc_netdev_init(struct wilc **wilc)
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
+ struct wilc *wl;

sema_init(&close_exit_sync, 0);

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

- *wilc = g_linux_wlan;
+ *wilc = wl;

register_inetaddr_notifier(&g_dev_notifier);

@@ -1737,11 +1737,11 @@ int wilc_netdev_init(struct wilc **wilc)
} else
strcpy(ndev->name, "p2p%d");

- nic->u8IfIdx = g_linux_wlan->vif_num;
+ nic->u8IfIdx = wl->vif_num;
nic->wilc_netdev = ndev;
- nic->wilc = *wilc;
- g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
- g_linux_wlan->vif_num++;
+ nic->wilc = wl;
+ wl->vif[wl->vif_num].ndev = ndev;
+ wl->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;

{
@@ -1781,13 +1781,13 @@ int wilc_netdev_init(struct wilc **wilc)
}

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

return 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 31d5ac9..54d798c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -206,7 +206,6 @@ struct WILC_WFI_mon_priv {
struct net_device *real_ndev;
};

-extern struct wilc *g_linux_wlan;
extern struct net_device *WILC_WFI_devs[];
void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
--
1.9.1


2015-10-30 03:08:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH 07/17] staging: wilc1000: wilc_wlan_txq_add_to_head: add new argument net_device

This patch adds new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index ec4bff4..b503f07 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -227,15 +227,21 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
up(&wilc->txq_event);
}

-static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
+static int wilc_wlan_txq_add_to_head(struct net_device *dev,
+ struct txq_entry_t *tqe)
{
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+
+ wilc = nic->wilc;
+
+ if (linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT))
return -1;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);

if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -251,14 +257,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(&wilc->txq_spinlock, flags);
+ up(&wilc->txq_add_to_head_cs);


/**
* wake up TX queue
**/
- up(&g_linux_wlan->txq_event);
+ up(&wilc->txq_event);
PRINT_D(TX_DBG, "Wake up the txq_handler\n");

return 0;
@@ -520,7 +526,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev,
**/
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");

- if (wilc_wlan_txq_add_to_head(tqe))
+ if (wilc_wlan_txq_add_to_head(dev, tqe))
return 0;
return 1;
}
--
1.9.1


2015-10-30 03:07:51

by Glen Lee

[permalink] [raw]
Subject: [PATCH 02/17] staging: wilc1000: send_config_pkt: add argument struct net_device

This patch adds new argument struct net_device and pass dev to the function
as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 3 +-
drivers/staging/wilc1000/coreconfigurator.h | 3 +-
drivers/staging/wilc1000/host_interface.c | 196 +++++++++++++++++++++-------
drivers/staging/wilc1000/wilc_wlan_if.h | 1 +
4 files changed, 156 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index e10c6ff..3b4a950 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -586,7 +586,8 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
* @date 1 Mar 2012
* @version 1.0
*/
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
+s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
+ u32 count, u32 drv)
{
s32 counter = 0, ret = 0;

diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 6294d92..1ea5f47 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -127,7 +127,8 @@ typedef struct {
size_t ie_len;
} tstrDisconnectNotifInfo;

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 17826f3..3a4fdc0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -329,6 +329,9 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -337,7 +340,7 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,

PRINT_D(HOSTINF_DBG, "Setting channel\n");

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -353,13 +356,17 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv,
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
wid.val = (s8 *)&hif_drv_handler->handler;
wid.size = sizeof(u32);

- result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler);
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
+ hif_drv_handler->handler);

if (!hif_drv)
up(&hif_sema_driver);
@@ -377,13 +384,16 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if ((hif_op_mode->mode) == IDLE_MODE)
@@ -402,6 +412,9 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
s32 result = 0;
struct wid wid;
char firmwareIPAddress[4] = {0};
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

if (pu8IPAddr[0] < 192)
pu8IPAddr[0] = 0;
@@ -415,7 +428,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
wid.val = (u8 *)pu8IPAddr;
wid.size = IP_ALEN;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
@@ -434,13 +447,16 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -470,6 +486,9 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

if (!mac_buf) {
PRINT_ER("No buffer to send mac address\n");
@@ -483,7 +502,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -499,13 +518,16 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = pstrHostIfGetMacAddress->mac_addr;
wid.size = ETH_ALEN;

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -523,6 +545,9 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid strWIDList[32];
u8 u8WidCnt = 0;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

down(&hif_drv->sem_cfg_values);

@@ -789,7 +814,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
u8WidCnt++;
}

- result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, u8WidCnt,
get_id_from_handler(hif_drv));

if (result)
@@ -817,6 +842,9 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
u8 *pu8Buffer;
u8 valuesize = 0;
u8 *pu8HdnNtwrksWidVal = NULL;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state);
@@ -910,7 +938,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv,
else if (hif_drv->hif_state == HOST_IF_IDLE)
scan_while_connected = false;

- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));

if (result)
@@ -943,6 +971,9 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
s32 result = 0;
u8 u8abort_running_scan;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n");

@@ -954,7 +985,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
wid.val = (s8 *)&u8abort_running_scan;
wid.size = sizeof(char);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -986,6 +1017,9 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
u32 u32WidsCount = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(GENERIC_DBG, "Handling connect request\n");

@@ -1208,7 +1242,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv,
PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID);
}

- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("failed to send config packet\n");
@@ -1275,6 +1309,9 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)
struct wid strWIDList[5];
u32 u32WidsCount = 0;
u8 *pu8CurrByte = NULL;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
strWIDList[u32WidsCount].type = WID_BIN_DATA;
@@ -1305,7 +1342,7 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)

u32WidsCount++;

- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(join_req_drv));
if (result) {
PRINT_ER("failed to send config packet\n");
@@ -1321,12 +1358,15 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
tstrConnectInfo strConnectInfo;
struct wid wid;
u16 u16DummyReasonCode = 0;
+ struct net_device *dev;

if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
return result;
}

+ dev = hif_drv->priv->dev;
+
hif_drv->hif_state = HOST_IF_IDLE;

scan_while_connected = false;
@@ -1366,7 +1406,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)

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

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send dissconect config packet\n");
@@ -1705,6 +1745,9 @@ static int Handle_Key(struct host_if_drv *hif_drv,
u8 *pu8keybuf;
s8 s8idxarray[1];
s8 ret = 0;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

switch (pstrHostIFkeyAttr->type) {
case WEP:
@@ -1744,7 +1787,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
strWIDList[3].val = (s8 *)pu8keybuf;

- result = send_config_pkt(SET_CFG, strWIDList, 4,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, 4,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
}
@@ -1767,7 +1810,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
wid.val = (s8 *)pu8keybuf;
wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & REMOVEKEY) {
@@ -1779,7 +1822,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
wid.val = s8idxarray;
wid.size = 1;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
} else {
wid.id = (u16)WID_KEY_ID;
@@ -1789,7 +1832,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,

PRINT_D(HOSTINF_DBG, "Setting default key index\n");

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
}
up(&hif_drv->sem_test_key_block);
@@ -1822,7 +1865,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = RX_MIC_KEY_MSG_LEN;

- result = send_config_pkt(SET_CFG, strWIDList, 2,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, 2,
get_id_from_handler(hif_drv));

kfree(pu8keybuf);
@@ -1855,7 +1898,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
wid.val = (s8 *)pu8keybuf;
wid.size = RX_MIC_KEY_MSG_LEN;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

kfree(pu8keybuf);
@@ -1894,7 +1937,7 @@ _WPARxGtk_end_case_:
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = PTK_KEY_MSG_LEN + 1;

- result = send_config_pkt(SET_CFG, strWIDList, 2,
+ result = send_config_pkt(dev, SET_CFG, strWIDList, 2,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1917,7 +1960,7 @@ _WPARxGtk_end_case_:
wid.val = (s8 *)pu8keybuf;
wid.size = PTK_KEY_MSG_LEN;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1952,7 +1995,7 @@ _WPAPtk_end_case_:
wid.val = (s8 *)pu8keybuf;
wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

kfree(pu8keybuf);
@@ -1971,6 +2014,9 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)

s32 result = 0;
u16 u16DummyReasonCode = 0;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_DISCONNECT;
wid.type = WID_CHAR;
@@ -1984,7 +2030,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv)

eth_zero_addr(u8ConnectedSSID);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -2063,6 +2109,9 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -2071,7 +2120,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Getting channel value\n");

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -2088,6 +2137,9 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv)
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_RSSI;
wid.type = WID_CHAR;
@@ -2096,7 +2148,7 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to get RSSI value\n");
@@ -2110,6 +2162,9 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

link_speed = 0;

@@ -2120,7 +2175,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
@@ -2134,6 +2189,9 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis
{
struct wid strWIDList[5];
u32 u32WidsCount = 0, result = 0;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

strWIDList[u32WidsCount].id = WID_LINKSPEED;
strWIDList[u32WidsCount].type = WID_CHAR;
@@ -2165,7 +2223,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis
strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
u32WidsCount++;

- result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount,
+ result = send_config_pkt(dev, GET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));

if (result)
@@ -2181,6 +2239,9 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
s32 result = 0;
u8 *stamac;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
wid.type = WID_STR;
@@ -2192,7 +2253,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,

PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -2205,7 +2266,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
wid.val = (s8 *)&inactive_time;
wid.size = sizeof(u32);

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
@@ -2226,6 +2287,9 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Adding BEACON\n");

@@ -2264,7 +2328,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv,
memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
pu8CurrByte += pstrSetBeaconParam->tail_len;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add beacon config packet\n");
@@ -2280,6 +2344,9 @@ static void Handle_DelBeacon(struct host_if_drv *hif_drv)
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_DEL_BEACON;
wid.type = WID_CHAR;
@@ -2293,7 +2360,7 @@ static void Handle_DelBeacon(struct host_if_drv *hif_drv)

PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send delete beacon config packet\n");
@@ -2353,6 +2420,9 @@ static void Handle_AddStation(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Handling add station\n");
wid.id = (u16)WID_ADD_STA;
@@ -2366,7 +2436,7 @@ static void Handle_AddStation(struct host_if_drv *hif_drv,
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0)
PRINT_ER("Failed to send add station config packet\n");
@@ -2384,6 +2454,9 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv,
u8 *pu8CurrByte;
u8 i;
u8 au8Zero_Buff[6] = {0};
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_DEL_ALL_STA;
wid.type = WID_STR;
@@ -2408,7 +2481,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv,
pu8CurrByte += ETH_ALEN;
}

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2425,6 +2498,9 @@ static void Handle_DelStation(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_REMOVE_STA;
wid.type = WID_BIN;
@@ -2440,7 +2516,7 @@ static void Handle_DelStation(struct host_if_drv *hif_drv,

memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2455,6 +2531,9 @@ static void Handle_EditStation(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_EDIT_STA;
wid.type = WID_BIN;
@@ -2468,7 +2547,7 @@ static void Handle_EditStation(struct host_if_drv *hif_drv,
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send edit station config packet\n");
@@ -2484,6 +2563,9 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
s32 result = 0;
u8 u8remain_on_chan_flag;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

if (!hif_drv->remain_on_ch_pending) {
hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg;
@@ -2529,7 +2611,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = (s8)pstrHostIfRemainOnChan->ch;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0)
PRINT_ER("Failed to set remain on channel\n");
@@ -2558,6 +2640,9 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n",
pstrHostIfRegisterFrame->reg,
@@ -2577,7 +2662,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv,

wid.size = sizeof(u16) + 2;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to frame register config packet\n");
@@ -2593,6 +2678,9 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
u8 u8remain_on_chan_flag;
struct wid wid;
s32 result = 0;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n");

@@ -2609,7 +2697,7 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
@@ -2654,6 +2742,9 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
s8 s8PowerMode;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

wid.id = (u16)WID_POWER_MANAGEMENT;

@@ -2667,7 +2758,7 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv,

PRINT_D(HOSTINF_DBG, "Handling Power Management\n");

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send power management config packet\n");
@@ -2679,6 +2770,9 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
u8 *pu8CurrByte;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n");

@@ -2703,7 +2797,7 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
if ((strHostIfSetMulti->cnt) > 0)
memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN));

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send setup multicast config packet\n");
@@ -2719,6 +2813,9 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
struct wid wid;
int AddbaTimeout = 100;
char *ptr = NULL;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
strHostIfBASessionInfo->bssid[0],
@@ -2749,7 +2846,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
*ptr++ = 8;
*ptr++ = 0;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
@@ -2768,7 +2865,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
*ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
*ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
*ptr++ = 3;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

kfree(wid.val);
@@ -2782,6 +2879,9 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
s32 result = 0;
struct wid wid;
char *ptr = NULL;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
strHostIfBASessionInfo->bssid[0],
@@ -2803,7 +2903,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
*ptr++ = 0;
*ptr++ = 32;

- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = send_config_pkt(dev, SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -3609,6 +3709,9 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;
+
+ dev = hif_drv->priv->dev;

if (!hif_drv) {
PRINT_ER("Driver is null\n");
@@ -3620,7 +3723,7 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
wid.val = pu8AssocRespInfo;
wid.size = u32MaxAssocRespInfoLen;

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
*pu32RcvdAssocRespInfoLen = 0;
@@ -3784,18 +3887,21 @@ s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
{
s32 result = 0;
struct wid wid;
+ struct net_device *dev;

if (!hif_drv) {
PRINT_ER("driver is null\n");
return -EFAULT;
}

+ dev = hif_drv->priv->dev;
+
wid.id = (u16)WID_MEMORY_ADDRESS;
wid.type = WID_INT;
wid.val = (s8 *)pu32TestMemAddr;
wid.size = sizeof(u32);

- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = send_config_pkt(dev, GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));

if (result) {
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 89d2d65..1170169 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -12,6 +12,7 @@

#include <linux/semaphore.h>
#include "linux_wlan_common.h"
+#include <linux/netdevice.h>

/********************************************
*
--
1.9.1


2015-10-30 03:07:58

by Glen Lee

[permalink] [raw]
Subject: [PATCH 03/17] staging: wilc1000: wilc_wlan_cfg_get: add argument struct net_device

Adds argument struct net_device and use netdev private data member wilc
instead of g_linux_wlan, pass dev to the functions as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 3 ++-
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 8 ++++++--
drivers/staging/wilc1000/wilc_wlan.h | 3 ++-
4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 3b4a950..530d64a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -595,7 +595,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
for (counter = 0; counter < count; counter++) {
PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
(counter == count - 1));
- if (!wilc_wlan_cfg_get(!counter,
+ if (!wilc_wlan_cfg_get(dev,
+ !counter,
wids[counter].id,
(counter == count - 1),
drv)) {
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d0161cd..4ed324c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1153,7 +1153,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)

wilc_bus_set_max_speed();

- if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
+ if (wilc_wlan_cfg_get(dev, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 16224ce..768fd30 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1809,12 +1809,16 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,

return ret_size;
}
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
+int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
+ u32 drvHandler)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 offset;
int ret_size;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;

+ wilc = nic->wilc;

if (p->cfg_frame_in_use)
return 0;
@@ -1834,7 +1838,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(&wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Get Timed Out\n");
ret_size = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2eb7e20..2879a93 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -305,7 +305,8 @@ void wilc_handle_isr(void *wilc);
void wilc_wlan_cleanup(struct net_device *dev);
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
int commit, u32 drvHandler);
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
+int wilc_wlan_cfg_get(struct net_device *dev, 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(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
--
1.9.1


2015-10-30 03:08:04

by Glen Lee

[permalink] [raw]
Subject: [PATCH 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device

This patch adds new argument net_device and use netdev private data member
wilc instead of g_linux_wlan, pass dev to the functions also.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 3 +-
drivers/staging/wilc1000/linux_wlan.c | 86 ++++++++++++++---------------
drivers/staging/wilc1000/wilc_wlan.c | 9 ++-
drivers/staging/wilc1000/wilc_wlan.h | 4 +-
4 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 530d64a..74fb556 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -616,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id);
- if (!wilc_wlan_cfg_set(!counter,
+ if (!wilc_wlan_cfg_set(dev,
+ !counter,
wids[counter].id,
wids[counter].val,
wids[counter].size,
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 4ed324c..6ffa2a1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -662,53 +662,53 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni

*(int *)c_val = 1;

- if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;

/*to tell fw that we are going to use PC test - WILC specific*/
c_val[0] = 0;
- if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = INFRASTRUCTURE;
- if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;

/* c_val[0] = RATE_AUTO; */
c_val[0] = RATE_AUTO;
- if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = G_MIXED_11B_2_MODE;
- if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = G_SHORT_PREAMBLE;
- if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = AUTO_PROT;
- if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = ACTIVE_SCAN;
- if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = SITE_SURVEY_OFF;
- if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;

*((int *)c_val) = 0xffff; /* Never use RTS-CTS */
- if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;

*((int *)c_val) = 2346;
- if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;

/* SSID */
@@ -719,23 +719,23 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* to enable Broadcast SSID suppport ) */
/* -------------------------------------------------------------- */
c_val[0] = 0;
- if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NO_POWERSAVE;
- if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
- if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = OPEN_SYSTEM;
- if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
goto _fail_;

/* WEP/802 11I Configuration */
@@ -747,7 +747,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* ------------------------------------------------------------------ */

strcpy(c_val, "123456790abcdef1234567890");
- if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0))
goto _fail_;

/* WEP/802 11I Configuration */
@@ -757,7 +757,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* and less than 64 bytes */
/* ------------------------------------------------------------------ */
strcpy(c_val, "12345678");
- if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0))
goto _fail_;

/* IEEE802.1X Key Configuration */
@@ -767,7 +767,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* and less than 65 bytes */
/* ------------------------------------------------------------------ */
strcpy(c_val, "password");
- if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0))
goto _fail_;

/* IEEE802.1X Server Address Configuration */
@@ -779,31 +779,31 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
c_val[1] = 168;
c_val[2] = 1;
c_val[3] = 112;
- if (!wilc_wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
goto _fail_;

c_val[0] = 3;
- if (!wilc_wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 3;
- if (!wilc_wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = NORMAL_ACK;
- if (!wilc_wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 48;
- if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 28;
- if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0))
goto _fail_;

/* Beacon Interval */
@@ -813,11 +813,11 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* -------------------------------------------------------------------- */

*((int *)c_val) = 100;
- if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
goto _fail_;

c_val[0] = REKEY_DISABLE;
- if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
goto _fail_;

/* Rekey Time (s) (Used only when the Rekey policy is 2 or 4) */
@@ -826,7 +826,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* Values to set : 32-bit value */
/* -------------------------------------------------------------------- */
*((int *)c_val) = 84600;
- if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
goto _fail_;

/* Rekey Packet Count (in 1000s; used when Rekey Policy is 3) */
@@ -835,59 +835,59 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni
/* Values to set : 32-bit Value */
/* -------------------------------------------------------------------- */
*((int *)c_val) = 500;
- if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0))
goto _fail_;

c_val[0] = 1;
- if (!wilc_wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = G_SELF_CTS_PROT;
- if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1; /* Enable N */
- if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = HT_MIXED_MODE;
- if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1; /* TXOP Prot disable in N mode: No RTS-CTS on TX A-MPDUs to save air-time. */
- if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0))
goto _fail_;

memcpy(c_val, mac_add, 6);

- if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_MAC_ADDR, c_val, 6, 0, 0))
goto _fail_;

/**
* AP only
**/
c_val[0] = DETECT_PROTECT_REPORT;
- if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = RTS_CTS_NONHT_PROT;
- if (!wilc_wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 0;
- if (!wilc_wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = MIMO_MODE;
- if (!wilc_wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 7;
- if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0))
goto _fail_;

c_val[0] = 1; /* Enable N with immediate block ack. */
- if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1))
+ if (!wilc_wlan_cfg_set(dev, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1))
goto _fail_;

return 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 768fd30..a72fa8c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1768,13 +1768,16 @@ static int wilc_wlan_cfg_commit(int type, u32 drvHandler)
return 0;
}

-int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
- int commit, u32 drvHandler)
+int wilc_wlan_cfg_set(struct net_device *dev, int start, u32 wid, u8 *buffer,
+ u32 buffer_size, int commit, u32 drvHandler)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 offset;
int ret_size;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;

+ wilc = nic->wilc;

if (p->cfg_frame_in_use)
return 0;
@@ -1796,7 +1799,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(&wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Set Timed Out\n");
ret_size = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2879a93..519f352 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -303,8 +303,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
void wilc_handle_isr(void *wilc);
void wilc_wlan_cleanup(struct net_device *dev);
-int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
- int commit, u32 drvHandler);
+int wilc_wlan_cfg_set(struct net_device *dev, int start, u32 wid, u8 *buffer,
+ u32 buffer_size, int commit, u32 drvHandler);
int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
u32 drvHandler);
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
--
1.9.1


2015-10-30 03:08:46

by Glen Lee

[permalink] [raw]
Subject: [PATCH 11/17] staging: wilc1000: wilc_wlan_firmware_download: add argument net_device

Add new argument struct net_device and pass dev to the function as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 3 ++-
drivers/staging/wilc1000/wilc_wlan.h | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1019a19..bb37f5b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -624,7 +624,7 @@ static int linux_wlan_firmware_download(struct net_device *dev)
* do the firmware download
**/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
- ret = wilc_wlan_firmware_download(wilc->firmware->data,
+ ret = wilc_wlan_firmware_download(dev, wilc->firmware->data,
wilc->firmware->size);
if (ret < 0)
goto _FAIL_;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c464cd7..e8afa6b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1415,7 +1415,8 @@ void wilc_handle_isr(void *wilc)
* Firmware download
*
********************************************/
-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
+int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
+ u32 buffer_size)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 offset;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index fa66783..194c24c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -295,7 +295,8 @@ typedef struct {
u32 seq_no;
} wilc_cfg_rsp_t;

-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
+int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
+ u32 buffer_size);
int wilc_wlan_start(void);
int wilc_wlan_stop(struct net_device *dev);
int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
--
1.9.1


2015-10-30 03:08:28

by Glen Lee

[permalink] [raw]
Subject: [PATCH 08/17] staging: wilc1000: remove unused function remove_TCP_related

Just remove unused function remove_TCP_related.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index b503f07..c8ce1f6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -349,16 +349,6 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent
}
return 0;
}
-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_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
- return 0;
-}

static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
{
--
1.9.1


2015-10-30 03:08:52

by Glen Lee

[permalink] [raw]
Subject: [PATCH 12/17] staging: wilc1000: chip_sleep_manually: add argument struct net_device

This patch add new argument struct net_device and pass dev to the function
as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 3a4fdc0..1263b5e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -271,7 +271,6 @@ 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);

static int add_handler_in_list(struct host_if_drv *handler)
@@ -2993,7 +2992,8 @@ static int hostIFthread(void *pvArg)
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");

if (!linux_wlan_get_num_conn_ifcs())
- chip_sleep_manually(INFINITE_SLEEP_TIME);
+ chip_sleep_manually(hif_drv->priv->dev,
+ INFINITE_SLEEP_TIME);

Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index e8afa6b..93fae34 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -810,7 +810,7 @@ static inline void chip_wakeup(void)
genuChipPSstate = CHIP_WAKEDUP;
}
#endif
-void chip_sleep_manually(u32 u32SleepTime)
+void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime)
{
if (genuChipPSstate != CHIP_WAKEDUP) {
/* chip is already sleeping. Do nothing */
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 194c24c..c948c25 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -311,4 +311,5 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
+void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime);
#endif
--
1.9.1


2015-10-30 03:09:09

by Glen Lee

[permalink] [raw]
Subject: [PATCH 15/17] staging: wilc1000: release_bus: add argument struct wilc

This patch adds new argument struct wilc and use it instead of g_linux_wlan,
pass wilc to the functions as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 44 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a61dbea..898f60e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -122,13 +122,13 @@ static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
}

}
-static inline void release_bus(BUS_RELEASE_T release)
+static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
{
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wilc->hif_cs);
}
/********************************************
*
@@ -831,7 +831,7 @@ void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime)
g_wlan.hif_func.hif_write_reg(0x10a8, 1);

genuChipPSstate = CHIP_SLEEPING_MANUAL;
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);

}

@@ -954,7 +954,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
* wait for vmm table is ready
**/
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
}
@@ -1002,7 +1002,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
entries = ((reg >> 3) & 0x3f);
break;
} else {
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg);
@@ -1047,7 +1047,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)

/* since copying data into txb takes some time, then
* allow the bus lock to be released let the RX task go. */
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);

/**
* Copy data to the TX buffer
@@ -1126,7 +1126,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)

_end_:

- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
if (ret != 1)
break;
} while (0);
@@ -1412,7 +1412,7 @@ void wilc_handle_isr(void *wilc)
#endif
wilc_unknown_isr_ext();
}
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}

/********************************************
@@ -1473,7 +1473,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
offset += size2;
size -= size2;
}
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);

if (!ret) {
/*EIO 5*/
@@ -1522,7 +1522,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
/* EIO 5*/
ret = -5;
return ret;
@@ -1563,7 +1563,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
/* EIO 5*/
ret = -5;
return ret;
@@ -1577,7 +1577,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_read_reg(0x1000, &chipid);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
/* EIO 5*/
ret = -5;
return ret;
@@ -1598,7 +1598,7 @@ int wilc_wlan_start(struct net_device *dev)
reg |= BIT(10);
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);

return (ret < 0) ? ret : 0;
}
@@ -1621,7 +1621,7 @@ int wilc_wlan_stop(struct net_device *dev)
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}

@@ -1631,7 +1631,7 @@ int wilc_wlan_stop(struct net_device *dev)
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
if (!ret) {
PRINT_ER("Error while writing reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}

@@ -1641,7 +1641,7 @@ int wilc_wlan_stop(struct net_device *dev)
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout);
@@ -1656,7 +1656,7 @@ int wilc_wlan_stop(struct net_device *dev)
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout);
@@ -1672,7 +1672,7 @@ int wilc_wlan_stop(struct net_device *dev)

ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);

- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);

return ret;
}
@@ -1726,15 +1726,15 @@ void wilc_wlan_cleanup(struct net_device *dev)
ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, &reg);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
PRINT_ER("Writing ABORT reg\n");
ret = p->hif_func.hif_write_reg(WILC_GP_REG_0, (reg | ABORT_INT));
if (!ret) {
PRINT_ER("Error while writing reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
/**
* io clean up
**/
@@ -1931,7 +1931,7 @@ u32 init_chip(struct net_device *dev)
}
}

- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);

return ret;

--
1.9.1


2015-10-30 03:08:39

by Glen Lee

[permalink] [raw]
Subject: [PATCH 10/17] staging: wilc1000: remove unused function wilc_wlan_global_reset

Remove unused function wilc_wlan_global_reset.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index d4eef3d..c464cd7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1589,15 +1589,6 @@ int wilc_wlan_start(void)
return (ret < 0) ? ret : 0;
}

-void wilc_wlan_global_reset(void)
-{
-
- wilc_wlan_dev_t *p = &g_wlan;
-
- acquire_bus(ACQUIRE_AND_WAKEUP);
- p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
- release_bus(RELEASE_ONLY);
-}
int wilc_wlan_stop(struct net_device *dev)
{
wilc_wlan_dev_t *p = &g_wlan;
--
1.9.1


2015-10-30 03:09:03

by Glen Lee

[permalink] [raw]
Subject: [PATCH 14/17] staging: wilc1000: acquire_bus: add new argument struct wilc

This patch adds struct wilc and use it instead of g_linux_wlan, pass dev
to the functions as well.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 47 ++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 894466f..a61dbea 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -109,10 +109,10 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
/*acquire_bus() and release_bus() are made static inline functions*/
/*as a temporary workaround to fix a problem of receiving*/
/*unknown interrupt from FW*/
-static inline void acquire_bus(BUS_ACQUIRE_T acquire)
+static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
{

- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc->hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (genuChipPSstate != CHIP_WAKEDUP)
#endif
@@ -812,11 +812,16 @@ static inline void chip_wakeup(void)
#endif
void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime)
{
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;
+
if (genuChipPSstate != CHIP_WAKEDUP) {
/* chip is already sleeping. Do nothing */
return;
}
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);

#ifdef WILC_OPTIMIZE_SLEEP_INT
chip_allow_sleep();
@@ -921,7 +926,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
PRINT_D(TX_DBG, "Mark the last entry in VMM table - number of previous entries = %d\n", i);
vmm_table[i] = 0x0; /* mark the last element to 0 */
}
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0;
do {

@@ -951,7 +956,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
release_bus(RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
}
} while (!p->quit);

@@ -999,7 +1004,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
} else {
release_bus(RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg);
}
} while (--timeout);
@@ -1102,7 +1107,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
/**
* lock the bus
**/
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM);
if (!ret) {
@@ -1385,7 +1390,7 @@ void wilc_handle_isr(void *wilc)
{
u32 int_status;

- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
g_wlan.hif_func.hif_read_int(&int_status);

if (int_status & PLL_INT_EXT)
@@ -1423,6 +1428,10 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
u32 addr, size, size2, blksz;
u8 *dma_buffer;
int ret = 0;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;

blksz = BIT(12);
/* Allocate a DMA coherent buffer. */
@@ -1447,7 +1456,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
addr = BYTE_SWAP(addr);
size = BYTE_SWAP(size);
#endif
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);
offset += 8;
while (((int)size) && (offset < buffer_size)) {
if (size <= blksz)
@@ -1495,6 +1504,10 @@ int wilc_wlan_start(struct net_device *dev)
u32 reg = 0;
int ret;
u32 chipid;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;

/**
* Set the host interface
@@ -1505,7 +1518,7 @@ int wilc_wlan_start(struct net_device *dev)
} else if (p->io_func.io_type == HIF_SPI) {
reg = 1;
}
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);
ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
@@ -1596,10 +1609,14 @@ int wilc_wlan_stop(struct net_device *dev)
u32 reg = 0;
int ret;
u8 timeout = 10;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;
/**
* TODO: stop the firmware, need a re-download
**/
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);

ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
if (!ret) {
@@ -1703,7 +1720,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
#endif
kfree(p->tx_buffer);

- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);


ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, &reg);
@@ -1875,8 +1892,12 @@ u32 init_chip(struct net_device *dev)
{
u32 chipid;
u32 reg, ret = 0;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;

- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);

chipid = wilc_get_chipid(true);

--
1.9.1


2015-10-30 03:08:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 06/17] staging: wilc1000: wilc_wlan_txq_add_cfg_pkt: add argument net_device

This patch adds new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 75b0616..ec4bff4 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -484,15 +484,20 @@ bool is_TCP_ACK_Filter_Enabled(void)
return EnableTCPAckFilter;
}

-static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev,
+ u8 *buffer, u32 buffer_size)
{
wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
+ perInterface_wlan_t *nic = netdev_priv(dev);
+ struct wilc *wilc;
+
+ wilc = nic->wilc;

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(&wilc->cfg_event);
return 0;
}

@@ -1763,7 +1768,7 @@ static int wilc_wlan_cfg_commit(struct net_device *dev,
* Add to TX queue
**/

- if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len))
+ if (!wilc_wlan_txq_add_cfg_pkt(dev, &cfg->wid_header[0], total_len))
return -1;

return 0;
--
1.9.1


2015-11-02 01:40:04

by Glen Lee

[permalink] [raw]
Subject: About the patch "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"

Hi Shivani Bhardwaj,

Thank you for the patches.

I am writing this new mail thread since I didn't received about following patch which is applied recently.

https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/patch/drivers/staging/wilc1000?id=d4622f68db8095dd54179e3134e97812727f6b89

I have tested this on hardware but it did not working.
As far as I know, ether_addr_copy function can be used when src and dst addresss are __aligned(2) and it has to be proved.
Would you let us know the addresses are properly aligned? I cannot make sure the data is aligned(2).

Regards,
glen lee.


2015-11-03 08:56:49

by Glen Lee

[permalink] [raw]
Subject: Re: About the patch "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"

Hi Shivani,

I will revert as you said, I always appreciate all the effort and your time to help.

Regards,
glen lee.


On 2015년 11월 03일 17:26, Shivani Bhardwaj wrote:
> On Mon, Nov 2, 2015 at 7:13 AM, glen lee <[email protected]> wrote:
>> Hi Shivani Bhardwaj,
>>
>> Thank you for the patches.
>>
>> I am writing this new mail thread since I didn't received about following
>> patch which is applied recently.
>>
>> https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/patch/drivers/staging/wilc1000?id=d4622f68db8095dd54179e3134e97812727f6b89
>>
>> I have tested this on hardware but it did not working.
>> As far as I know, ether_addr_copy function can be used when src and dst
>> addresss are __aligned(2) and it has to be proved.
>> Would you let us know the addresses are properly aligned? I cannot make sure
>> the data is aligned(2).
> Hi Glen,
>
> Thanks for pointing out. I checked it. The alignment is wrong. Please
> drop this patch. I'm really sorry for the inconvenience caused. I'll
> make sure to send a new patch with correct alignment.
>
> Thank you
> Shivani
>
>> Regards,
>> glen lee.
>>


2015-11-03 08:26:26

by Shivani Bhardwaj

[permalink] [raw]
Subject: Re: About the patch "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"

On Mon, Nov 2, 2015 at 7:13 AM, glen lee <[email protected]> wrote:
> Hi Shivani Bhardwaj,
>
> Thank you for the patches.
>
> I am writing this new mail thread since I didn't received about following
> patch which is applied recently.
>
> https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/patch/drivers/staging/wilc1000?id=d4622f68db8095dd54179e3134e97812727f6b89
>
> I have tested this on hardware but it did not working.
> As far as I know, ether_addr_copy function can be used when src and dst
> addresss are __aligned(2) and it has to be proved.
> Would you let us know the addresses are properly aligned? I cannot make sure
> the data is aligned(2).

Hi Glen,

Thanks for pointing out. I checked it. The alignment is wrong. Please
drop this patch. I'm really sorry for the inconvenience caused. I'll
make sure to send a new patch with correct alignment.

Thank you
Shivani

>
> Regards,
> glen lee.
>