All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] staging: wilc1000: remove unused variable
@ 2015-11-20  7:56 Glen Lee
  2015-11-20  7:56 ` [PATCH 2/6] staging: wilc1000: return linux error value Glen Lee
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

wilc_sdio_func is not used anymore so just delete it.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 3 ---
 1 file changed, 3 deletions(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] staging: wilc1000: return linux error value
  2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
@ 2015-11-20  7:56 ` Glen Lee
  2015-11-20  7:56 ` [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t Glen Lee
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Return proper linux error value -ETIMEDOUT instead of -1.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/coreconfigurator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t
  2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
  2015-11-20  7:56 ` [PATCH 2/6] staging: wilc1000: return linux error value Glen Lee
@ 2015-11-20  7:56 ` Glen Lee
  2015-12-18 22:37   ` Greg KH
  2015-11-20  7:56 ` [PATCH 4/6] staging: wilc1000: remove io_type " Glen Lee
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

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

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 73954f4..7ccc9b0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -749,9 +749,9 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 
 		PRINT_D(INIT_DBG, "Disabling IRQ\n");
 		if (!wl->dev_irq_num &&
-		    wl->ops->disable_interrupt) {
+		    wl->hif_func->disable_interrupt) {
 			mutex_lock(&wl->hif_cs);
-			wl->ops->disable_interrupt(wl);
+			wl->hif_func->disable_interrupt(wl);
 			mutex_unlock(&wl->hif_cs);
 		}
 		if (&wl->txq_event)
@@ -769,12 +769,12 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 		wilc_wlan_cleanup(dev);
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
 		if (!wl->dev_irq_num &&
-		    wl->ops->disable_interrupt) {
+		    wl->hif_func->disable_interrupt) {
 
 			PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
 			mutex_lock(&wl->hif_cs);
-			wl->ops->disable_interrupt(wl);
+			wl->hif_func->disable_interrupt(wl);
 			mutex_unlock(&wl->hif_cs);
 		}
 #endif
@@ -910,8 +910,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 		}
 
 		if (!wl->dev_irq_num &&
-		    wl->ops->enable_interrupt &&
-		    wl->ops->enable_interrupt(wl)) {
+		    wl->hif_func->enable_interrupt &&
+		    wl->hif_func->enable_interrupt(wl)) {
 			PRINT_ER("couldn't initialize IRQ\n");
 			ret = -EIO;
 			goto _fail_irq_init_;
@@ -963,8 +963,8 @@ _fail_fw_start_:
 
 _fail_irq_enable_:
 		if (!wl->dev_irq_num &&
-		    wl->ops->disable_interrupt)
-			wl->ops->disable_interrupt(wl);
+		    wl->hif_func->disable_interrupt)
+			wl->hif_func->disable_interrupt(wl);
 _fail_irq_init_:
 		if (wl->dev_irq_num)
 			deinit_irq(dev);
@@ -1437,7 +1437,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 	*wilc = wl;
 	wl->io_type = io_type;
 	wl->gpio = gpio;
-	wl->ops = ops;
+	wl->hif_func = ops;
 
 	register_inetaddr_notifier(&g_dev_notifier);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 212d607..b593b64 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,7 +156,7 @@ struct wilc_vif {
 };
 
 struct wilc {
-	const struct wilc_hif_func *ops;
+	const struct wilc_hif_func *hif_func;
 	int io_type;
 	int mac_status;
 	int gpio;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index a74a95e..b9bedc8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -6,7 +6,6 @@
 typedef struct {
 	int quit;
 	int io_type;
-	struct wilc_hif_func hif_func;
 	int cfg_frame_in_use;
 	struct wilc_cfg_frame cfg_frame;
 	u32 cfg_frame_offset;
@@ -564,9 +563,9 @@ static inline void chip_allow_sleep(struct wilc *wilc)
 {
 	u32 reg = 0;
 
-	g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg);
+	wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
 
-	g_wlan.hif_func.hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
+	wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
 }
 
 static inline void chip_wakeup(struct wilc *wilc)
@@ -576,9 +575,9 @@ static inline void chip_wakeup(struct wilc *wilc)
 
 	if ((g_wlan.io_type & 0x1) == HIF_SPI) {
 		do {
-			g_wlan.hif_func.hif_read_reg(wilc, 1, &reg);
-			g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1));
-			g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1));
+			wilc->hif_func->hif_read_reg(wilc, 1, &reg);
+			wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
+			wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
 
 			do {
 				usleep_range(2 * 1000, 2 * 1000);
@@ -589,44 +588,44 @@ static inline void chip_wakeup(struct wilc *wilc)
 
 		} while (wilc_get_chipid(wilc, true) == 0);
 	} else if ((g_wlan.io_type & 0x1) == HIF_SDIO)	 {
-		g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg);
+		wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
 		do {
-			g_wlan.hif_func.hif_write_reg(wilc, 0xf0,
+			wilc->hif_func->hif_write_reg(wilc, 0xf0,
 						      reg | BIT(0));
-			g_wlan.hif_func.hif_read_reg(wilc, 0xf1,
+			wilc->hif_func->hif_read_reg(wilc, 0xf1,
 						     &clk_status_reg);
 
 			while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) {
 				usleep_range(2 * 1000, 2 * 1000);
 
-				g_wlan.hif_func.hif_read_reg(wilc, 0xf1,
+				wilc->hif_func->hif_read_reg(wilc, 0xf1,
 							     &clk_status_reg);
 
 				if ((clk_status_reg & 0x1) == 0)
 					wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n");
 			}
 			if ((clk_status_reg & 0x1) == 0) {
-				g_wlan.hif_func.hif_write_reg(wilc, 0xf0,
+				wilc->hif_func->hif_write_reg(wilc, 0xf0,
 							      reg & (~BIT(0)));
 			}
 		} while ((clk_status_reg & 0x1) == 0);
 	}
 
 	if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
-		g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, &reg);
+		wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
 		reg &= ~BIT(0);
-		g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg);
+		wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
 
 		if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
 			u32 val32;
 
-			g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32);
+			wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
 			val32 |= BIT(6);
-			g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32);
+			wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
 
-			g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32);
+			wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
 			val32 |= BIT(6);
-			g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32);
+			wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
 		}
 	}
 	chip_ps_state = CHIP_WAKEDUP;
@@ -638,17 +637,17 @@ static inline void chip_wakeup(struct wilc *wilc)
 
 	do {
 		if ((g_wlan.io_type & 0x1) == HIF_SPI) {
-			g_wlan.hif_func.hif_read_reg(wilc, 1, &reg);
-			g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1));
-			g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1));
-			g_wlan.hif_func.hif_write_reg(wilc, 1, reg  & ~BIT(1));
+			wilc->hif_func->hif_read_reg(wilc, 1, &reg);
+			wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
+			wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
+			wilc->hif_func->hif_write_reg(wilc, 1, reg  & ~BIT(1));
 		} else if ((g_wlan.io_type & 0x1) == HIF_SDIO)	 {
-			g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg);
-			g_wlan.hif_func.hif_write_reg(wilc, 0xf0,
+			wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
+			wilc->hif_func->hif_write_reg(wilc, 0xf0,
 						      reg & ~BIT(0));
-			g_wlan.hif_func.hif_write_reg(wilc, 0xf0,
+			wilc->hif_func->hif_write_reg(wilc, 0xf0,
 						      reg | BIT(0));
-			g_wlan.hif_func.hif_write_reg(wilc, 0xf0,
+			wilc->hif_func->hif_write_reg(wilc, 0xf0,
 						      reg  & ~BIT(0));
 		}
 
@@ -663,20 +662,20 @@ static inline void chip_wakeup(struct wilc *wilc)
 	} while (wilc_get_chipid(wilc, true) == 0);
 
 	if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
-		g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, &reg);
+		wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
 		reg &= ~BIT(0);
-		g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg);
+		wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
 
 		if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
 			u32 val32;
 
-			g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32);
+			wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
 			val32 |= BIT(6);
-			g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32);
+			wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
 
-			g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32);
+			wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
 			val32 |= BIT(6);
-			g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32);
+			wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
 		}
 	}
 	chip_ps_state = CHIP_WAKEDUP;
@@ -691,7 +690,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
 #ifdef WILC_OPTIMIZE_SLEEP_INT
 	chip_allow_sleep(wilc);
 #endif
-	g_wlan.hif_func.hif_write_reg(wilc, 0x10a8, 1);
+	wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1);
 
 	chip_ps_state = CHIP_SLEEPING_MANUAL;
 	release_bus(wilc, RELEASE_ONLY);
@@ -780,7 +779,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 		acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 		counter = 0;
 		do {
-			ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL,
+			ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL,
 						       &reg);
 			if (!ret) {
 				wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n");
@@ -795,7 +794,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 				if (counter > 200) {
 					counter = 0;
 					PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n");
-					ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
+					ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
 					break;
 				}
 				PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
@@ -810,13 +809,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 
 		timeout = 200;
 		do {
-			ret = p->hif_func.hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4));
+			ret = wilc->hif_func->hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4));
 			if (!ret) {
 				wilc_debug(N_ERR, "ERR block TX of VMM table.\n");
 				break;
 			}
 
-			ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL,
+			ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL,
 							0x2);
 			if (!ret) {
 				wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n");
@@ -824,7 +823,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 			}
 
 			do {
-				ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
+				ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
 				if (!ret) {
 					wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n");
 					break;
@@ -840,7 +839,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 				}
 			} while (--timeout);
 			if (timeout <= 0) {
-				ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
+				ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
 				break;
 			}
 
@@ -850,13 +849,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 			if (entries == 0) {
 				PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]);
 
-				ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
+				ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
 				if (!ret) {
 					wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n");
 					break;
 				}
 				reg &= ~BIT(0);
-				ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
+				ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
 				if (!ret) {
 					wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n");
 					break;
@@ -928,13 +927,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 
 		acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
-		ret = p->hif_func.hif_clear_int_ext(wilc, ENABLE_TX_VMM);
+		ret = wilc->hif_func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n");
 			goto _end_;
 		}
 
-		ret = p->hif_func.hif_block_tx_ext(wilc, 0, txb, offset);
+		ret = wilc->hif_func->hif_block_tx_ext(wilc, 0, txb, offset);
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n");
 			goto _end_;
@@ -1053,14 +1052,14 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
 static void wilc_unknown_isr_ext(struct wilc *wilc)
 {
-	g_wlan.hif_func.hif_clear_int_ext(wilc, 0);
+	wilc->hif_func->hif_clear_int_ext(wilc, 0);
 }
 
 static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
 {
 	int trials = 10;
 
-	g_wlan.hif_func.hif_clear_int_ext(wilc, PLL_INT_CLR);
+	wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR);
 
 	if (g_wlan.io_type == HIF_SDIO)
 		mdelay(WILC_PLL_TO_SDIO);
@@ -1075,7 +1074,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
 
 static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1)
 {
-	g_wlan.hif_func.hif_clear_int_ext(wilc, SLEEP_INT_CLR);
+	wilc->hif_func->hif_clear_int_ext(wilc, SLEEP_INT_CLR);
 #ifndef WILC_OPTIMIZE_SLEEP_INT
 	chip_ps_state = CHIP_SLEEPING_AUTO;
 #endif
@@ -1097,7 +1096,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 		u32 time = 0;
 
 		wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++);
-		p->hif_func.hif_read_size(wilc, &size);
+		wilc->hif_func->hif_read_size(wilc, &size);
 		size = ((size & 0x7fff) << 2);
 		retries++;
 	}
@@ -1113,9 +1112,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 			goto _end_;
 		}
 
-		p->hif_func.hif_clear_int_ext(wilc,
+		wilc->hif_func->hif_clear_int_ext(wilc,
 					      DATA_INT_CLR | ENABLE_RX_VMM);
-		ret = p->hif_func.hif_block_rx_ext(wilc, 0, buffer, size);
+		ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
 
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n");
@@ -1142,7 +1141,7 @@ void wilc_handle_isr(struct wilc *wilc)
 	u32 int_status;
 
 	acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
-	g_wlan.hif_func.hif_read_int(wilc, &int_status);
+	wilc->hif_func->hif_read_int(wilc, &int_status);
 
 	if (int_status & PLL_INT_EXT)
 		wilc_pllupdate_isr_ext(wilc, int_status);
@@ -1165,7 +1164,6 @@ EXPORT_SYMBOL_GPL(wilc_handle_isr);
 
 int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	u32 offset;
 	u32 addr, size, size2, blksz;
 	u8 *dma_buffer;
@@ -1197,7 +1195,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_
 				size2 = blksz;
 
 			memcpy(dma_buffer, &buffer[offset], size2);
-			ret = p->hif_func.hif_block_tx(wilc, addr, dma_buffer,
+			ret = wilc->hif_func->hif_block_tx(wilc, addr, dma_buffer,
 						       size2);
 			if (!ret)
 				break;
@@ -1239,7 +1237,7 @@ int wilc_wlan_start(struct wilc *wilc)
 		reg = 1;
 	}
 	acquire_bus(wilc, ACQUIRE_ONLY);
-	ret = p->hif_func.hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg);
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg);
 	if (!ret) {
 		wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
 		release_bus(wilc, RELEASE_ONLY);
@@ -1273,7 +1271,7 @@ int wilc_wlan_start(struct wilc *wilc)
 	reg |= WILC_HAVE_DISABLE_WILC_UART;
 #endif
 
-	ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_1, reg);
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg);
 	if (!ret) {
 		wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n");
 		release_bus(wilc, RELEASE_ONLY);
@@ -1281,9 +1279,9 @@ int wilc_wlan_start(struct wilc *wilc)
 		return ret;
 	}
 
-	p->hif_func.hif_sync_ext(wilc, NUM_INT_EXT);
+	wilc->hif_func->hif_sync_ext(wilc, NUM_INT_EXT);
 
-	ret = p->hif_func.hif_read_reg(wilc, 0x1000, &chipid);
+	ret = wilc->hif_func->hif_read_reg(wilc, 0x1000, &chipid);
 	if (!ret) {
 		wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
 		release_bus(wilc, RELEASE_ONLY);
@@ -1291,16 +1289,16 @@ int wilc_wlan_start(struct wilc *wilc)
 		return ret;
 	}
 
-	p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+	wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
 	if ((reg & BIT(10)) == BIT(10)) {
 		reg &= ~BIT(10);
-		p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
-		p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+		wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
+		wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
 	}
 
 	reg |= BIT(10);
-	ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
-	p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
+	wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
 	release_bus(wilc, RELEASE_ONLY);
 
 	return (ret < 0) ? ret : 0;
@@ -1308,22 +1306,18 @@ int wilc_wlan_start(struct wilc *wilc)
 
 void wilc_wlan_global_reset(struct wilc *wilc)
 {
-
-	wilc_wlan_dev_t *p = &g_wlan;
-
 	acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
-	p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0);
+	wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0);
 	release_bus(wilc, RELEASE_ONLY);
 }
 int wilc_wlan_stop(struct wilc *wilc)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	u32 reg = 0;
 	int ret;
 	u8 timeout = 10;
 	acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
-	ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+	ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
 	if (!ret) {
 		PRINT_ER("Error while reading reg\n");
 		release_bus(wilc, RELEASE_ALLOW_SLEEP);
@@ -1331,7 +1325,7 @@ int wilc_wlan_stop(struct wilc *wilc)
 	}
 
 	reg &= ~BIT(10);
-	ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
 	if (!ret) {
 		PRINT_ER("Error while writing reg\n");
 		release_bus(wilc, RELEASE_ALLOW_SLEEP);
@@ -1339,7 +1333,7 @@ int wilc_wlan_stop(struct wilc *wilc)
 	}
 
 	do {
-		ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
+		ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
 		if (!ret) {
 			PRINT_ER("Error while reading reg\n");
 			release_bus(wilc, RELEASE_ALLOW_SLEEP);
@@ -1352,13 +1346,13 @@ int wilc_wlan_stop(struct wilc *wilc)
 			PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n",
 				timeout);
 			reg &= ~BIT(10);
-			ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0,
+			ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0,
 							reg);
 			timeout--;
 		} else {
 			PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n",
 				timeout);
-			ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0,
+			ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0,
 						       &reg);
 			if (!ret) {
 				PRINT_ER("Error while reading reg\n");
@@ -1374,10 +1368,10 @@ int wilc_wlan_stop(struct wilc *wilc)
 	reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) |
 	       BIT(29) | BIT(30) | BIT(31));
 
-	p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
+	wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
 	reg = (u32)~BIT(10);
 
-	ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
 
 	release_bus(wilc, RELEASE_ALLOW_SLEEP);
 
@@ -1420,20 +1414,20 @@ void wilc_wlan_cleanup(struct net_device *dev)
 
 	acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
-	ret = p->hif_func.hif_read_reg(wilc, WILC_GP_REG_0, &reg);
+	ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
 	if (!ret) {
 		PRINT_ER("Error while reading reg\n");
 		release_bus(wilc, RELEASE_ALLOW_SLEEP);
 	}
 	PRINT_ER("Writing ABORT reg\n");
-	ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_0,
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
 					(reg | ABORT_INT));
 	if (!ret) {
 		PRINT_ER("Error while writing reg\n");
 		release_bus(wilc, RELEASE_ALLOW_SLEEP);
 	}
 	release_bus(wilc, RELEASE_ALLOW_SLEEP);
-	p->hif_func.hif_deinit(NULL);
+	wilc->hif_func->hif_deinit(NULL);
 }
 
 static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
@@ -1566,18 +1560,18 @@ static u32 init_chip(struct net_device *dev)
 	chipid = wilc_get_chipid(wilc, true);
 
 	if ((chipid & 0xfff) != 0xa0) {
-		ret = g_wlan.hif_func.hif_read_reg(wilc, 0x1118, &reg);
+		ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, &reg);
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n");
 			return ret;
 		}
 		reg |= BIT(0);
-		ret = g_wlan.hif_func.hif_write_reg(wilc, 0x1118, reg);
+		ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg);
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n");
 			return ret;
 		}
-		ret = g_wlan.hif_func.hif_write_reg(wilc, 0xc0000, 0x71);
+		ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71);
 		if (!ret) {
 			wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n");
 			return ret;
@@ -1596,8 +1590,8 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update)
 	u32 rfrevid;
 
 	if (chipid == 0 || update != 0) {
-		g_wlan.hif_func.hif_read_reg(wilc, 0x1000, &tempchipid);
-		g_wlan.hif_func.hif_read_reg(wilc, 0x13f4, &rfrevid);
+		wilc->hif_func->hif_read_reg(wilc, 0x1000, &tempchipid);
+		wilc->hif_func->hif_read_reg(wilc, 0x13f4, &rfrevid);
 		if (!ISWILC1000(tempchipid)) {
 			chipid = 0;
 			goto _fail_;
@@ -1634,8 +1628,7 @@ int wilc_wlan_init(struct net_device *dev)
 
 	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
 	g_wlan.io_type = wilc->io_type;
-	g_wlan.hif_func = *wilc->ops;
-	if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
+	if (!wilc->hif_func->hif_init(wilc, wilc_debug)) {
 		ret = -EIO;
 		goto _fail_;
 	}
@@ -1695,7 +1688,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
 	wilc = nic->wilc;
 
 	mutex_lock(&wilc->hif_cs);
-	ret = (&g_wlan)->hif_func.hif_read_reg(wilc, WILC_CHANGING_VIR_IF,
+	ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF,
 					       &reg);
 	if (!ret)
 		PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -1705,7 +1698,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
 	else
 		reg &= ~BIT(31);
 
-	ret = (&g_wlan)->hif_func.hif_write_reg(wilc, WILC_CHANGING_VIR_IF,
+	ret = wilc->hif_func->hif_write_reg(wilc, WILC_CHANGING_VIR_IF,
 						reg);
 
 	if (!ret)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] staging: wilc1000: remove io_type of wilc_wlan_dev_t
  2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
  2015-11-20  7:56 ` [PATCH 2/6] staging: wilc1000: return linux error value Glen Lee
  2015-11-20  7:56 ` [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t Glen Lee
@ 2015-11-20  7:56 ` Glen Lee
  2015-11-20  7:56 ` [PATCH 5/6] staging: wilc1000: remove unused varialbe tx_buffer_offset Glen Lee
  2015-11-20  7:56 ` [PATCH 6/6] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc Glen Lee
  4 siblings, 0 replies; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

io_type of wilc_wlan_dev_t is unneeded, we can use io_type of struct wilc.
Remove io_type of wilc_wlan_dev_t and use io_type of wilc.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] staging: wilc1000: remove unused varialbe tx_buffer_offset
  2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
                   ` (2 preceding siblings ...)
  2015-11-20  7:56 ` [PATCH 4/6] staging: wilc1000: remove io_type " Glen Lee
@ 2015-11-20  7:56 ` Glen Lee
  2015-11-20  7:56 ` [PATCH 6/6] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc Glen Lee
  4 siblings, 0 replies; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch removes unused variable tx_buffer_offset of wilc_wlan_dev_t.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 37879cd..502b499 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -13,7 +13,6 @@ typedef struct {
 	u8 *rx_buffer;
 	u32 rx_buffer_offset;
 	u8 *tx_buffer;
-	u32 tx_buffer_offset;
 
 	unsigned long txq_spinlock_flags;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc
  2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
                   ` (3 preceding siblings ...)
  2015-11-20  7:56 ` [PATCH 5/6] staging: wilc1000: remove unused varialbe tx_buffer_offset Glen Lee
@ 2015-11-20  7:56 ` Glen Lee
  4 siblings, 0 replies; 7+ messages in thread
From: Glen Lee @ 2015-11-20  7:56 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

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

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index b593b64..68a159f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -181,6 +181,28 @@ struct wilc {
 
 	struct task_struct *txq_thread;
 
+	int quit;
+	int cfg_frame_in_use;
+	struct wilc_cfg_frame cfg_frame;
+	u32 cfg_frame_offset;
+	int cfg_seq_no;
+
+	u8 *rx_buffer;
+	u32 rx_buffer_offset;
+	u8 *tx_buffer;
+
+	unsigned long txq_spinlock_flags;
+
+	struct txq_entry_t *txq_head;
+	struct txq_entry_t *txq_tail;
+	int txq_entries;
+	int txq_exit;
+
+	struct rxq_entry_t *rxq_head;
+	struct rxq_entry_t *rxq_tail;
+	int rxq_entries;
+	int rxq_exit;
+
 	unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
 	const struct firmware *firmware;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 502b499..0427349 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -3,32 +3,6 @@
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
-typedef struct {
-	int quit;
-	int cfg_frame_in_use;
-	struct wilc_cfg_frame cfg_frame;
-	u32 cfg_frame_offset;
-	int cfg_seq_no;
-
-	u8 *rx_buffer;
-	u32 rx_buffer_offset;
-	u8 *tx_buffer;
-
-	unsigned long txq_spinlock_flags;
-
-	struct txq_entry_t *txq_head;
-	struct txq_entry_t *txq_tail;
-	int txq_entries;
-	int txq_exit;
-
-	struct rxq_entry_t *rxq_head;
-	struct rxq_entry_t *rxq_tail;
-	int rxq_entries;
-	int rxq_exit;
-} wilc_wlan_dev_t;
-
-static wilc_wlan_dev_t g_wlan;
-
 #ifdef WILC_OPTIMIZE_SLEEP_INT
 static inline void chip_allow_sleep(struct wilc *wilc);
 #endif
@@ -76,21 +50,20 @@ static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
 #ifdef TCP_ACK_FILTER
 static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
-
-	if (tqe == p->txq_head)	{
-		p->txq_head = tqe->next;
-		if (p->txq_head)
-			p->txq_head->prev = NULL;
-	} else if (tqe == p->txq_tail)	    {
-		p->txq_tail = (tqe->prev);
-		if (p->txq_tail)
-			p->txq_tail->next = NULL;
+
+	if (tqe == wilc->txq_head) {
+		wilc->txq_head = tqe->next;
+		if (wilc->txq_head)
+			wilc->txq_head->prev = NULL;
+	} else if (tqe == wilc->txq_tail) {
+		wilc->txq_tail = (tqe->prev);
+		if (wilc->txq_tail)
+			wilc->txq_tail->next = NULL;
 	} else {
 		tqe->prev->next = tqe->next;
 		tqe->next->prev = tqe->prev;
 	}
-	p->txq_entries -= 1;
+	wilc->txq_entries -= 1;
 }
 #endif
 
@@ -98,7 +71,6 @@ static struct txq_entry_t *
 wilc_wlan_txq_remove_from_head(struct net_device *dev)
 {
 	struct txq_entry_t *tqe;
-	wilc_wlan_dev_t *p = &g_wlan;
 	unsigned long flags;
 	perInterface_wlan_t *nic;
 	struct wilc *wilc;
@@ -107,13 +79,13 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
 	wilc = nic->wilc;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
-	if (p->txq_head) {
-		tqe = p->txq_head;
-		p->txq_head = tqe->next;
-		if (p->txq_head)
-			p->txq_head->prev = NULL;
+	if (wilc->txq_head) {
+		tqe = wilc->txq_head;
+		wilc->txq_head = tqe->next;
+		if (wilc->txq_head)
+			wilc->txq_head->prev = NULL;
 
-		p->txq_entries -= 1;
+		wilc->txq_entries -= 1;
 	} else {
 		tqe = NULL;
 	}
@@ -124,7 +96,6 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
 static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
 				      struct txq_entry_t *tqe)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	unsigned long flags;
 	perInterface_wlan_t *nic;
 	struct wilc *wilc;
@@ -134,19 +105,19 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
-	if (!p->txq_head) {
+	if (!wilc->txq_head) {
 		tqe->next = NULL;
 		tqe->prev = NULL;
-		p->txq_head = tqe;
-		p->txq_tail = tqe;
+		wilc->txq_head = tqe;
+		wilc->txq_tail = tqe;
 	} else {
 		tqe->next = NULL;
-		tqe->prev = p->txq_tail;
-		p->txq_tail->next = tqe;
-		p->txq_tail = tqe;
+		tqe->prev = wilc->txq_tail;
+		wilc->txq_tail->next = tqe;
+		wilc->txq_tail = tqe;
 	}
-	p->txq_entries += 1;
-	PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
+	wilc->txq_entries += 1;
+	PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries);
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 
@@ -157,7 +128,6 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
 
 static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	unsigned long flags;
 	if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
 				    CFG_PKTS_TIMEOUT))
@@ -165,19 +135,19 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
-	if (!p->txq_head) {
+	if (!wilc->txq_head) {
 		tqe->next = NULL;
 		tqe->prev = NULL;
-		p->txq_head = tqe;
-		p->txq_tail = tqe;
+		wilc->txq_head = tqe;
+		wilc->txq_tail = tqe;
 	} else {
-		tqe->next = p->txq_head;
+		tqe->next = wilc->txq_head;
 		tqe->prev = NULL;
-		p->txq_head->prev = tqe;
-		p->txq_head = tqe;
+		wilc->txq_head->prev = tqe;
+		wilc->txq_head = tqe;
 	}
-	p->txq_entries += 1;
-	PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
+	wilc->txq_entries += 1;
+	PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries);
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 	up(&wilc->txq_add_to_head_cs);
@@ -253,7 +223,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
 }
 static inline int remove_TCP_related(struct wilc *wilc)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	unsigned long flags;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
@@ -269,7 +238,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 	u8 *buffer = tqe->buffer;
 	unsigned short h_proto;
 	int i;
-	wilc_wlan_dev_t *p = &g_wlan;
 	unsigned long flags;
 	perInterface_wlan_t *nic;
 	struct wilc *wilc;
@@ -337,12 +305,11 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 	struct wilc *wilc;
 	u32 i = 0;
 	u32 dropped = 0;
-	wilc_wlan_dev_t *p = &g_wlan;
 
 	nic = netdev_priv(dev);
 	wilc = nic->wilc;
 
-	spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags);
+	spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
 	for (i = pending_base; i < (pending_base + pending_acks); i++) {
 		if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) {
 			struct txq_entry_t *tqe;
@@ -369,7 +336,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 	else
 		pending_base = 0;
 
-	spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags);
+	spin_unlock_irqrestore(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
 
 	while (dropped > 0) {
 		wilc_lock_timeout(wilc, &wilc->txq_event, 1);
@@ -396,11 +363,10 @@ static bool is_tcp_ack_filter_enabled(void)
 
 static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	struct txq_entry_t *tqe;
 
 	PRINT_D(TX_DBG, "Adding config packet ...\n");
-	if (p->quit) {
+	if (wilc->quit) {
 		PRINT_D(TX_DBG, "Return due to clear function\n");
 		up(&wilc->cfg_event);
 		return 0;
@@ -430,10 +396,13 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s
 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;
+	perInterface_wlan_t *nic = netdev_priv(dev);
+	struct wilc *wilc;
+
+	wilc = nic->wilc;
 
-	if (p->quit)
+	if (wilc->quit)
 		return 0;
 
 	tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC);
@@ -453,16 +422,19 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
 		tcp_process(dev, tqe);
 #endif
 	wilc_wlan_txq_add_to_tail(dev, tqe);
-	return p->txq_entries;
+	return wilc->txq_entries;
 }
 
 int wilc_wlan_txq_add_mgmt_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;
+	perInterface_wlan_t *nic = netdev_priv(dev);
+	struct wilc *wilc;
+
+	wilc = nic->wilc;
 
-	if (p->quit)
+	if (wilc->quit)
 		return 0;
 
 	tqe = kmalloc(sizeof(*tqe), GFP_KERNEL);
@@ -484,13 +456,12 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
 
 static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	struct txq_entry_t *tqe;
 	unsigned long flags;
 
 	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
-	tqe = p->txq_head;
+	tqe = wilc->txq_head;
 
 	spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
 
@@ -512,41 +483,39 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc,
 
 static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 
-	if (p->quit)
+	if (wilc->quit)
 		return 0;
 
 	mutex_lock(&wilc->rxq_cs);
-	if (!p->rxq_head) {
+	if (!wilc->rxq_head) {
 		PRINT_D(RX_DBG, "Add to Queue head\n");
 		rqe->next = NULL;
-		p->rxq_head = rqe;
-		p->rxq_tail = rqe;
+		wilc->rxq_head = rqe;
+		wilc->rxq_tail = rqe;
 	} else {
 		PRINT_D(RX_DBG, "Add to Queue tail\n");
-		p->rxq_tail->next = rqe;
+		wilc->rxq_tail->next = rqe;
 		rqe->next = NULL;
-		p->rxq_tail = rqe;
+		wilc->rxq_tail = rqe;
 	}
-	p->rxq_entries += 1;
-	PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries);
+	wilc->rxq_entries += 1;
+	PRINT_D(RX_DBG, "Number of queue entries: %d\n", wilc->rxq_entries);
 	mutex_unlock(&wilc->rxq_cs);
-	return p->rxq_entries;
+	return wilc->rxq_entries;
 }
 
 static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 
 	PRINT_D(RX_DBG, "Getting rxQ element\n");
-	if (p->rxq_head) {
+	if (wilc->rxq_head) {
 		struct rxq_entry_t *rqe;
 
 		mutex_lock(&wilc->rxq_cs);
-		rqe = p->rxq_head;
-		p->rxq_head = p->rxq_head->next;
-		p->rxq_entries -= 1;
+		rqe = wilc->rxq_head;
+		wilc->rxq_head = wilc->rxq_head->next;
+		wilc->rxq_entries -= 1;
 		PRINT_D(RX_DBG, "RXQ entries decreased\n");
 		mutex_unlock(&wilc->rxq_cs);
 		return rqe;
@@ -696,11 +665,10 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
 
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 {
-	wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
 	int i, entries = 0;
 	u32 sum;
 	u32 reg;
-	u8 *txb = p->tx_buffer;
+	u8 *txb;
 	u32 offset = 0;
 	int vmm_sz = 0;
 	struct txq_entry_t *tqe;
@@ -714,9 +682,10 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 	nic = netdev_priv(dev);
 	wilc = nic->wilc;
 
-	p->txq_exit = 0;
+	txb = wilc->tx_buffer;
+	wilc->txq_exit = 0;
 	do {
-		if (p->quit)
+		if (wilc->quit)
 			break;
 
 		wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
@@ -800,7 +769,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 				usleep_range(3000, 3000);
 				acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 			}
-		} while (!p->quit);
+		} while (!wilc->quit);
 
 		if (!ret)
 			goto _end_;
@@ -945,23 +914,22 @@ _end_:
 	} while (0);
 	up(&wilc->txq_add_to_head_cs);
 
-	p->txq_exit = 1;
+	wilc->txq_exit = 1;
 	PRINT_D(TX_DBG, "THREAD: Exiting txq\n");
-	*txq_count = p->txq_entries;
+	*txq_count = wilc->txq_entries;
 	return ret;
 }
 
 static void wilc_wlan_handle_rxq(struct wilc *wilc)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	int offset = 0, size, has_packet = 0;
 	u8 *buffer;
 	struct rxq_entry_t *rqe;
 
-	p->rxq_exit = 0;
+	wilc->rxq_exit = 0;
 
 	do {
-		if (p->quit) {
+		if (wilc->quit) {
 			PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n");
 			up(&wilc->cfg_event);
 			break;
@@ -1022,8 +990,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
 					wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp);
 					if (rsp.type == WILC_CFG_RSP) {
-						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)
+						PRINT_D(RX_DBG, "wilc->cfg_seq_no = %d - rsp.seq_no = %d\n", wilc->cfg_seq_no, rsp.seq_no);
+						if (wilc->cfg_seq_no == rsp.seq_no)
 							up(&wilc->cfg_event);
 					} else if (rsp.type == WILC_CFG_RSP_STATUS) {
 						wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
@@ -1044,7 +1012,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
 	} while (1);
 
-	p->rxq_exit = 1;
+	wilc->rxq_exit = 1;
 	PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n");
 }
 
@@ -1080,8 +1048,7 @@ static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1)
 
 static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
-	u32 offset = p->rx_buffer_offset;
+	u32 offset = wilc->rx_buffer_offset;
 	u8 *buffer = NULL;
 	u32 size;
 	u32 retries = 0;
@@ -1103,8 +1070,8 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 		if (LINUX_RX_SIZE - offset < size)
 			offset = 0;
 
-		if (p->rx_buffer) {
-			buffer = &p->rx_buffer[offset];
+		if (wilc->rx_buffer) {
+			buffer = &wilc->rx_buffer[offset];
 		} else {
 			wilc_debug(N_ERR, "[wilc isr]: fail Rx Buffer is NULL...drop the packets (%d)\n", size);
 			goto _end_;
@@ -1121,7 +1088,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
 _end_:
 		if (ret) {
 			offset += size;
-			p->rx_buffer_offset = offset;
+			wilc->rx_buffer_offset = offset;
 			rqe = kmalloc(sizeof(*rqe), GFP_KERNEL);
 			if (rqe) {
 				rqe->buffer = buffer;
@@ -1377,7 +1344,6 @@ int wilc_wlan_stop(struct wilc *wilc)
 
 void wilc_wlan_cleanup(struct net_device *dev)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	struct txq_entry_t *tqe;
 	struct rxq_entry_t *rqe;
 	u32 reg = 0;
@@ -1388,7 +1354,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
 	nic = netdev_priv(dev);
 	wilc = nic->wilc;
 
-	p->quit = 1;
+	wilc->quit = 1;
 	do {
 		tqe = wilc_wlan_txq_remove_from_head(dev);
 		if (!tqe)
@@ -1405,9 +1371,9 @@ void wilc_wlan_cleanup(struct net_device *dev)
 		kfree(rqe);
 	} while (1);
 
-	kfree(p->rx_buffer);
-	p->rx_buffer = NULL;
-	kfree(p->tx_buffer);
+	kfree(wilc->rx_buffer);
+	wilc->rx_buffer = NULL;
+	kfree(wilc->tx_buffer);
 
 	acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
@@ -1429,10 +1395,9 @@ void wilc_wlan_cleanup(struct net_device *dev)
 
 static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
-	struct wilc_cfg_frame *cfg = &p->cfg_frame;
-	int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
-	int seq_no = p->cfg_seq_no % 256;
+	struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
+	int total_len = wilc->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
+	int seq_no = wilc->cfg_seq_no % 256;
 	int driver_handler = (u32)drv_handler;
 
 	if (type == WILC_CFG_SET)
@@ -1446,7 +1411,7 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
 	cfg->wid_header[5] = (u8)(driver_handler >> 8);
 	cfg->wid_header[6] = (u8)(driver_handler >> 16);
 	cfg->wid_header[7] = (u8)(driver_handler >> 24);
-	p->cfg_seq_no = seq_no;
+	wilc->cfg_seq_no = seq_no;
 
 	if (!wilc_wlan_txq_add_cfg_pkt(wilc, &cfg->wid_header[0], total_len))
 		return -1;
@@ -1457,27 +1422,26 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
 int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
 		      u32 buffer_size, int commit, u32 drv_handler)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	u32 offset;
 	int ret_size;
 
-	if (p->cfg_frame_in_use)
+	if (wilc->cfg_frame_in_use)
 		return 0;
 
 	if (start)
-		p->cfg_frame_offset = 0;
+		wilc->cfg_frame_offset = 0;
 
-	offset = p->cfg_frame_offset;
-	ret_size = wilc_wlan_cfg_set_wid(p->cfg_frame.frame, offset, (u16)wid,
-					 buffer, buffer_size);
+	offset = wilc->cfg_frame_offset;
+	ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset,
+					 (u16)wid, buffer, buffer_size);
 	offset += ret_size;
-	p->cfg_frame_offset = offset;
+	wilc->cfg_frame_offset = offset;
 
 	if (commit) {
 		PRINT_D(TX_DBG, "[WILC]PACKET Commit with sequence number %d\n",
-			p->cfg_seq_no);
+			wilc->cfg_seq_no);
 		PRINT_D(RX_DBG, "Processing cfg_set()\n");
-		p->cfg_frame_in_use = 1;
+		wilc->cfg_frame_in_use = 1;
 
 		if (wilc_wlan_cfg_commit(wilc, WILC_CFG_SET, drv_handler))
 			ret_size = 0;
@@ -1487,9 +1451,9 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
 			PRINT_D(TX_DBG, "Set Timed Out\n");
 			ret_size = 0;
 		}
-		p->cfg_frame_in_use = 0;
-		p->cfg_frame_offset = 0;
-		p->cfg_seq_no += 1;
+		wilc->cfg_frame_in_use = 0;
+		wilc->cfg_frame_offset = 0;
+		wilc->cfg_seq_no += 1;
 	}
 
 	return ret_size;
@@ -1498,23 +1462,23 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
 int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
 		      u32 drv_handler)
 {
-	wilc_wlan_dev_t *p = &g_wlan;
 	u32 offset;
 	int ret_size;
 
-	if (p->cfg_frame_in_use)
+	if (wilc->cfg_frame_in_use)
 		return 0;
 
 	if (start)
-		p->cfg_frame_offset = 0;
+		wilc->cfg_frame_offset = 0;
 
-	offset = p->cfg_frame_offset;
-	ret_size = wilc_wlan_cfg_get_wid(p->cfg_frame.frame, offset, (u16)wid);
+	offset = wilc->cfg_frame_offset;
+	ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset,
+					 (u16)wid);
 	offset += ret_size;
-	p->cfg_frame_offset = offset;
+	wilc->cfg_frame_offset = offset;
 
 	if (commit) {
-		p->cfg_frame_in_use = 1;
+		wilc->cfg_frame_in_use = 1;
 
 		if (wilc_wlan_cfg_commit(wilc, WILC_CFG_QUERY, drv_handler))
 			ret_size = 0;
@@ -1525,9 +1489,9 @@ int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit,
 			ret_size = 0;
 		}
 		PRINT_D(GENERIC_DBG, "[WILC]Get Response received\n");
-		p->cfg_frame_in_use = 0;
-		p->cfg_frame_offset = 0;
-		p->cfg_seq_no += 1;
+		wilc->cfg_frame_in_use = 0;
+		wilc->cfg_frame_offset = 0;
+		wilc->cfg_seq_no += 1;
 	}
 
 	return ret_size;
@@ -1623,7 +1587,6 @@ int wilc_wlan_init(struct net_device *dev)
 
 	PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
 
-	memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
 	if (!wilc->hif_func->hif_init(wilc, wilc_debug)) {
 		ret = -EIO;
 		goto _fail_;
@@ -1634,20 +1597,20 @@ int wilc_wlan_init(struct net_device *dev)
 		goto _fail_;
 	}
 
-	if (!g_wlan.tx_buffer)
-		g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
-	PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
+	if (!wilc->tx_buffer)
+		wilc->tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
+	PRINT_D(TX_DBG, "wilc->tx_buffer = %p\n", wilc->tx_buffer);
 
-	if (!g_wlan.tx_buffer) {
+	if (!wilc->tx_buffer) {
 		ret = -ENOBUFS;
 		PRINT_ER("Can't allocate Tx Buffer");
 		goto _fail_;
 	}
 
-	if (!g_wlan.rx_buffer)
-		g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
-	PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
-	if (!g_wlan.rx_buffer) {
+	if (!wilc->rx_buffer)
+		wilc->rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
+	PRINT_D(TX_DBG, "wilc->rx_buffer =%p\n", wilc->rx_buffer);
+	if (!wilc->rx_buffer) {
 		ret = -ENOBUFS;
 		PRINT_ER("Can't allocate Rx Buffer");
 		goto _fail_;
@@ -1665,10 +1628,10 @@ int wilc_wlan_init(struct net_device *dev)
 
 _fail_:
 
-	kfree(g_wlan.rx_buffer);
-	g_wlan.rx_buffer = NULL;
-	kfree(g_wlan.tx_buffer);
-	g_wlan.tx_buffer = NULL;
+	kfree(wilc->rx_buffer);
+	wilc->rx_buffer = NULL;
+	kfree(wilc->tx_buffer);
+	wilc->tx_buffer = NULL;
 
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t
  2015-11-20  7:56 ` [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t Glen Lee
@ 2015-12-18 22:37   ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2015-12-18 22:37 UTC (permalink / raw)
  To: Glen Lee
  Cc: devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

On Fri, Nov 20, 2015 at 04:56:33PM +0900, Glen Lee wrote:
> hif_func of wilc_wlan_dev_t is duplicate because we have same struct
> wilc_hif_func ops of struct wilc which is available in wilc_wlan.c.
> Rename ops of struct wilc with hif_func and remove hif_func of wilc_wlan_dev_t,
> and use wilc->hif_func instead of g_wlan.hif_func in all functions.
> 
> Signed-off-by: Glen Lee <glen.lee@atmel.com>
> ---
>  drivers/staging/wilc1000/linux_wlan.c         |  18 +--
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +-
>  drivers/staging/wilc1000/wilc_wlan.c          | 161 ++++++++++++--------------
>  3 files changed, 87 insertions(+), 94 deletions(-)

This patch didn't apply, so I stopped here in the series, please fix up
and resend.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-19  0:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20  7:56 [PATCH 1/6] staging: wilc1000: remove unused variable Glen Lee
2015-11-20  7:56 ` [PATCH 2/6] staging: wilc1000: return linux error value Glen Lee
2015-11-20  7:56 ` [PATCH 3/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t Glen Lee
2015-12-18 22:37   ` Greg KH
2015-11-20  7:56 ` [PATCH 4/6] staging: wilc1000: remove io_type " Glen Lee
2015-11-20  7:56 ` [PATCH 5/6] staging: wilc1000: remove unused varialbe tx_buffer_offset Glen Lee
2015-11-20  7:56 ` [PATCH 6/6] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc Glen Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.