2015-10-23 05:25:57

by Glen Lee

[permalink] [raw]
Subject: [PATCH 01/28] staging: wilc1000: isr_bh_routine: remove unused variable nic

This patch removes unused variable nic.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ce2bd53..b036b96 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -242,10 +242,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)

irqreturn_t isr_bh_routine(int irq, void *userdata)
{
- struct wilc *nic;
-
- nic = (struct wilc *)userdata;
-
/*While mac is closing cacncel the handling of any interrupts received*/
if (g_linux_wlan->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
--
1.9.1



2015-10-25 08:26:28

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc

On Fri, Oct 23, 2015 at 02:28:18PM +0900, Glen Lee wrote:
> 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 | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index b036b96..7b0614d 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -229,10 +229,15 @@ 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 *wl;
> +
> + nic = netdev_priv(usedata);

This patch breaks the build, which means you didn't even test build the
series :(

Please redo this whole series and test your patches better.

greg k-h

2015-10-23 05:26:10

by Glen Lee

[permalink] [raw]
Subject: [PATCH 03/28] staging: wilc1000: isr_bh_routine: use wilc instead of g_linux_wlan

Use netdev private 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 7b0614d..e31760e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -247,8 +247,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 *wl;
+
+ nic = netdev_priv(userdata);
+ wl = nic->wilc;
+
/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wl->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
--
1.9.1


2015-10-23 05:26:36

by Glen Lee

[permalink] [raw]
Subject: [PATCH 07/28] staging: wilc1000: wilc_wlan_handle_rxq: add new argument and use wilc

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


2015-10-23 05:28:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH 26/28] staging: wilc1000: mac_xmit: use netdev private wilc instead of g_linux_wlan

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 a2d8053..7a2599a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1359,8 +1359,10 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
char *pu8UdpBuffer;
struct iphdr *ih;
struct ethhdr *eth_h;
+ struct wilc *wl;

nic = netdev_priv(ndev);
+ wl = nic->wilc;

PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");

@@ -1403,14 +1405,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 = wl->vif[nic->u8IfIdx].bssid;
QueueCount = wilc_wlan_txq_add_net_pkt((void *)tx_data, tx_data->buff,
tx_data->size,
linux_wlan_tx_complete);

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(wl->vif[0].ndev);
+ netif_stop_queue(wl->vif[1].ndev);
}

return 0;
--
1.9.1


2015-10-23 05:28:05

by Glen Lee

[permalink] [raw]
Subject: [PATCH 22/28] staging: wilc1000: GetIfHandler: add argument struct wilc and use it

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 fb12835c..9d03235 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -373,7 +373,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;
@@ -381,20 +381,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;
@@ -1560,7 +1560,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


2015-10-23 05:27:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH 15/28] staging: wilc1000: wlan_deinit_locks: rename argument name and use it

This patch renames nic to wilc and use it instead of g_linux_wlan.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 4f9663d..2f1543d 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 wilc *wilc);
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);
@@ -977,14 +977,14 @@ int wlan_init_locks(struct net_device *dev)
return 0;
}

-static int wlan_deinit_locks(struct wilc *nic)
+static int wlan_deinit_locks(struct wilc *wilc)
{
PRINT_D(INIT_DBG, "De-Initializing Locks\n");

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

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

return 0;
--
1.9.1


2015-10-23 05:27:47

by Glen Lee

[permalink] [raw]
Subject: [PATCH 19/28] staging: wilc1000: wilc_wlan_cleanup: add parameter net_device *dev

This patch adds new function parameter net_device *dev 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 05cb442..a73fe19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -926,7 +926,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");
@@ -1171,7 +1171,7 @@ _fail_irq_init_:
#endif
wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
- wilc_wlan_cleanup();
+ wilc_wlan_cleanup(dev);
_fail_locks_:
wlan_deinit_locks(wl);
PRINT_ER("WLAN Iinitialization FAILED\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 531d342..43df5f1 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


2015-10-23 05:27:00

by Glen Lee

[permalink] [raw]
Subject: [PATCH 11/28] staging: wilc1000: linux_wlan_txq_task: use wilc instead of g_linux_wlan

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 f6862d5..9c4fecb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -439,7 +439,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)
@@ -449,18 +451,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();
@@ -477,10 +482,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. */
@@ -502,7 +507,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;
@@ -1023,7 +1028,7 @@ int wlan_initialize_threads(struct net_device *dev)

/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
- wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wl,
+ wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
"K_TXQ_TASK");
if (!wl->txq_thread) {
PRINT_ER("couldn't create TXQ thread\n");
--
1.9.1


2015-10-23 05:26:30

by Glen Lee

[permalink] [raw]
Subject: [PATCH 06/28] staging: wilc1000: wilc_wlan_handle_isr_ext: add argument struct wilc

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


2015-10-23 05:27:53

by Glen Lee

[permalink] [raw]
Subject: [PATCH 20/28] staging: wilc1000: wilc_wlan_rxq_remove: add argument wilc and use it

This patch adds new argument struct wilc and use it instead of
g_linux_wlan. Pass struct 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 43df5f1..44f2e60 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 *wl;
+
+ nic = netdev_priv(dev);
+ wl = 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(wl);
if (rqe == NULL)
break;
#ifndef MEMORY_STATIC
--
1.9.1


2015-10-23 05:27:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH 16/28] staging: wilc1000: WILC_WFI_mgmt_rx: add argument wilc and use it

This patch add new argument wilc and use wilc 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 2f1543d..fef6664 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1604,25 +1604,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 ae4b01f..531d342 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


2015-10-23 05:27:11

by Glen Lee

[permalink] [raw]
Subject: [PATCH 13/28] staging: wilc1000: wilc_wlan_txq_filter_dup_tcp_ack: add argument and use wilc

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 f694f2e..ae4b01f 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 *wl;
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);
+ wl = nic->wilc;
+
+ spin_lock_irqsave(&wl->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(&wl->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(&wl->txq_event, 1);
Dropped--;
}

@@ -842,7 +845,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
linux_wlan_lock_timeout(&wl->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


2015-10-23 05:27:41

by Glen Lee

[permalink] [raw]
Subject: [PATCH 18/28] staging: wilc1000: mac_ioctl: use private data instead of g_linux_wlan

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 75dad3e..05cb442 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1489,11 +1489,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 *wl;

/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
nic = netdev_priv(ndev);
+ wl = nic->wilc;

- if (!g_linux_wlan->initialized)
+ if (!wl->initialized)
return 0;

switch (cmd) {
--
1.9.1


2015-10-23 05:28:40

by Glen Lee

[permalink] [raw]
Subject: [PATCH 28/28] staging: wilc1000: tcp_process: add argument dev and get private from it

This patch adds new argument net_device *dev 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 6c4fef2..68a2fd4 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 *wl;

- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
+
+ spin_lock_irqsave(&wl->txq_spinlock, flags);

eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)&eth_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(&wl->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


2015-10-26 02:05:51

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc



On 2015년 10월 25일 10:29, Greg KH wrote:
> On Fri, Oct 23, 2015 at 02:28:18PM +0900, Glen Lee wrote:
>> 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 | 9 +++++++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
>> index b036b96..7b0614d 100644
>> --- a/drivers/staging/wilc1000/linux_wlan.c
>> +++ b/drivers/staging/wilc1000/linux_wlan.c
>> @@ -229,10 +229,15 @@ 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 *wl;
>> +
>> + nic = netdev_priv(usedata);
> This patch breaks the build, which means you didn't even test build the
> series :(

Hi greg,

I built every patches I'v posted and also there is no build error for this patch.
Would you please reconsider this patch again?

> Please redo this whole series and test your patches better.
>
> greg k-h


2015-10-23 05:27:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH 21/28] staging: wilc1000: frmw_to_linux: add argument struct wilc

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 a73fe19..fb12835c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1550,7 +1550,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;
@@ -1579,8 +1579,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 44f2e60..e197c88 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


2015-10-23 07:53:08

by Dan Carpenter

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

On Fri, Oct 23, 2015 at 04:36:07PM +0900, Tony Cho wrote:
> In addition, the function parameter names will be wilc
> for the variable of struct wilc.
>
> The "wl" is local variable naming as well.

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

regards,
dan carpenter


2015-10-23 07:36:25

by Tony Cho

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



On 2015년 10월 23일 15:57, Dan Carpenter wrote:
> On Fri, Oct 23, 2015 at 02:28:21PM +0900, Glen Lee wrote:
>> This patch add new argument wilc to wilc_handle_isr and pass wilc to
>> the function.
> It's not important enough to redo the patch but why are we sometimes
> using "wl" and sometimes "wilc"?

We have wl_xxx_xxx as naming conventions for the function prefix to represent that
they are owned in the wireless link controller because the driver will support
other line-ups as well as wilc1000, so we will remove wilc1000 prefix and
are changing them. In addition, the function parameter names will be wilc
for the variable of struct wilc.

The "wl" is local variable naming as well.
Do you point out "struct wilc *wilc" in the structure wilc_sdio?

Thanks for your review always.
Tony.

> regards,
> dan carpenter
>


2015-10-23 05:26:24

by Glen Lee

[permalink] [raw]
Subject: [PATCH 05/28] staging: wilc1000: wilc_handle_isr: add argument wilc to wilc_handle_isr

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 struct wilc header file 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 75cbacf..3f5ae55 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -260,7 +260,7 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
}

PRINT_D(INT_DBG, "Interrupt received BH\n");
- wilc_handle_isr();
+ wilc_handle_isr(wl);

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


2015-10-23 05:28:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH 25/28] staging: wilc1000: wilc_wlan_txq_get_next: add argument wilc

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 5393b6f..e4e9c72 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(wl, tqe);
} else {
break;
}
--
1.9.1


2015-10-23 06:57:20

by Dan Carpenter

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

On Fri, Oct 23, 2015 at 02:28:21PM +0900, Glen Lee wrote:
> This patch add new argument wilc to wilc_handle_isr and pass wilc to
> the function.

It's not important enough to redo the patch but why are we sometimes
using "wl" and sometimes "wilc"?

regards,
dan carpenter


2015-10-23 05:28:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 24/28] staging: wilc1000: wilc_wlan_rxq_add: add argument wilc and use it

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 8cc533a..5393b6f 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


2015-10-23 05:26:54

by Glen Lee

[permalink] [raw]
Subject: [PATCH 10/28] staging: wilc1000: wlan_initialize_threads: change argument with net_device

This patch changes function argument with net_device dev 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 b8fd4ae..f6862d5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1010,31 +1010,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 *wl;
int ret = 0;

+ nic = netdev_priv(dev);
+ wl = 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) {
+ wl->txq_thread = kthread_run(linux_wlan_txq_task, (void *)wl,
+ "K_TXQ_TASK");
+ if (!wl->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(&wl->txq_thread_started);

return 0;

_fail_2:
/*De-Initialize 2nd thread*/
- g_linux_wlan->close = 1;
-
- g_linux_wlan->close = 0;
+ wl->close = 0;
return ret;
}

@@ -1083,7 +1086,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


2015-10-26 08:23:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc

On Mon, Oct 26, 2015 at 11:08:43AM +0900, glen lee wrote:
>
>
> On 2015년 10월 25일 10:29, Greg KH wrote:
> >On Fri, Oct 23, 2015 at 02:28:18PM +0900, Glen Lee wrote:
> >>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 | 9 +++++++--
> >> 1 file changed, 7 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> >>index b036b96..7b0614d 100644
> >>--- a/drivers/staging/wilc1000/linux_wlan.c
> >>+++ b/drivers/staging/wilc1000/linux_wlan.c
> >>@@ -229,10 +229,15 @@ 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 *wl;
> >>+
> >>+ nic = netdev_priv(usedata);
> >This patch breaks the build, which means you didn't even test build the
> >series :(
>
> Hi greg,
>
> I built every patches I'v posted and also there is no build error for this patch.

I don't believe you, just look at the lines, it's obviously incorrect.

> Would you please reconsider this patch again?

Why would I ever accept a patch that is obviously wrong? I would be a
horrible subsystem maintainer, and you would not want me to merge an
obviously broken patch from someone else into this driver, breaking it,
right?

I have no idea why you would expect me to ever accept this patch as-is.

greg k-h

2015-10-23 05:27:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 14/28] staging: wilc1000: host_int_init: add argument net_device

This patch add argument net_device *dev and pass it to kthread_run.

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

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 646e7e9..2fc0ce8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4127,7 +4127,7 @@ 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;
@@ -4177,7 +4177,7 @@ 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, dev, "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 146a60f..f1de52e 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 5559aa6..7b21bea 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


2015-10-23 08:13:24

by Tony Cho

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



On 2015년 10월 23일 16:52, Dan Carpenter wrote:
> On Fri, Oct 23, 2015 at 04:36:07PM +0900, Tony Cho wrote:
>> In addition, the function parameter names will be wilc
>> for the variable of struct wilc.
>>
>> The "wl" is local variable naming as well.
> So if it is a parameter it is wilc but if it is a local variable then it
> is wl? That seems like an arbitrary meaningless distinction. It just
> makes searching harder and complicates things for no reason.

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

reconsider your concerns to apply your opinion to coming patches.

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

Thanks,

Tony.

>
> regards,
> dan carpenter
>


2015-10-23 05:28:35

by Glen Lee

[permalink] [raw]
Subject: [PATCH 27/28] staging: wilc1000: wilc_wlan_txq_add_net_pkt: add argument struct net_device

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 7a2599a..0dce242 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1406,8 +1406,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 = wl->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 e4e9c72..6c4fef2 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


2015-10-23 05:27:06

by Glen Lee

[permalink] [raw]
Subject: [PATCH 12/28] staging: wilc1000: wilc_wlan_handle_txq: add argument and use wilc

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 9c4fecb..4f9663d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -475,10 +475,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..f694f2e 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 *wl;
+
+ nic = netdev_priv(dev);
+ wl = 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(&wl->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(&wl->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


2015-10-23 05:27:35

by Glen Lee

[permalink] [raw]
Subject: [PATCH 17/28] staging: wilc1000: wlan_deinitialize_threads: change argument and use wilc

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 fef6664..75dad3e 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 wilc *wilc);
-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);

@@ -918,7 +918,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);
@@ -1046,18 +1046,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;
}
}

@@ -1164,7 +1169,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


2015-10-23 05:28:11

by Glen Lee

[permalink] [raw]
Subject: [PATCH 23/28] staging: wilc1000: Set_machw_change_vir_if: add argument dev

Add new argument net_device *dev 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 9d03235..a2d8053 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;
@@ -1237,7 +1236,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 7b21bea..624ad15 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 e197c88..8cc533a 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 *wl;
+
+ nic = netdev_priv(dev);
+ wl = 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(&wl->hif_cs);
ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, &reg);
if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -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(&wl->hif_cs);

return ret;
}
--
1.9.1


2015-10-26 09:13:03

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc



On 2015년 10월 26일 17:23, Greg KH wrote:
> On Mon, Oct 26, 2015 at 11:08:43AM +0900, glen lee wrote:
>>
>> On 2015년 10월 25일 10:29, Greg KH wrote:
>>> On Fri, Oct 23, 2015 at 02:28:18PM +0900, Glen Lee wrote:
>>>> 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 | 9 +++++++--
>>>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
>>>> index b036b96..7b0614d 100644
>>>> --- a/drivers/staging/wilc1000/linux_wlan.c
>>>> +++ b/drivers/staging/wilc1000/linux_wlan.c
>>>> @@ -229,10 +229,15 @@ 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 *wl;
>>>> +
>>>> + nic = netdev_priv(usedata);
>>> This patch breaks the build, which means you didn't even test build the
>>> series :(
>> Hi greg,
>>
>> I built every patches I'v posted and also there is no build error for this patch.
> I don't believe you, just look at the lines, it's obviously incorrect.
>
>> Would you please reconsider this patch again?
> Why would I ever accept a patch that is obviously wrong? I would be a
> horrible subsystem maintainer, and you would not want me to merge an
> obviously broken patch from someone else into this driver, breaking it,
> right?

True. Sorry for wasting your time. I didn't look at the code carefully but just built on SDIO not SPI as usual.
I should have been more careful about this.
Again, sorry for the noise. I'll do this patches again.

>
> I have no idea why you would expect me to ever accept this patch as-is.
>
> greg k-h


2015-10-23 05:26:41

by Glen Lee

[permalink] [raw]
Subject: [PATCH 08/28] staging: wilc1000: linux_wlan_mac_indicate: add argument and use wilc

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 3f5ae55..af7e844 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -347,24 +347,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


2015-10-23 05:26:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH 04/28] staging: wilc1000: deinit_irq: use wilc instead of g_linux_wlan

This patch changes function parameter linux_wlan_t nic with net_dev dev and
use 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 e31760e..75cbacf 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -309,12 +309,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 *wl;
+
+ nic = netdev_priv(dev);
+ wl = 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 (&wl->dev_irq_num != 0) {
+ free_irq(wl->dev_irq_num, wl);

gpio_free(GPIO_NUM);
}
@@ -906,7 +912,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();

@@ -1143,7 +1149,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


2015-10-23 05:26:04

by Glen Lee

[permalink] [raw]
Subject: [PATCH 02/28] staging: wicl1000: isr_uh_routine: use netdev private wilc

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 | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b036b96..7b0614d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -229,10 +229,15 @@ 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 *wl;
+
+ nic = netdev_priv(usedata);
+ wl = 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 (wl->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
@@ -284,7 +289,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


2015-10-23 05:26:47

by Glen Lee

[permalink] [raw]
Subject: [PATCH 09/28] staging: wilc1000: linux_wlan_set_bssid: use wilc instead of g_linux_wlan

This patch use 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 af7e844..b8fd4ae 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -404,10 +404,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 *wl;

- 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);
+ wl = nic->wilc;
+
+ for (i = 0; i < wl->vif_num; i++)
+ if (wl->vif[i].ndev == wilc_netdev) {
+ memcpy(wl->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
--
1.9.1