Commit 89758e13 authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: wilc_wlan_cfg_set: pass struct wilc

This patch pass struct wilc to the function and use it instead of global
variable wilc_dev.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec62e6d1
...@@ -616,7 +616,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, ...@@ -616,7 +616,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
} else if (mode == SET_CFG) { } else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) { for (counter = 0; counter < count; counter++) {
PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id); PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id);
if (!wilc_wlan_cfg_set(!counter, if (!wilc_wlan_cfg_set(wilc, !counter,
wids[counter].id, wids[counter].id,
wids[counter].val, wids[counter].val,
wids[counter].size, wids[counter].size,
......
...@@ -537,179 +537,194 @@ static int linux_wlan_init_test_config(struct net_device *dev, ...@@ -537,179 +537,194 @@ static int linux_wlan_init_test_config(struct net_device *dev,
*(int *)c_val = 1; *(int *)c_val = 1;
if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 0; c_val[0] = 0;
if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = INFRASTRUCTURE; c_val[0] = INFRASTRUCTURE;
if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = RATE_AUTO; c_val[0] = RATE_AUTO;
if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = G_MIXED_11B_2_MODE; c_val[0] = G_MIXED_11B_2_MODE;
if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = G_SHORT_PREAMBLE; c_val[0] = G_SHORT_PREAMBLE;
if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = AUTO_PROT; c_val[0] = AUTO_PROT;
if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = ACTIVE_SCAN; c_val[0] = ACTIVE_SCAN;
if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = SITE_SURVEY_OFF; c_val[0] = SITE_SURVEY_OFF;
if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
*((int *)c_val) = 0xffff; *((int *)c_val) = 0xffff;
if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_; goto _fail_;
*((int *)c_val) = 2346; *((int *)c_val) = 2346;
if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 0; c_val[0] = 0;
if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = NO_POWERSAVE; c_val[0] = NO_POWERSAVE;
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */ c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = OPEN_SYSTEM; c_val[0] = OPEN_SYSTEM;
if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
strcpy(c_val, "123456790abcdef1234567890"); strcpy(c_val, "123456790abcdef1234567890");
if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_WEP_KEY_VALUE, c_val,
(strlen(c_val) + 1), 0, 0))
goto _fail_; goto _fail_;
strcpy(c_val, "12345678"); strcpy(c_val, "12345678");
if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0,
0))
goto _fail_; goto _fail_;
strcpy(c_val, "password"); strcpy(c_val, "password");
if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1),
0, 0))
goto _fail_; goto _fail_;
c_val[0] = 192; c_val[0] = 192;
c_val[1] = 168; c_val[1] = 168;
c_val[2] = 1; c_val[2] = 1;
c_val[3] = 112; c_val[3] = 112;
if (!wilc_wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 3; c_val[0] = 3;
if (!wilc_wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 3; c_val[0] = 3;
if (!wilc_wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = NORMAL_ACK; c_val[0] = NORMAL_ACK;
if (!wilc_wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 0; c_val[0] = 0;
if (!wilc_wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1,
0, 0))
goto _fail_; goto _fail_;
c_val[0] = 48; c_val[0] = 48;
if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = 28; c_val[0] = 28;
if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
*((int *)c_val) = 100; *((int *)c_val) = 100;
if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = REKEY_DISABLE; c_val[0] = REKEY_DISABLE;
if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
*((int *)c_val) = 84600; *((int *)c_val) = 84600;
if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
goto _fail_; goto _fail_;
*((int *)c_val) = 500; *((int *)c_val) = 500;
if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = G_SELF_CTS_PROT; c_val[0] = G_SELF_CTS_PROT;
if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = HT_MIXED_MODE; c_val[0] = HT_MIXED_MODE;
if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
memcpy(c_val, mac_add, 6); memcpy(c_val, mac_add, 6);
if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_MAC_ADDR, c_val, 6, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = DETECT_PROTECT_REPORT; c_val[0] = DETECT_PROTECT_REPORT;
if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
0, 0))
goto _fail_; goto _fail_;
c_val[0] = RTS_CTS_NONHT_PROT; c_val[0] = RTS_CTS_NONHT_PROT;
if (!wilc_wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 0; c_val[0] = 0;
if (!wilc_wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = MIMO_MODE; c_val[0] = MIMO_MODE;
if (!wilc_wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
goto _fail_; goto _fail_;
c_val[0] = 7; c_val[0] = 7;
if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0,
0))
goto _fail_; goto _fail_;
c_val[0] = 1; c_val[0] = 1;
if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1)) if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1,
1, 1))
goto _fail_; goto _fail_;
return 0; return 0;
......
...@@ -1499,11 +1499,10 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) ...@@ -1499,11 +1499,10 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
return 0; return 0;
} }
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
int commit, u32 drv_handler) u32 buffer_size, int commit, u32 drv_handler)
{ {
wilc_wlan_dev_t *p = &g_wlan; wilc_wlan_dev_t *p = &g_wlan;
struct wilc *wilc = wilc_dev;
u32 offset; u32 offset;
int ret_size; int ret_size;
......
...@@ -289,8 +289,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, ...@@ -289,8 +289,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count);
void wilc_handle_isr(struct wilc *wilc); void wilc_handle_isr(struct wilc *wilc);
void wilc_wlan_cleanup(struct net_device *dev); void wilc_wlan_cleanup(struct net_device *dev);
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer,
int commit, u32 drv_handler); u32 buffer_size, int commit, u32 drv_handler);
int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler);
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment