Use netdev private member wilc instead of g_linux_wlan and change argument wilc
with dev in the function request_threaded_irq to pass back to handler
the function isr_uh_routine.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ded302a..324cc57 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -229,10 +229,16 @@ 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)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+ struct net_device *dev = (struct net_device *)user_data;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
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 (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
@@ -284,7 +290,7 @@ static int init_irq(struct net_device *dev)
if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine,
IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
- "WILC_IRQ", wl)) < 0) {
+ "WILC_IRQ", dev)) < 0) {
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
--
1.9.1
This patch add argument net_device dev and use netdev private data member wilc
instead of g_linux_wlan. Pass argument dev to the function.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 907da93..63712a2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -406,14 +406,18 @@ static inline int tcp_process(struct txq_entry_t *tqe)
}
-static int wilc_wlan_txq_filter_dup_tcp_ack(void)
+static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
{
-
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
u32 i = 0;
u32 Dropped = 0;
wilc_wlan_dev_t *p = &g_wlan;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, p->txq_spinlock_flags);
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
+ spin_lock_irqsave(&wilc->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 +444,11 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
PendingAcks_arrBase = 0;
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock,
- p->txq_spinlock_flags);
+ spin_unlock_irqrestore(&wilc->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(&wilc->txq_event, 1);
Dropped--;
}
@@ -842,7 +845,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
#ifdef TCP_ACK_FILTER
- wilc_wlan_txq_filter_dup_tcp_ack();
+ wilc_wlan_txq_filter_dup_tcp_ack(dev);
#endif
/**
* build the vmm list
--
1.9.1
Hi Glen,
[auto build test ERROR on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Glen-Lee/staging-wicl1000-isr_uh_routine-use-netdev-private-wilc/20151027-173115
config: i386-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
In file included from drivers/staging/wilc1000/host_interface.c:5:0:
>> drivers/staging/wilc1000/host_interface.h:914:50: warning: 'struct net_device' declared inside parameter list
s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
^
>> drivers/staging/wilc1000/host_interface.h:914:50: warning: its scope is only this definition or declaration, which is probably not what you want
>> drivers/staging/wilc1000/host_interface.c:4135:5: error: conflicting types for 'host_int_init'
s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
^
In file included from drivers/staging/wilc1000/host_interface.c:5:0:
drivers/staging/wilc1000/host_interface.h:914:5: note: previous declaration of 'host_int_init' was here
s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
^
vim +/host_int_init +4135 drivers/staging/wilc1000/host_interface.c
4129
4130 void host_int_send_network_info_to_host
4131 (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
4132 {
4133 }
4134
> 4135 s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
4136 {
4137 s32 result = 0;
4138 struct host_if_drv *hif_drv;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
This patch adds argument struct wilc and pass wilc to the function.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index be6f631..5141fe0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1260,7 +1260,7 @@ static void wilc_sleeptimer_isr_ext(u32 int_stats1)
#endif
}
-static void wilc_wlan_handle_isr_ext(u32 int_status)
+static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
{
wilc_wlan_dev_t *p = &g_wlan;
#ifdef MEMORY_STATIC
@@ -1364,7 +1364,7 @@ void wilc_handle_isr(void *wilc)
wilc_pllupdate_isr_ext(int_status);
if (int_status & DATA_INT_EXT) {
- wilc_wlan_handle_isr_ext(int_status);
+ wilc_wlan_handle_isr_ext(wilc, int_status);
#ifndef WILC_OPTIMIZE_SLEEP_INT
/* Chip is up and talking*/
genuChipPSstate = CHIP_WAKEDUP;
--
1.9.1
This patch add new argument wilc to wilc_handle_isr and pass wilc to
the function.
It is void type for now because wilc_wlan.c was implemented platform
independently at the beginning (linux_wlan.c is implementation of LINUX part),
so the header file which defines struct wilc cannot be included at this moment,
but this driver is dedicated to LINUX so wilc_wlan.c and linux_wlan.c will be
merged. After that, this void type will be changed with struct wilc as well as
other functions which are using void type in wilc_wlan.h.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/linux_wlan_sdio.c | 7 +++++--
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ac2bc06..54e077d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -261,7 +261,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
}
PRINT_D(INT_DBG, "Interrupt received BH\n");
- wilc_handle_isr();
+ wilc_handle_isr(wilc);
return IRQ_HANDLED;
}
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f8d874..4aff953 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -27,7 +27,6 @@ struct wilc_sdio {
};
struct sdio_func *local_sdio_func;
-extern void wilc_handle_isr(void);
static unsigned int sdio_default_speed;
@@ -42,9 +41,13 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
static void wilc_sdio_interrupt(struct sdio_func *func)
{
+ struct wilc_sdio *wl_sdio;
+
+ wl_sdio = sdio_get_drvdata(func);
+
#ifndef WILC_SDIO_IRQ_GPIO
sdio_release_host(func);
- wilc_handle_isr();
+ wilc_handle_isr(wl_sdio->wilc);
sdio_claim_host(func);
#endif
}
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 67b0c52..be6f631 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1353,7 +1353,7 @@ _end_:
wilc_wlan_handle_rxq();
}
-void wilc_handle_isr(void)
+void wilc_handle_isr(void *wilc)
{
u32 int_status;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index bd89689..a07375b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -301,7 +301,7 @@ int wilc_wlan_stop(void);
int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
wilc_tx_complete_func_t func);
int wilc_wlan_handle_txq(u32 *pu32TxqCount);
-void wilc_handle_isr(void);
+void wilc_handle_isr(void *wilc);
void wilc_wlan_cleanup(void);
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
int commit, u32 drvHandler);
--
1.9.1
This patch uses netdev private data memeber wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 227dedb..8c81de9 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -405,10 +405,15 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
{
int i = 0;
int ret = -1;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (g_linux_wlan->vif[i].ndev == wilc_netdev) {
- memcpy(g_linux_wlan->vif[i].bssid, pBSSID, 6);
+ nic = netdev_priv(wilc_netdev);
+ wilc = nic->wilc;
+
+ for (i = 0; i < wilc->vif_num; i++)
+ if (wilc->vif[i].ndev == wilc_netdev) {
+ memcpy(wilc->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
--
1.9.1
This patch adds new argument struct wilc and use it instead of
g_linux_wlan. And also pass wilc to the function.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 6293410..1f5c8f3 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -374,7 +374,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
}
-struct net_device *GetIfHandler(u8 *pMacHeader)
+struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader)
{
u8 *Bssid, *Bssid1;
int i = 0;
@@ -382,20 +382,20 @@ struct net_device *GetIfHandler(u8 *pMacHeader)
Bssid = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
- for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
- return g_linux_wlan->vif[i].ndev;
+ for (i = 0; i < wilc->vif_num; i++)
+ if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+ return wilc->vif[i].ndev;
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
- for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (!memcmp(Bssid1, g_linux_wlan->vif[i].bssid, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->vif[i].bssid, ETH_ALEN))
- return g_linux_wlan->vif[i].ndev;
+ for (i = 0; i < wilc->vif_num; i++)
+ if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+ return wilc->vif[i].ndev;
PRINT_INFO(INIT_DBG, "\n");
return NULL;
@@ -1567,7 +1567,7 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
struct net_device *wilc_netdev;
perInterface_wlan_t *nic;
- wilc_netdev = GetIfHandler(buff);
+ wilc_netdev = GetIfHandler(wilc, buff);
if (wilc_netdev == NULL)
return;
--
1.9.1
This patch add new argument wilc and use it instead of g_wlan_linux.
Declare the function in wilc_wfi_netdevice.h.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 10 +++++-----
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
drivers/staging/wilc1000/wilc_wlan.c | 3 +--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index c0fac3cd..412d5a0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1611,25 +1611,25 @@ void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
}
}
-void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
{
int i = 0;
perInterface_wlan_t *nic;
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
- for (i = 0; i < g_linux_wlan->vif_num; i++) {
- nic = netdev_priv(g_linux_wlan->vif[i].ndev);
+ for (i = 0; i < wilc->vif_num; i++) {
+ nic = netdev_priv(wilc->vif[i].ndev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
- nic = netdev_priv(g_linux_wlan->vif[1].ndev); /* p2p0 */
+ nic = netdev_priv(wilc->vif[1].ndev); /* 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->vif[1].ndev, buff, size);
+ WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}
void wl_wlan_cleanup(void)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index a828fab..8ba69ee 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -216,4 +216,5 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout);
void wl_wlan_cleanup(void);
int wilc_netdev_init(struct wilc **wilc);
void wilc1000_wlan_deinit(struct net_device *dev);
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 63712a2..babd941 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -18,7 +18,6 @@
********************************************/
extern wilc_hif_func_t hif_sdio;
extern wilc_hif_func_t 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);
@@ -1178,7 +1177,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
/* reset mgmt indicator bit, to use pkt_offeset in furthur calculations */
pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES);
- WILC_WFI_mgmt_rx(&buffer[offset + HOST_HDR_OFFSET], pkt_len);
+ WILC_WFI_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len);
}
else
{
--
1.9.1
Use netdev private data member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 324cc57..7d0d722 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -248,8 +248,14 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
irqreturn_t isr_bh_routine(int irq, void *userdata)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(userdata);
+ wilc = nic->wilc;
+
/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
--
1.9.1
This patch uses netdev private data member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d839f3b..9a105ceb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1366,8 +1366,10 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
char *pu8UdpBuffer;
struct iphdr *ih;
struct ethhdr *eth_h;
+ struct wilc *wilc;
nic = netdev_priv(ndev);
+ wilc = nic->wilc;
PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
@@ -1410,14 +1412,14 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = g_linux_wlan->vif[nic->u8IfIdx].bssid;
+ tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid;
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->vif[0].ndev);
- netif_stop_queue(g_linux_wlan->vif[1].ndev);
+ netif_stop_queue(wilc->vif[0].ndev);
+ netif_stop_queue(wilc->vif[1].ndev);
}
return 0;
--
1.9.1
Pass argument dev instead of wilc from kthread_run and use netdev private data
member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 4e88cbe..5897f35 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -440,7 +440,9 @@ int linux_wlan_get_num_conn_ifcs(void)
static int linux_wlan_txq_task(void *vp)
{
int ret, txq_count;
-
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+ struct net_device *dev = vp;
#if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
#define TX_BACKOFF_WEIGHT_INCR_STEP (1)
#define TX_BACKOFF_WEIGHT_DECR_STEP (1)
@@ -450,18 +452,21 @@ static int linux_wlan_txq_task(void *vp)
int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
#endif
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
+
/* inform wilc1000_wlan_init that TXQ task is started. */
- up(&g_linux_wlan->txq_thread_started);
+ up(&wl->txq_thread_started);
while (1) {
PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
- down(&g_linux_wlan->txq_event);
+ down(&wl->txq_event);
/* wait_for_completion(&pd->txq_event); */
PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");
- if (g_linux_wlan->close) {
+ if (wl->close) {
/*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */
- up(&g_linux_wlan->txq_thread_started);
+ up(&wl->txq_thread_started);
while (!kthread_should_stop())
schedule();
@@ -478,10 +483,10 @@ static int linux_wlan_txq_task(void *vp)
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
- if (netif_queue_stopped(g_linux_wlan->vif[0].ndev))
- netif_wake_queue(g_linux_wlan->vif[0].ndev);
- if (netif_queue_stopped(g_linux_wlan->vif[1].ndev))
- netif_wake_queue(g_linux_wlan->vif[1].ndev);
+ if (netif_queue_stopped(wl->vif[0].ndev))
+ netif_wake_queue(wl->vif[0].ndev);
+ if (netif_queue_stopped(wl->vif[1].ndev))
+ netif_wake_queue(wl->vif[1].ndev);
}
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
@@ -503,7 +508,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 && !wl->close); /* retry sending packets if no more buffers in chip. */
#endif
}
return 0;
@@ -1024,7 +1029,7 @@ int wlan_initialize_threads(struct net_device *dev)
/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
- wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wilc,
+ wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
"K_TXQ_TASK");
if (!wilc->txq_thread) {
PRINT_ER("couldn't create TXQ thread\n");
--
1.9.1
This patch adds new argument struct wilc and use wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a6b966f..b109289 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -574,13 +574,14 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
return tqe;
}
-static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe)
+static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc,
+ struct txq_entry_t *tqe)
{
unsigned long flags;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
tqe = tqe->next;
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
return tqe;
@@ -887,7 +888,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
i++;
sum += vmm_sz;
PRINT_D(TX_DBG, "sum = %d\n", sum);
- tqe = wilc_wlan_txq_get_next(tqe);
+ tqe = wilc_wlan_txq_get_next(wilc, tqe);
} else {
break;
}
--
1.9.1
Add new argument net_device and use netdev private data member wilc
instead of g_linux_wlan. Pass argument dev to the function as well.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 3 +--
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++----
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
drivers/staging/wilc1000/wilc_wlan.c | 12 ++++++++----
4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1f5c8f3..d839f3b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -46,7 +46,6 @@
#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 struct timer_list hDuringIpTimer;
@@ -1244,7 +1243,7 @@ int mac_open(struct net_device *ndev)
return ret;
}
- Set_machw_change_vir_if(false);
+ Set_machw_change_vir_if(ndev, false);
host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 21d053d..bf7a2a2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -22,7 +22,6 @@
#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 mac_open(struct net_device *ndev);
extern int mac_close(struct net_device *ndev);
@@ -1413,7 +1412,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);
+ Set_machw_change_vir_if(netdev, false);
}
if (key_index >= 0 && key_index <= 3) {
@@ -2562,7 +2561,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
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);
+ Set_machw_change_vir_if(dev, true);
}
switch (type) {
@@ -2724,7 +2723,7 @@ 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);
+ Set_machw_change_vir_if(dev, false);
if (wl->initialized) {
for (i = 0; i < num_reg_frame; i++) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index bca3e25..0bfe762 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,4 +217,5 @@ void wl_wlan_cleanup(void);
int wilc_netdev_init(struct wilc **wilc);
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);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 35c4c32d..aebc9a6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -19,7 +19,6 @@
extern wilc_hif_func_t hif_sdio;
extern wilc_hif_func_t hif_spi;
u32 wilc_get_chipid(u8 update);
-u16 Set_machw_change_vir_if(bool bValue);
@@ -2033,13 +2032,18 @@ _fail_:
}
-u16 Set_machw_change_vir_if(bool bValue)
+u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue)
{
u16 ret;
u32 reg;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc->hif_cs);
ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, ®);
if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -2054,7 +2058,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(&wilc->hif_cs);
return ret;
}
--
1.9.1
Use netdev private data member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b6244f93..bd9f715 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1496,11 +1496,13 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
perInterface_wlan_t *nic;
struct wilc_priv *priv;
s32 s32Error = 0;
+ struct wilc *wilc;
/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
nic = netdev_priv(ndev);
+ wilc = nic->wilc;
- if (!g_linux_wlan->initialized)
+ if (!wilc->initialized)
return 0;
switch (cmd) {
--
1.9.1
This patch adds new argument net_device and use netdev private data member
wilc instead of g_linux_wlan. Pass argument dev to the function as well.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 14a56d6..c026657 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -341,7 +341,7 @@ static inline int remove_TCP_related(void)
return 0;
}
-static inline int tcp_process(struct txq_entry_t *tqe)
+static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
{
int ret;
u8 *eth_hdr_ptr;
@@ -350,8 +350,13 @@ static inline int tcp_process(struct txq_entry_t *tqe)
int i;
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)ð_hdr_ptr[12]));
@@ -399,7 +404,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(&wilc->txq_spinlock, flags);
return ret;
}
@@ -525,7 +530,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
#ifdef TCP_ACK_FILTER
tqe->tcp_PendingAck_index = NOT_TCP_ACK;
if (is_TCP_ACK_Filter_Enabled())
- tcp_process(tqe);
+ tcp_process(dev, tqe);
#endif
wilc_wlan_txq_add_to_tail(tqe);
/*return number of itemes in the queue*/
--
1.9.1
This patch adds argument net_device dev and use netdev private data memeber
wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.c | 11 ++++++++---
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 5897f35..d9f1bf1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -476,10 +476,10 @@ static int linux_wlan_txq_task(void *vp)
}
PRINT_D(TX_DBG, "txq_task handle the sending packet and let me go to sleep.\n");
#if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
- ret = wilc_wlan_handle_txq(&txq_count);
+ ret = wilc_wlan_handle_txq(dev, &txq_count);
#else
do {
- ret = wilc_wlan_handle_txq(&txq_count);
+ ret = wilc_wlan_handle_txq(dev, &txq_count);
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); */
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 4fa956a..907da93 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -814,7 +814,7 @@ void chip_sleep_manually(u32 u32SleepTime)
* Tx, Rx queue handle functions
*
********************************************/
-int wilc_wlan_handle_txq(u32 *pu32TxqCount)
+int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
{
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
int i, entries = 0;
@@ -828,13 +828,18 @@ int wilc_wlan_handle_txq(u32 *pu32TxqCount)
int counter;
int timeout;
u32 vmm_table[WILC_VMM_TBL_SIZE];
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
p->txq_exit = 0;
do {
if (p->quit)
break;
- linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+ linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
#ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack();
@@ -1098,7 +1103,7 @@ _end_:
if (ret != 1)
break;
} while (0);
- up(&g_linux_wlan->txq_add_to_head_cs);
+ up(&wilc->txq_add_to_head_cs);
p->txq_exit = 1;
PRINT_D(TX_DBG, "THREAD: Exiting txq\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index a07375b..79b35e6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -300,7 +300,7 @@ int wilc_wlan_start(void);
int wilc_wlan_stop(void);
int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
wilc_tx_complete_func_t func);
-int wilc_wlan_handle_txq(u32 *pu32TxqCount);
+int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
void wilc_handle_isr(void *wilc);
void wilc_wlan_cleanup(void);
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
--
1.9.1
This patch adds new argument struct wilc and use it instead of g_linux_wlan.
Pass wilc to the function as well.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 5141fe0..4fc88ef 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1107,7 +1107,7 @@ _end_:
return ret;
}
-static void wilc_wlan_handle_rxq(void)
+static void wilc_wlan_handle_rxq(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
int offset = 0, size, has_packet = 0;
@@ -1122,7 +1122,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(&wilc->cfg_event);
break;
}
rqe = wilc_wlan_rxq_remove();
@@ -1194,7 +1194,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(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
/**
* Call back to indicate status...
@@ -1350,7 +1350,7 @@ _end_:
#endif
}
}
- wilc_wlan_handle_rxq();
+ wilc_wlan_handle_rxq(wilc);
}
void wilc_handle_isr(void *wilc)
--
1.9.1
This patch changes argument wilc with net_device and use netdev private data
member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d9f1bf1..c0fac3cd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -95,7 +95,7 @@ static struct notifier_block g_dev_notifier = {
*/
static struct semaphore close_exit_sync;
-static int wlan_deinit_locks(struct wilc *nic);
+static int wlan_deinit_locks(struct net_device *dev);
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);
@@ -940,7 +940,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
- wlan_deinit_locks(wl);
+ wlan_deinit_locks(dev);
/* announce that wilc1000 is not initialized */
wl->initialized = false;
@@ -978,15 +978,21 @@ int wlan_init_locks(struct net_device *dev)
return 0;
}
-static int wlan_deinit_locks(struct wilc *nic)
+static int wlan_deinit_locks(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
PRINT_D(INIT_DBG, "De-Initializing Locks\n");
- if (&g_linux_wlan->hif_cs != NULL)
- mutex_destroy(&g_linux_wlan->hif_cs);
+ if (&wilc->hif_cs != NULL)
+ mutex_destroy(&wilc->hif_cs);
- if (&g_linux_wlan->rxq_cs != NULL)
- mutex_destroy(&g_linux_wlan->rxq_cs);
+ if (&wilc->rxq_cs != NULL)
+ mutex_destroy(&wilc->rxq_cs);
return 0;
}
@@ -1169,7 +1175,7 @@ _fail_irq_init_:
_fail_wilc_wlan_:
wilc_wlan_cleanup();
_fail_locks_:
- wlan_deinit_locks(wl);
+ wlan_deinit_locks(dev);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
--
1.9.1
This patch changes function argument with net_device and use netdev private
data member wilc instead of g_linux_wlan. And there are assignment code with
different value continuously. Take last code.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 8c81de9..4e88cbe 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1011,31 +1011,34 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
#endif
}
-int wlan_initialize_threads(perInterface_wlan_t *nic)
+int wlan_initialize_threads(struct net_device *dev)
{
-
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
int ret = 0;
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
PRINT_D(INIT_DBG, "Initializing Threads ...\n");
/* 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) {
+ wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wilc,
+ "K_TXQ_TASK");
+ if (!wilc->txq_thread) {
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(&wilc->txq_thread_started);
return 0;
_fail_2:
/*De-Initialize 2nd thread*/
- g_linux_wlan->close = 1;
-
- g_linux_wlan->close = 0;
+ wilc->close = 0;
return ret;
}
@@ -1084,7 +1087,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
#endif
- ret = wlan_initialize_threads(nic);
+ ret = wlan_initialize_threads(dev);
if (ret < 0) {
PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
--
1.9.1
This patch adds new function argument 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 bd9f715..d193af8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -927,7 +927,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wilc_wlan_stop();
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
- wilc_wlan_cleanup();
+ wilc_wlan_cleanup(dev);
#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");
@@ -1178,7 +1178,7 @@ _fail_irq_init_:
#endif
wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
- wilc_wlan_cleanup();
+ wilc_wlan_cleanup(dev);
_fail_locks_:
wlan_deinit_locks(dev);
PRINT_ER("WLAN Iinitialization FAILED\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index babd941..7473742 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1647,7 +1647,7 @@ int wilc_wlan_stop(void)
return ret;
}
-void wilc_wlan_cleanup(void)
+void wilc_wlan_cleanup(struct net_device *dev)
{
wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 79b35e6..d0b2448 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -302,7 +302,7 @@ int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
wilc_tx_complete_func_t func);
int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
void wilc_handle_isr(void *wilc);
-void wilc_wlan_cleanup(void);
+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);
--
1.9.1
This patch changes function parameter linux_wlan_t nic with net_dev dev and
use netdev private data member wilc instead of nic and g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7d0d722..ac2bc06 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -310,12 +310,18 @@ static int init_irq(struct net_device *dev)
}
#endif
-static void deinit_irq(struct wilc *nic)
+static void deinit_irq(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
#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);
+ if (&wilc->dev_irq_num != 0) {
+ free_irq(wilc->dev_irq_num, wilc);
gpio_free(GPIO_NUM);
}
@@ -907,7 +913,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wlan_deinitialize_threads(wl);
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
- deinit_irq(wl);
+ deinit_irq(dev);
wilc_wlan_stop();
@@ -1144,7 +1150,7 @@ _fail_irq_enable_:
_fail_irq_init_:
#endif
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(wl);
+ deinit_irq(dev);
#endif
wlan_deinitialize_threads(wl);
--
1.9.1
This patch adds new argument struct wilc and use it instead of g_linux_wlan.
Pass wilc to wilc_wlan_rxq_remove.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7473742..1461b61 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -612,7 +612,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
return p->rxq_entries;
}
-static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
+static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
@@ -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(&wilc->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(&wilc->rxq_cs);
return rqe;
}
PRINT_D(RX_DBG, "Nothing to get from Q\n");
@@ -1132,7 +1132,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
up(&wilc->cfg_event);
break;
}
- rqe = wilc_wlan_rxq_remove();
+ rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL) {
PRINT_D(RX_DBG, "nothing in the queue - exit 1st do-while\n");
break;
@@ -1654,6 +1654,11 @@ void wilc_wlan_cleanup(struct net_device *dev)
struct rxq_entry_t *rqe;
u32 reg = 0;
int ret;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
p->quit = 1;
do {
@@ -1666,7 +1671,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
} while (1);
do {
- rqe = wilc_wlan_rxq_remove();
+ rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL)
break;
#ifndef MEMORY_STATIC
--
1.9.1
This patch adds argument wilc and pass the function wilc. Use wilc instead of
g_linux_wlan and pd.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 13 ++++++-------
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 54e077d..227dedb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -348,24 +348,23 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout)
return error;
}
-void linux_wlan_mac_indicate(int flag)
+void linux_wlan_mac_indicate(struct wilc *wilc, 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;
int status;
if (flag == WILC_MAC_INDICATE_STATUS) {
wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
- if (pd->mac_status == WILC_MAC_STATUS_INIT) {
- pd->mac_status = status;
- up(&pd->sync_event);
+ if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+ wilc->mac_status = status;
+ up(&wilc->sync_event);
} else {
- pd->mac_status = status;
+ wilc->mac_status = status;
}
- if (pd->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */
+ if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */
}
} else if (flag == WILC_MAC_INDICATE_SCAN) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8aa3355..a828fab 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -209,7 +209,7 @@ struct WILC_WFI_mon_priv {
extern struct wilc *g_linux_wlan;
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);
+void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
void linux_wlan_rx_complete(void);
void linux_wlan_dbg(u8 *buff);
int linux_wlan_lock_timeout(void *vp, u32 timeout);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 4fc88ef..4fa956a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1199,10 +1199,10 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
/**
* Call back to indicate status...
**/
- linux_wlan_mac_indicate(WILC_MAC_INDICATE_STATUS);
+ linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
} else if (rsp.type == WILC_CFG_RSP_SCAN) {
- linux_wlan_mac_indicate(WILC_MAC_INDICATE_SCAN);
+ linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN);
}
}
}
--
1.9.1
This patch add new argument struct net_device *dev and pass net_device to
wilc_wlan_txq_add_net_pkt.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
drivers/staging/wilc1000/wilc_wlan.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9a105ceb..2a5b36f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1413,8 +1413,8 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid;
- QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
- tx_data->size,
+ QueueCount = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
+ tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index b109289..14a56d6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -502,8 +502,8 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
return 1;
}
-int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
- wilc_tx_complete_func_t func)
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
+ u32 buffer_size, wilc_tx_complete_func_t func)
{
wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index d0b2448..57e1d51 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -298,8 +298,8 @@ 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_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
- wilc_tx_complete_func_t func);
+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);
void wilc_handle_isr(void *wilc);
void wilc_wlan_cleanup(struct net_device *dev);
--
1.9.1
Hi Glen,
[auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Glen-Lee/staging-wicl1000-isr_uh_routine-use-netdev-private-wilc/20151027-173115
config: i386-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from drivers/staging/wilc1000/coreconfigurator.c:13:0:
>> drivers/staging/wilc1000/wilc_wlan.h:303:33: warning: 'struct net_device' declared inside parameter list
int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
^
>> drivers/staging/wilc1000/wilc_wlan.h:303:33: warning: its scope is only this definition or declaration, which is probably not what you want
vim +303 drivers/staging/wilc1000/wilc_wlan.h
287 } wilc_cfg_frame_t;
288
289 typedef struct {
290 int (*wlan_tx)(u8 *, u32, wilc_tx_complete_func_t);
291 } wilc_wlan_cfg_func_t;
292
293 typedef struct {
294 int type;
295 u32 seq_no;
296 } wilc_cfg_rsp_t;
297
298 int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
299 int wilc_wlan_start(void);
300 int wilc_wlan_stop(void);
301 int wilc_wlan_txq_add_net_pkt(void *priv, u8 *buffer, u32 buffer_size,
302 wilc_tx_complete_func_t func);
> 303 int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
304 void wilc_handle_isr(void *wilc);
305 void wilc_wlan_cleanup(void);
306 int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
307 int commit, u32 drvHandler);
308 int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
309 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
310 int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
311 wilc_tx_complete_func_t func);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
This patch changes function parameter type struct wilc with struct net_device
and use netdev private data member wilc instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 412d5a0..b6244f93 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -96,7 +96,7 @@ static struct notifier_block g_dev_notifier = {
static struct semaphore close_exit_sync;
static int wlan_deinit_locks(struct net_device *dev);
-static void wlan_deinitialize_threads(struct wilc *nic);
+static void wlan_deinitialize_threads(struct net_device *dev);
extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
@@ -919,7 +919,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
up(&wl->txq_event);
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
- wlan_deinitialize_threads(wl);
+ wlan_deinitialize_threads(dev);
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);
@@ -1053,18 +1053,23 @@ _fail_2:
return ret;
}
-static void wlan_deinitialize_threads(struct wilc *nic)
+static void wlan_deinitialize_threads(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
- g_linux_wlan->close = 1;
+ wl->close = 1;
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
- if (&g_linux_wlan->txq_event != NULL)
- up(&g_linux_wlan->txq_event);
+ if (&wl->txq_event != NULL)
+ up(&wl->txq_event);
- if (g_linux_wlan->txq_thread != NULL) {
- kthread_stop(g_linux_wlan->txq_thread);
- g_linux_wlan->txq_thread = NULL;
+ if (wl->txq_thread != NULL) {
+ kthread_stop(wl->txq_thread);
+ wl->txq_thread = NULL;
}
}
@@ -1171,7 +1176,7 @@ _fail_irq_init_:
deinit_irq(dev);
#endif
- wlan_deinitialize_threads(wl);
+ wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
wilc_wlan_cleanup();
_fail_locks_:
--
1.9.1
This patch add argument net_device and pass netdev private data member wilc
to kthread_run. Pass net_device to the function as well.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 11 +++++++++--
drivers/staging/wilc1000/host_interface.h | 2 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 930dcba..f658594 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -7,6 +7,7 @@
#include "wilc_wlan_if.h"
#include "wilc_msgqueue.h"
#include <linux/etherdevice.h>
+#include "wilc_wfi_netdevice.h"
extern u8 connecting;
@@ -4131,11 +4132,16 @@ void host_int_send_network_info_to_host
{
}
-s32 host_int_init(struct host_if_drv **hif_drv_handler)
+s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
s32 result = 0;
struct host_if_drv *hif_drv;
int err;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);
@@ -4181,7 +4187,8 @@ s32 host_int_init(struct host_if_drv **hif_drv_handler)
goto _fail_;
}
- hif_thread_handler = kthread_run(hostIFthread, NULL, "WILC_kthread");
+ hif_thread_handler = kthread_run(hostIFthread, wilc,
+ "WILC_kthread");
if (IS_ERR(hif_thread_handler)) {
PRINT_ER("Failed to creat Thread\n");
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index f3fb628..0fd2eda 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -911,7 +911,7 @@ void host_int_send_network_info_to_host
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_init(struct host_if_drv **phWFIDrv);
+s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
/**
* @brief host interface initialization function
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ac32d2b..21d053d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3464,7 +3464,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 = host_int_init(net, &priv->hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
--
1.9.1
This patch adds new argument struct wilc and use it instead of g_linux_wlan.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index aebc9a6..a6b966f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -586,14 +586,14 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe)
return tqe;
}
-static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
+static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
{
wilc_wlan_dev_t *p = &g_wlan;
if (p->quit)
return 0;
- mutex_lock(&g_linux_wlan->rxq_cs);
+ mutex_lock(&wilc->rxq_cs);
if (p->rxq_head == NULL) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
@@ -607,7 +607,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(&wilc->rxq_cs);
return p->rxq_entries;
}
@@ -1349,7 +1349,7 @@ _end_:
rqe->buffer = buffer;
rqe->buffer_size = size;
PRINT_D(RX_DBG, "rxq entery Size= %d - Address = %p\n", rqe->buffer_size, rqe->buffer);
- wilc_wlan_rxq_add(rqe);
+ wilc_wlan_rxq_add(wilc, rqe);
}
} else {
#ifndef MEMORY_STATIC
--
1.9.1
This patch adds new argument struct wilc and use it instead of
g_linux_wlan. Pass argument wilc to the function as well.
Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 6 +++---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
drivers/staging/wilc1000/wilc_wlan.c | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d193af8..6293410 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1557,7 +1557,7 @@ done:
return s32Error;
}
-void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset)
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
{
unsigned int frame_len = 0;
@@ -1586,8 +1586,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 (wilc == NULL || wilc_netdev == NULL)
+ PRINT_ER("wilc_netdev in wilc is NULL");
skb->dev = wilc_netdev;
if (skb->dev == NULL)
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8ba69ee..bca3e25 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -208,7 +208,7 @@ struct WILC_WFI_mon_priv {
extern struct wilc *g_linux_wlan;
extern struct net_device *WILC_WFI_devs[];
-void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
void linux_wlan_rx_complete(void);
void linux_wlan_dbg(u8 *buff);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 1461b61..35c4c32d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1184,7 +1184,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
if (!is_cfg_packet) {
if (pkt_len > 0) {
- frmw_to_linux(&buffer[offset],
+ frmw_to_linux(wilc,
+ &buffer[offset],
pkt_len,
pkt_offset);
has_packet = 1;
--
1.9.1