staging: wilc1000: remove unnecessary void pointer cast
[deliverable/linux.git] / drivers / staging / wilc1000 / wilc_wfi_cfgoperations.c
index 99d859dd6177fd51883686d0300ccdf9f3d9aaa3..a6edc973f636babacc4fd8f51956bd197958610e 100644 (file)
@@ -32,9 +32,9 @@ extern int mac_close(struct net_device *ndev);
 tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 u32 u32LastScannedNtwrksCountShadow;
 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-WILC_TimerHandle hDuringIpTimer;
+struct timer_list hDuringIpTimer;
 #endif
-WILC_TimerHandle hAgingTimer;
+struct timer_list hAgingTimer;
 static u8 op_ifcs;
 extern u8 u8ConnectedSSID[6];
 
@@ -145,12 +145,12 @@ void clear_shadow_scan(void *pUserVoid)
 {
        int i;
        if (op_ifcs == 0) {
-               WILC_TimerDestroy(&hAgingTimer, NULL);
+               del_timer_sync(&hAgingTimer);
                PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n");
 
                for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
                        if (astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs != NULL) {
-                               WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs);
+                               kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
                                astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL;
                        }
 
@@ -231,7 +231,7 @@ void update_scan_time(void *pUserVoid)
        }
 }
 
-void remove_network_from_shadow(void *pUserVoid)
+static void remove_network_from_shadow(unsigned long arg)
 {
        unsigned long now = jiffies;
        int i, j;
@@ -242,7 +242,7 @@ void remove_network_from_shadow(void *pUserVoid)
                        PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid);
 
                        if (astrLastScannedNtwrksShadow[i].pu8IEs != NULL) {
-                               WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs);
+                               kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
                                astrLastScannedNtwrksShadow[i].pu8IEs = NULL;
                        }
 
@@ -256,14 +256,16 @@ void remove_network_from_shadow(void *pUserVoid)
        }
 
        PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow);
-       if (u32LastScannedNtwrksCountShadow != 0)
-               WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL);
-       else
+       if (u32LastScannedNtwrksCountShadow != 0) {
+               hAgingTimer.data = arg;
+               mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
+       } else {
                PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n");
+       }
 }
 
 #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-void clear_duringIP(void *pUserVoid)
+static void clear_duringIP(unsigned long arg)
 {
        PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n");
        g_obtainingIP = false;
@@ -277,7 +279,8 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 
        if (u32LastScannedNtwrksCountShadow == 0) {
                PRINT_D(CFG80211_DBG, "Starting Aging timer\n");
-               WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL);
+               hAgingTimer.data = (unsigned long)pUserVoid;
+               mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME));
                state = -1;
        } else {
                /* Linear search for now */
@@ -334,9 +337,9 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo
        astrLastScannedNtwrksShadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen;
        astrLastScannedNtwrksShadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf;
        if (ap_found != -1)
-               WILC_FREE(astrLastScannedNtwrksShadow[ap_index].pu8IEs);
+               kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs);
        astrLastScannedNtwrksShadow[ap_index].pu8IEs =
-               (u8 *)WILC_MALLOC(pstrNetworkInfo->u16IEsLen);        /* will be deallocated by the WILC_WFI_CfgScan() function */
+               WILC_MALLOC(pstrNetworkInfo->u16IEsLen);        /* will be deallocated by the WILC_WFI_CfgScan() function */
        memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs,
                    pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen);
 
@@ -734,7 +737,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r
 
        priv->u32RcvdChCount = 0;
 
-       host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv);
+       host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
 
 
        reset_shadow_found(priv);
@@ -829,7 +832,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
        priv = wiphy_priv(wiphy);
        pstrWFIDrv = (tstrWILC_WFIDrv *)(priv->hWILCWFIDrv);
 
-       host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv);
+       host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
 
        PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
        #ifdef WILC_P2P
@@ -1190,13 +1193,13 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
                if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
 
                        if (priv->wilc_gtk[key_index] == NULL) {
-                               priv->wilc_gtk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key));
+                               priv->wilc_gtk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key));
                                priv->wilc_gtk[key_index]->key = NULL;
                                priv->wilc_gtk[key_index]->seq = NULL;
 
                        }
                        if (priv->wilc_ptk[key_index] == NULL) {
-                               priv->wilc_ptk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key));
+                               priv->wilc_ptk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key));
                                priv->wilc_ptk[key_index]->key = NULL;
                                priv->wilc_ptk[key_index]->seq = NULL;
                        }
@@ -1219,17 +1222,17 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
                                }
                                /* if there has been previous allocation for the same index through its key, free that memory and allocate again*/
                                if (priv->wilc_gtk[key_index]->key)
-                                       WILC_FREE(priv->wilc_gtk[key_index]->key);
+                                       kfree(priv->wilc_gtk[key_index]->key);
 
-                               priv->wilc_gtk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len);
+                               priv->wilc_gtk[key_index]->key = WILC_MALLOC(params->key_len);
                                memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len);
 
                                /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/
                                if (priv->wilc_gtk[key_index]->seq)
-                                       WILC_FREE(priv->wilc_gtk[key_index]->seq);
+                                       kfree(priv->wilc_gtk[key_index]->seq);
 
                                if ((params->seq_len) > 0) {
-                                       priv->wilc_gtk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len);
+                                       priv->wilc_gtk[key_index]->seq = WILC_MALLOC(params->seq_len);
                                        memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len);
                                }
 
@@ -1265,15 +1268,15 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
                                }
 
                                if (priv->wilc_ptk[key_index]->key)
-                                       WILC_FREE(priv->wilc_ptk[key_index]->key);
+                                       kfree(priv->wilc_ptk[key_index]->key);
 
-                               priv->wilc_ptk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len);
+                               priv->wilc_ptk[key_index]->key = WILC_MALLOC(params->key_len);
 
                                if (priv->wilc_ptk[key_index]->seq)
-                                       WILC_FREE(priv->wilc_ptk[key_index]->seq);
+                                       kfree(priv->wilc_ptk[key_index]->seq);
 
                                if ((params->seq_len) > 0)
-                                       priv->wilc_ptk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len);
+                                       priv->wilc_ptk[key_index]->seq = WILC_MALLOC(params->seq_len);
 
                                if (INFO) {
                                        for (i = 0; i < params->key_len; i++)
@@ -1422,7 +1425,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
 
                /*Delete saved WEP keys params, if any*/
                if (g_key_wep_params.key != NULL) {
-                       WILC_FREE(g_key_wep_params.key);
+                       kfree(g_key_wep_params.key);
                        g_key_wep_params.key = NULL;
                }
 
@@ -1433,16 +1436,16 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
 
                        if (priv->wilc_gtk[key_index]->key != NULL) {
 
-                               WILC_FREE(priv->wilc_gtk[key_index]->key);
+                               kfree(priv->wilc_gtk[key_index]->key);
                                priv->wilc_gtk[key_index]->key = NULL;
                        }
                        if (priv->wilc_gtk[key_index]->seq) {
 
-                               WILC_FREE(priv->wilc_gtk[key_index]->seq);
+                               kfree(priv->wilc_gtk[key_index]->seq);
                                priv->wilc_gtk[key_index]->seq = NULL;
                        }
 
-                       WILC_FREE(priv->wilc_gtk[key_index]);
+                       kfree(priv->wilc_gtk[key_index]);
                        priv->wilc_gtk[key_index] = NULL;
 
                }
@@ -1451,35 +1454,35 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
 
                        if (priv->wilc_ptk[key_index]->key) {
 
-                               WILC_FREE(priv->wilc_ptk[key_index]->key);
+                               kfree(priv->wilc_ptk[key_index]->key);
                                priv->wilc_ptk[key_index]->key = NULL;
                        }
                        if (priv->wilc_ptk[key_index]->seq) {
 
-                               WILC_FREE(priv->wilc_ptk[key_index]->seq);
+                               kfree(priv->wilc_ptk[key_index]->seq);
                                priv->wilc_ptk[key_index]->seq = NULL;
                        }
-                       WILC_FREE(priv->wilc_ptk[key_index]);
+                       kfree(priv->wilc_ptk[key_index]);
                        priv->wilc_ptk[key_index] = NULL;
                }
        #endif
 
                /*Delete saved PTK and GTK keys params, if any*/
                if (g_key_ptk_params.key != NULL) {
-                       WILC_FREE(g_key_ptk_params.key);
+                       kfree(g_key_ptk_params.key);
                        g_key_ptk_params.key = NULL;
                }
                if (g_key_ptk_params.seq != NULL) {
-                       WILC_FREE(g_key_ptk_params.seq);
+                       kfree(g_key_ptk_params.seq);
                        g_key_ptk_params.seq = NULL;
                }
 
                if (g_key_gtk_params.key != NULL) {
-                       WILC_FREE(g_key_gtk_params.key);
+                       kfree(g_key_gtk_params.key);
                        g_key_gtk_params.key = NULL;
                }
                if (g_key_gtk_params.seq != NULL) {
-                       WILC_FREE(g_key_gtk_params.seq);
+                       kfree(g_key_gtk_params.seq);
                        g_key_gtk_params.seq = NULL;
                }
 
@@ -2509,12 +2512,12 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
        if (ieee80211_is_mgmt(mgmt->frame_control)) {
 
                /*mgmt frame allocation*/
-               mgmt_tx = (struct p2p_mgmt_data *)WILC_MALLOC(sizeof(struct p2p_mgmt_data));
+               mgmt_tx = WILC_MALLOC(sizeof(struct p2p_mgmt_data));
                if (mgmt_tx == NULL) {
                        PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
                        return WILC_FAIL;
                }
-               mgmt_tx->buff = (char *)WILC_MALLOC(buf_len);
+               mgmt_tx->buff = WILC_MALLOC(buf_len);
                if (mgmt_tx->buff == NULL) {
                        PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
                        return WILC_FAIL;
@@ -2843,7 +2846,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 
        #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
        g_obtainingIP = false;
-       WILC_TimerStop(&hDuringIpTimer, NULL);
+       del_timer(&hDuringIpTimer);
        PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
        #endif
        /*BugID_5137*/
@@ -2887,15 +2890,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 
                        /*Setting interface 1 drv handler and mac address in newly downloaded FW*/
                        host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
-                       host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                       host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
                        host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
 
                        /*Add saved WEP keys, if any*/
                        if (g_wep_keys_saved) {
-                               host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                               host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                             g_key_wep_params.key_idx);
-                               host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                               host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                             g_key_wep_params.key,
                                                             g_key_wep_params.key_len,
                                                             g_key_wep_params.key_idx);
@@ -2973,15 +2976,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
                        g_wilc_initialized = 1;
 
                        host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
-                       host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                       host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
                        host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
 
                        /*Add saved WEP keys, if any*/
                        if (g_wep_keys_saved) {
-                               host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                               host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                             g_key_wep_params.key_idx);
-                               host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                               host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                             g_key_wep_params.key,
                                                             g_key_wep_params.key_len,
                                                             g_key_wep_params.key_idx);
@@ -3069,7 +3072,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 
                #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
                g_obtainingIP = true;
-               WILC_TimerStart(&hDuringIpTimer, duringIP_TIME, NULL, NULL);
+               mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME));
                #endif
                host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
                /*BugID_5222*/
@@ -3101,15 +3104,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 
                /*Setting interface 1 drv handler and mac address in newly downloaded FW*/
                host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
-               host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+               host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                        g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
                host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
 
                /*Add saved WEP keys, if any*/
                if (g_wep_keys_saved) {
-                       host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                       host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                     g_key_wep_params.key_idx);
-                       host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler),
+                       host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
                                                     g_key_wep_params.key,
                                                     g_key_wep_params.key_len,
                                                     g_key_wep_params.key_idx);
@@ -3824,9 +3827,9 @@ int WILC_WFI_InitHostInt(struct net_device *net)
        PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr);
        priv = wdev_priv(net->ieee80211_ptr);
        if (op_ifcs == 0) {
-               s32Error = WILC_TimerCreate(&(hAgingTimer), remove_network_from_shadow, NULL);
+               setup_timer(&hAgingTimer, remove_network_from_shadow, 0);
                #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-               s32Error = WILC_TimerCreate(&(hDuringIpTimer), clear_duringIP, NULL);
+               setup_timer(&hDuringIpTimer, clear_duringIP, 0);
                #endif
        }
        op_ifcs++;
@@ -3876,7 +3879,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net)
        #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
        if (op_ifcs == 0) {
                PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
-               WILC_TimerDestroy(&hDuringIpTimer, NULL);
+               del_timer_sync(&hDuringIpTimer);
        }
        #endif
 
This page took 0.033667 seconds and 5 git commands to generate.