2015-10-29 03:15:54

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 01/12] staging: wilc1000: wilc_wlan_txq_get_first: add argument struct wilc

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 c026657..6c7cbd1 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -563,17 +563,17 @@ int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, wilc_tx_
return 1;
}

-static struct txq_entry_t *wilc_wlan_txq_get_first(void)
+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(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);

tqe = p->txq_head;

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


return tqe;
@@ -855,7 +855,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
* build the vmm list
**/
PRINT_D(TX_DBG, "Getting the head of the TxQ\n");
- tqe = wilc_wlan_txq_get_first();
+ tqe = wilc_wlan_txq_get_first(wilc);
i = 0;
sum = 0;
do {
--
1.9.1



2015-10-29 03:16:41

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 09/12] staging: wilc1000: linux_wlan_get_firmware: change argument p_nic with dev

This patch changes argument perInterface_wlan_t *p_nic with struct net_device
*dev and use netdev private data nic and it's member wilc instead of
g_linux_wlan.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 895eb60..971b154 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -518,14 +518,17 @@ void linux_wlan_rx_complete(void)
PRINT_D(RX_DBG, "RX completed\n");
}

-int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
+int linux_wlan_get_firmware(struct net_device *dev)
{
-
- perInterface_wlan_t *nic = p_nic;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
int ret = 0;
const struct firmware *wilc_firmware;
char *firmware;

+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
if (nic->iftype == AP_MODE)
firmware = AP_FIRMWARE;
else if (nic->iftype == STATION_MODE)
@@ -550,19 +553,19 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
* root file system with the name specified above */

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

_fail_:

@@ -1126,7 +1129,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
#endif

- if (linux_wlan_get_firmware(nic)) {
+ if (linux_wlan_get_firmware(dev)) {
PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index cdcf134..32b93d3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -21,8 +21,6 @@
#define IS_MGMT_STATUS_SUCCES 0x040
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)

-extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic);
-
extern int mac_open(struct net_device *ndev);
extern int mac_close(struct net_device *ndev);

@@ -2737,7 +2735,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);

PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
- linux_wlan_get_firmware(nic);
+ linux_wlan_get_firmware(dev);
/*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
if (wl->initialized) {
nic->iftype = AP_MODE;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0bfe762..0435cb5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -218,4 +218,5 @@ 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);
+int linux_wlan_get_firmware(struct net_device *dev);
#endif
--
1.9.1


2015-10-29 03:16:29

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 07/12] staging: wilc1000: wilc_wlan_init: add argument struct net_device

This patch adds an argument dev and pass dev to the function.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 6b5f1c5..895eb60 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1096,7 +1096,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)

linux_to_wlan(&nwi, wl);

- ret = wilc_wlan_init(&nwi);
+ ret = wilc_wlan_init(dev, &nwi);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 03593b7..5a480a1 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1951,7 +1951,7 @@ _fail_:
return chipid;
}

-int wilc_wlan_init(wilc_wlan_inp_t *inp)
+int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
{

int ret = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index be972af..139cc6d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -937,7 +937,7 @@ typedef enum {
WID_MAX = 0xFFFF
} WID_T;

-int wilc_wlan_init(wilc_wlan_inp_t *inp);
+int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);

void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void);
--
1.9.1


2015-10-29 03:16:59

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
, and use it instead of g_linux_wlan. Pass wilc to the functions as well.
The void type wilc will be changed with struct wilc when SDIO and SPI
modules are reworked.

Signed-off-by: Glen Lee <[email protected]>
---
drivers/staging/wilc1000/linux_wlan_sdio.c | 8 ++--
drivers/staging/wilc1000/linux_wlan_sdio.h | 4 +-
drivers/staging/wilc1000/wilc_sdio.c | 66 +++++++++++++++---------------
drivers/staging/wilc1000/wilc_wlan_if.h | 4 +-
4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index bf05e22..8150d6f 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
}


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

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


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

sdio_claim_host(func);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 4b515f5..d4b3d12 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -5,8 +5,8 @@ extern struct sdio_driver wilc_bus;

int linux_sdio_init(void *);
void linux_sdio_deinit(void *);
-int linux_sdio_cmd52(sdio_cmd52_t *cmd);
-int linux_sdio_cmd53(sdio_cmd53_t *cmd);
+int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd);
+int linux_sdio_cmd53(void *wilc, sdio_cmd53_t *cmd);
int enable_sdio_interrupt(void);
void disable_sdio_interrupt(void);
int linux_sdio_set_max_speed(void);
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 82f68eb..b9ca142 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -16,8 +16,8 @@
typedef struct {
void *wilc;
u32 block_size;
- int (*sdio_cmd52)(sdio_cmd52_t *);
- int (*sdio_cmd53)(sdio_cmd53_t *);
+ int (*sdio_cmd52)(void *, sdio_cmd52_t *);
+ int (*sdio_cmd53)(void *, sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
wilc_debug_func dPrint;
@@ -51,21 +51,21 @@ static int sdio_set_func0_csa_address(u32 adr)
cmd.raw = 0;
cmd.address = 0x10c;
cmd.data = (u8)adr;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n");
goto _fail_;
}

cmd.address = 0x10d;
cmd.data = (u8)(adr >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n");
goto _fail_;
}

cmd.address = 0x10e;
cmd.data = (u8)(adr >> 16);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n");
goto _fail_;
}
@@ -84,14 +84,14 @@ static int sdio_set_func0_block_size(u32 block_size)
cmd.raw = 0;
cmd.address = 0x10;
cmd.data = (u8)block_size;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n");
goto _fail_;
}

cmd.address = 0x11;
cmd.data = (u8)(block_size >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n");
goto _fail_;
}
@@ -116,13 +116,13 @@ static int sdio_set_func1_block_size(u32 block_size)
cmd.raw = 0;
cmd.address = 0x110;
cmd.data = (u8)block_size;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n");
goto _fail_;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n");
goto _fail_;
}
@@ -143,7 +143,7 @@ static int sdio_clear_int(void)
cmd.raw = 0;
cmd.address = 0x4;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);

return cmd.data;
#else
@@ -170,7 +170,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1C;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
cnt = cmd.data;

cmd.read_write = 0;
@@ -178,7 +178,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1D;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
cnt |= (cmd.data << 8);

cmd.read_write = 0;
@@ -186,7 +186,7 @@ u32 sdio_xfer_cnt(void)
cmd.raw = 0;
cmd.address = 0x1E;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
cnt |= (cmd.data << 16);

return cnt;
@@ -209,7 +209,7 @@ int sdio_check_bs(void)
cmd.raw = 0;
cmd.address = 0xc;
cmd.data = 0;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n");
goto _fail_;
}
@@ -235,7 +235,7 @@ static int sdio_write_reg(u32 addr, u32 data)
cmd.raw = 0;
cmd.address = addr;
cmd.data = data;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -257,7 +257,7 @@ static int sdio_write_reg(u32 addr, u32 data)
cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */

- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr);
goto _fail_;
}
@@ -320,7 +320,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr);
goto _fail_;
}
@@ -341,7 +341,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr);
goto _fail_;
}
@@ -363,7 +363,7 @@ static int sdio_read_reg(u32 addr, u32 *data)
cmd.function = 0;
cmd.raw = 0;
cmd.address = addr;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -384,7 +384,7 @@ static int sdio_read_reg(u32 addr, u32 *data)

cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */

- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr);
goto _fail_;
}
@@ -451,7 +451,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr);
goto _fail_;
}
@@ -472,7 +472,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size)
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!g_sdio.sdio_cmd53(&cmd)) {
+ if (!g_sdio.sdio_cmd53(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr);
goto _fail_;
}
@@ -587,7 +587,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x100;
cmd.data = 0x80;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n");
goto _fail_;
}
@@ -609,7 +609,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x2;
cmd.data = 0x2;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n");
goto _fail_;
}
@@ -624,7 +624,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
loop = 3;
do {
cmd.data = 0;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n");
goto _fail_;
}
@@ -653,7 +653,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
cmd.raw = 1;
cmd.address = 0x4;
cmd.data = 0x3;
- if (!g_sdio.sdio_cmd52(&cmd)) {
+ if (!g_sdio.sdio_cmd52(g_sdio.wilc, &cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n");
goto _fail_;
}
@@ -703,7 +703,7 @@ static int sdio_read_size(u32 *size)
cmd.raw = 0;
cmd.address = 0xf2;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
tmp = cmd.data;

/* cmd.read_write = 0; */
@@ -711,7 +711,7 @@ static int sdio_read_size(u32 *size)
/* cmd.raw = 0; */
cmd.address = 0xf3;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
tmp |= (cmd.data << 8);

*size = tmp;
@@ -733,7 +733,7 @@ static int sdio_read_int(u32 *int_status)
cmd.function = 1;
cmd.address = 0x04;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);

if (cmd.data & BIT(0))
tmp |= INT_0;
@@ -766,7 +766,7 @@ static int sdio_read_int(u32 *int_status)
cmd.raw = 0;
cmd.address = 0xf7;
cmd.data = 0;
- g_sdio.sdio_cmd52(&cmd);
+ g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
irq_flags = cmd.data & 0x1f;
tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
}
@@ -813,7 +813,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.address = 0xf8;
cmd.data = reg;

- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -842,7 +842,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.address = 0xf8;
cmd.data = BIT(i);

- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -886,7 +886,7 @@ static int sdio_clear_int_ext(u32 val)
cmd.raw = 0;
cmd.address = 0xf6;
cmd.data = vmm_ctl;
- ret = g_sdio.sdio_cmd52(&cmd);
+ ret = g_sdio.sdio_cmd52(g_sdio.wilc, &cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__);
goto _fail_;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index a6bf969..89d2d65 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -77,8 +77,8 @@ typedef struct {
void (*io_deinit)(void *);
union {
struct {
- int (*sdio_cmd52)(sdio_cmd52_t *);
- int (*sdio_cmd53)(sdio_cmd53_t *);
+ int (*sdio_cmd52)(void *, sdio_cmd52_t *);
+ int (*sdio_cmd53)(void *, sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
int (*sdio_set_default_speed)(void);
} sdio;
--
1.9.1


2015-10-29 03:16:17

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 05/12] staging: wilc1000: wilc_wlan_txq_add_to_tail: add argument net_device

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

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 3dc0a80..03593b7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -190,11 +190,18 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
return tqe;
}

-static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
+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;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);

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

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

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

- up(&g_linux_wlan->txq_event);
+ up(&wilc->txq_event);
}

static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
@@ -538,7 +545,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
if (is_TCP_ACK_Filter_Enabled())
tcp_process(dev, tqe);
#endif
- wilc_wlan_txq_add_to_tail(tqe);
+ wilc_wlan_txq_add_to_tail(dev, tqe);
/*return number of itemes in the queue*/
return p->txq_entries;
}
@@ -566,7 +573,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe->tcp_PendingAck_index = NOT_TCP_ACK;
#endif
PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
- wilc_wlan_txq_add_to_tail(tqe);
+ wilc_wlan_txq_add_to_tail(dev, tqe);
return 1;
}

--
1.9.1


2015-10-29 03:16:53

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 11/12] staging: wilc1000: rename os_context to wilc

This patch rename os_context to wilc because it is used as struct wilc and
move os_private from struct wilc_wlan_os_context_t to struct wilc_wlan_inp_t.
Finally, delete wilc_wlan_os_context_t.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 017799f..d0161cd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1012,7 +1012,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)

PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");

- nwi->os_context.os_private = (void *)nic;
+ nwi->wilc = (void *)nic;

#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 300c571..82f68eb 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -14,7 +14,7 @@
#define WILC_SDIO_BLOCK_SIZE 512

typedef struct {
- void *os_context;
+ void *wilc;
u32 block_size;
int (*sdio_cmd52)(sdio_cmd52_t *);
int (*sdio_cmd53)(sdio_cmd53_t *);
@@ -563,10 +563,10 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
memset(&g_sdio, 0, sizeof(wilc_sdio_t));

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

if (inp->io_func.io_init) {
- if (!inp->io_func.io_init(g_sdio.os_context)) {
+ if (!inp->io_func.io_init(g_sdio.wilc)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
return 0;
}
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 599508b..9a72fbb 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -12,7 +12,7 @@
#include "wilc_wlan.h"

typedef struct {
- void *os_context;
+ void *wilc;
int (*spi_tx)(u8 *, u32);
int (*spi_rx)(u8 *, u32);
int (*spi_trx)(u8 *, u8 *, u32);
@@ -968,9 +968,9 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
memset(&g_spi, 0, sizeof(wilc_spi_t));

g_spi.dPrint = func;
- g_spi.os_context = inp->os_context.os_private;
+ g_spi.wilc = inp->wilc;
if (inp->io_func.io_init) {
- if (!inp->io_func.io_init(g_spi.os_context)) {
+ if (!inp->io_func.io_init(g_spi.wilc)) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 139cc6d..a6bf969 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -99,11 +99,7 @@ typedef struct {
#define WILC_MAC_INDICATE_SCAN 0x2

typedef struct {
- void *os_private;
-} wilc_wlan_os_context_t;
-
-typedef struct {
- wilc_wlan_os_context_t os_context;
+ void *wilc;
wilc_wlan_io_func_t io_func;
} wilc_wlan_inp_t;

--
1.9.1


2015-10-29 03:16:23

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 06/12] staging: wilc1000: linux_wlan_start_firmware: change argument with dev

This patch changes argument nic with dev and use netdev private data member
wilc instead of g_linux_wlan, and pass dev to the function as well.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 69d2839..6b5f1c5 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -570,10 +570,15 @@ _fail_:

}

-static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
+static int linux_wlan_start_firmware(struct net_device *dev)
{
-
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
int ret = 0;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
/* start firmware */
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
ret = wilc_wlan_start();
@@ -584,7 +589,7 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)

/* wait for mac ready */
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
- ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000);
+ ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000);
if (ret) {
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
@@ -1136,7 +1141,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

/* Start firmware*/
- ret = linux_wlan_start_firmware(nic);
+ ret = linux_wlan_start_firmware(dev);
if (ret < 0) {
PRINT_ER("Failed to start firmware\n");
ret = -EIO;
--
1.9.1


2015-10-29 03:16:35

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 08/12] staging: wilc1000: wilc_wlan_init: add argument net_device

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

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 5a480a1..16224ce 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1870,7 +1870,7 @@ void wilc_bus_set_default_speed(void)
/* Restore bus speed to default. */
g_wlan.hif_func.hif_set_default_bus_speed();
}
-u32 init_chip(void)
+u32 init_chip(struct net_device *dev)
{
u32 chipid;
u32 reg, ret = 0;
@@ -2028,7 +2028,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
}
#endif

- if (!init_chip()) {
+ if (!init_chip(dev)) {
/* EIO 5 */
ret = -5;
goto _fail_;
--
1.9.1


2015-10-29 03:16:00

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 02/12] staging: wilc1000: linux_wlan_firmware_download: change argument

This patch changes argument p_nic with wilc and use it instead of
g_linux_wlan. Pass argument dev to the function.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 2a5b36f..69d2839 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -598,12 +598,16 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
_fail_:
return ret;
}
-static int linux_wlan_firmware_download(struct wilc *p_nic)
+static int linux_wlan_firmware_download(struct net_device *dev)
{
-
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
int ret = 0;

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

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

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

@@ -1124,7 +1128,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}

/*Download firmware*/
- ret = linux_wlan_firmware_download(wl);
+ ret = linux_wlan_firmware_download(dev);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
--
1.9.1


2015-10-29 03:16:47

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 10/12] staging: wilc1000: wl_wlan_cleanup: add argument struct wilc

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/linux_wlan.c | 28 +++++++++++++--------------
drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 971b154..017799f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1652,39 +1652,39 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}

-void wl_wlan_cleanup(void)
+void wl_wlan_cleanup(struct wilc *wilc)
{
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];

- if (g_linux_wlan &&
- (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ if (wilc &&
+ (wilc->vif[0].ndev || wilc->vif[1].ndev)) {
unregister_inetaddr_notifier(&g_dev_notifier);

for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
+ nic[i] = netdev_priv(wilc->vif[i].ndev);
}

- if (g_linux_wlan && g_linux_wlan->firmware)
- release_firmware(g_linux_wlan->firmware);
+ if (wilc && wilc->firmware)
+ release_firmware(wilc->firmware);

- if (g_linux_wlan &&
- (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ if (wilc&&
+ (wilc->vif[0].ndev || wilc->vif[1].ndev)) {
linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000);

for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- if (g_linux_wlan->vif[i].ndev)
+ if (wilc->vif[i].ndev)
if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->vif[i].ndev);
+ mac_close(wilc->vif[i].ndev);

for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- unregister_netdev(g_linux_wlan->vif[i].ndev);
- wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
- free_netdev(g_linux_wlan->vif[i].ndev);
+ unregister_netdev(wilc->vif[i].ndev);
+ wilc_free_wiphy(wilc->vif[i].ndev);
+ free_netdev(wilc->vif[i].ndev);
}
}

- kfree(g_linux_wlan);
+ kfree(wilc);

#if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4aff953..bf05e22 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -146,7 +146,7 @@ static void linux_sdio_remove(struct sdio_func *func)
struct wilc_sdio *wl_sdio;

wl_sdio = sdio_get_drvdata(func);
- wl_wlan_cleanup();
+ wl_wlan_cleanup(wl_sdio->wilc);
kfree(wl_sdio);
}

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0435cb5..07917ea 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -213,7 +213,7 @@ 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);
-void wl_wlan_cleanup(void);
+void wl_wlan_cleanup(struct wilc *wilc);
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);
--
1.9.1


2015-10-29 03:16:12

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 04/12] staging: wilc1000: wilc_wlan_txq_add_mgmt_pkt: add new argument dev

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

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

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 450af1b..589a11f 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -195,7 +195,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
mgmt_tx->size = len;

memcpy(mgmt_tx->buff, buf, len);
- wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
+ wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
mgmt_tx_complete);

netif_wake_queue(dev);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4de27ef..cdcf134 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2337,8 +2337,8 @@ static int mgmt_tx(struct wiphy *wiphy,
jiffies, pstrWFIDrv->p2p_timeout);
}

- wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff,
- mgmt_tx->size,
+ wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, mgmt_tx,
+ mgmt_tx->buff, mgmt_tx->size,
WILC_WFI_mgmt_tx_complete);
} else {
PRINT_D(GENERIC_DBG, "This function transmits only management frames\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 5dcc4d2..3dc0a80 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -543,7 +543,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
return p->txq_entries;
}

-int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func)
+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;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 57e1d51..2eb7e20 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -307,6 +307,6 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
int commit, u32 drvHandler);
int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
-int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
- wilc_tx_complete_func_t func);
+int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
+ u32 buffer_size, wilc_tx_complete_func_t func);
#endif
--
1.9.1


2015-10-29 03:16:06

by Glen Lee

[permalink] [raw]
Subject: [PATCH RESEND 03/12] staging: wilc1000: wilc_wlan_txq_remove_from_head: add new argument dev

Add new argument dev and use it instead of g_linux_wlan, and pass argument
dev to the function as well.

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

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 6c7cbd1..5dcc4d2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -159,13 +159,19 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)

}

-static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
+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;

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

@@ -1035,7 +1041,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
offset = 0;
i = 0;
do {
- tqe = wilc_wlan_txq_remove_from_head();
+ tqe = wilc_wlan_txq_remove_from_head(dev);
if (tqe != NULL && (vmm_table[i] != 0)) {
u32 header, buffer_offset;

@@ -1668,7 +1674,7 @@ void wilc_wlan_cleanup(struct net_device *dev)

p->quit = 1;
do {
- tqe = wilc_wlan_txq_remove_from_head();
+ tqe = wilc_wlan_txq_remove_from_head(dev);
if (tqe == NULL)
break;
if (tqe->tx_complete_func)
--
1.9.1


2015-11-04 20:40:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH RESEND 11/12] staging: wilc1000: rename os_context to wilc

On Thu, Oct 29, 2015 at 12:18:51PM +0900, Glen Lee wrote:
> This patch rename os_context to wilc because it is used as struct wilc and
> move os_private from struct wilc_wlan_os_context_t to struct wilc_wlan_inp_t.
> Finally, delete wilc_wlan_os_context_t.
>
> Signed-off-by: Glen Lee <[email protected]>
> ---
> drivers/staging/wilc1000/linux_wlan.c | 2 +-
> drivers/staging/wilc1000/wilc_sdio.c | 6 +++---
> drivers/staging/wilc1000/wilc_spi.c | 6 +++---
> drivers/staging/wilc1000/wilc_wlan_if.h | 6 +-----
> 4 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index 017799f..d0161cd 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1012,7 +1012,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
>
> PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
>
> - nwi->os_context.os_private = (void *)nic;
> + nwi->wilc = (void *)nic;

Why do you need the cast to a void * here?


>
> #ifdef WILC_SDIO
> nwi->io_func.io_type = HIF_SDIO;
> diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
> index 300c571..82f68eb 100644
> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -14,7 +14,7 @@
> #define WILC_SDIO_BLOCK_SIZE 512
>
> typedef struct {
> - void *os_context;
> + void *wilc;

This should be a struct wilc *, right? Don't add a void pointer for
something that you know what it is.

thanks,

greg k-h

2015-11-05 03:04:35

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

On Thu, Nov 05, 2015 at 11:22:47AM +0900, glen lee wrote:
>
> On 2015년 11월 05일 05:41, Greg KH wrote:
> >On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:
> >>This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
> >>, and use it instead of g_linux_wlan. Pass wilc to the functions as well.
> >>The void type wilc will be changed with struct wilc when SDIO and SPI
> >>modules are reworked.
> >>
> >>Signed-off-by: Glen Lee <[email protected]>
> >>---
> >> drivers/staging/wilc1000/linux_wlan_sdio.c | 8 ++--
> >> drivers/staging/wilc1000/linux_wlan_sdio.h | 4 +-
> >> drivers/staging/wilc1000/wilc_sdio.c | 66 +++++++++++++++---------------
> >> drivers/staging/wilc1000/wilc_wlan_if.h | 4 +-
> >> 4 files changed, 41 insertions(+), 41 deletions(-)
> >>
> >>diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>index bf05e22..8150d6f 100644
> >>--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
> >>@@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
> >> }
> >>-int linux_sdio_cmd52(sdio_cmd52_t *cmd)
> >>+int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)
> >Again, why a void *? Please use the correct type, you know what it is,
> >that way you can get rid of horrid stuff like this:
> >
> >> {
> >>- struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
> >>+ struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;
> >All of those casts should not be needed.
>
> I was planning to change this void type with struct wilc as I commented in changelog.

Sorry, I missed that. But you should still not do an intermediate step
that you know is wrong :)

> But as you pointed out, I will do this after fixing current SDIO modules.

That sounds reasonable, thanks.

greg k-h

2015-11-04 20:41:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan

On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:
> This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
> , and use it instead of g_linux_wlan. Pass wilc to the functions as well.
> The void type wilc will be changed with struct wilc when SDIO and SPI
> modules are reworked.
>
> Signed-off-by: Glen Lee <[email protected]>
> ---
> drivers/staging/wilc1000/linux_wlan_sdio.c | 8 ++--
> drivers/staging/wilc1000/linux_wlan_sdio.h | 4 +-
> drivers/staging/wilc1000/wilc_sdio.c | 66 +++++++++++++++---------------
> drivers/staging/wilc1000/wilc_wlan_if.h | 4 +-
> 4 files changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
> index bf05e22..8150d6f 100644
> --- a/drivers/staging/wilc1000/linux_wlan_sdio.c
> +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
> @@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
> }
>
>
> -int linux_sdio_cmd52(sdio_cmd52_t *cmd)
> +int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)

Again, why a void *? Please use the correct type, you know what it is,
that way you can get rid of horrid stuff like this:

> {
> - struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
> + struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;

All of those casts should not be needed.

thanks,

greg k-h

2015-11-05 02:19:44

by Glen Lee

[permalink] [raw]
Subject: Re: [PATCH RESEND 12/12] staging: wilc1000: add argument wilc and use it instead of g_linux_wlan


On 2015년 11월 05일 05:41, Greg KH wrote:
> On Thu, Oct 29, 2015 at 12:18:52PM +0900, Glen Lee wrote:
>> This patch adds new argument wilc to linux_sdio_cmd53 and linux_sdio_cmd52
>> , and use it instead of g_linux_wlan. Pass wilc to the functions as well.
>> The void type wilc will be changed with struct wilc when SDIO and SPI
>> modules are reworked.
>>
>> Signed-off-by: Glen Lee <[email protected]>
>> ---
>> drivers/staging/wilc1000/linux_wlan_sdio.c | 8 ++--
>> drivers/staging/wilc1000/linux_wlan_sdio.h | 4 +-
>> drivers/staging/wilc1000/wilc_sdio.c | 66 +++++++++++++++---------------
>> drivers/staging/wilc1000/wilc_wlan_if.h | 4 +-
>> 4 files changed, 41 insertions(+), 41 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
>> index bf05e22..8150d6f 100644
>> --- a/drivers/staging/wilc1000/linux_wlan_sdio.c
>> +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
>> @@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
>> }
>>
>>
>> -int linux_sdio_cmd52(sdio_cmd52_t *cmd)
>> +int linux_sdio_cmd52(void *wilc, sdio_cmd52_t *cmd)
> Again, why a void *? Please use the correct type, you know what it is,
> that way you can get rid of horrid stuff like this:
>
>> {
>> - struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
>> + struct sdio_func *func = ((struct wilc*)wilc)->wilc_sdio_func;
> All of those casts should not be needed.

I was planning to change this void type with struct wilc as I commented in changelog.
But as you pointed out, I will do this after fixing current SDIO modules.

Regards,
glen lee.

>
> thanks,
>
> greg k-h