]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
staging: wilc1000: remove typedef from AUTHTYPE_T
[karo-tx-linux.git] / drivers / staging / wilc1000 / wilc_wfi_cfgoperations.c
index 7222359a3839cdd3802abac735989788c0c2704c..788cfaa661ecd32bea24744d1f5bb9e5d831ca12 100644 (file)
@@ -13,7 +13,7 @@
 #include "wilc_wfi_cfgoperations.h"
 #include "wilc_wlan.c"
 #ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"    /* tony : for set_wiphy_dev() */
+#include "linux_wlan_sdio.h"
 #endif
 #include <linux/errno.h>
 
@@ -30,18 +30,14 @@ extern int mac_close(struct net_device *ndev);
 
 tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 u32 u32LastScannedNtwrksCountShadow;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
 struct timer_list hDuringIpTimer;
-#endif
 struct timer_list hAgingTimer;
 static u8 op_ifcs;
 extern u8 u8ConnectedSSID[6];
 
 u8 g_wilc_initialized = 1;
 extern linux_wlan_t *g_linux_wlan;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
 extern bool g_obtainingIP;
-#endif
 
 #define CHAN2G(_channel, _freq, _flags) {       \
                .band             = IEEE80211_BAND_2GHZ, \
@@ -101,7 +97,7 @@ struct p2p_mgmt_data {
 /*Global variable used to state the current  connected STA channel*/
 u8 u8WLANChannel = INVALID_CHANNEL;
 
-u8 u8CurrChannel;
+u8 curr_channel;
 
 u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 u8 u8P2Plocalrandom = 0x01;
@@ -261,17 +257,15 @@ static void remove_network_from_shadow(unsigned long arg)
        }
 }
 
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
 static void clear_duringIP(unsigned long arg)
 {
        PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n");
        g_obtainingIP = false;
 }
-#endif
 
-int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 {
-       int8_t state = -1;
+       int state = -1;
        int i;
 
        if (u32LastScannedNtwrksCountShadow == 0) {
@@ -294,7 +288,7 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 
 void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
 {
-       int8_t ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
+       int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
        u32 ap_index = 0;
        u8 rssi_index = 0;
 
@@ -619,9 +613,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
                                        u16ConnectStatus, GFP_KERNEL);                         /* TODO: mostafa: u16ConnectStatus to */
                /* be replaced by pstrConnectInfo->u16ConnectStatus */
        } else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF)    {
-               #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
                g_obtainingIP = false;
-               #endif
                PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
                         pstrDisconnectNotifInfo->u16reason, priv->dev);
                u8P2Plocalrandom = 0x01;
@@ -669,23 +661,22 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
 static int set_channel(struct wiphy *wiphy,
                       struct cfg80211_chan_def *chandef)
 {
-
        u32 channelnum = 0;
        struct wilc_priv *priv;
-       s32 s32Error = 0;
+       int result = 0;
 
        priv = wiphy_priv(wiphy);
 
        channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
        PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);
 
-       u8CurrChannel = channelnum;
-       s32Error   = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+       curr_channel = channelnum;
+       result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
 
-       if (s32Error != 0)
+       if (result != 0)
                PRINT_ER("Error in setting channel %d\n", channelnum);
 
-       return s32Error;
+       return result;
 }
 
 /**
@@ -701,17 +692,13 @@ static int set_channel(struct wiphy *wiphy,
  *  @version   1.0
  */
 
-/*
- *     kernel version 3.8.8 supported
- *     tony, sswd, WILC-KR, 2013-10-29
- */
 static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 {
        struct wilc_priv *priv;
        u32 i;
        s32 s32Error = 0;
        u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
-       tstrHiddenNetwork strHiddenNetwork;
+       struct hidden_network strHiddenNetwork;
 
        priv = wiphy_priv(wiphy);
 
@@ -740,7 +727,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
                if (request->n_ssids >= 1) {
 
 
-                       strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(tstrHiddenNetwork), GFP_KERNEL);
+                       strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
                        strHiddenNetwork.u8ssidnum = request->n_ssids;
 
 
@@ -799,7 +786,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
        s32 s32Error = 0;
        u32 i;
        u8 u8security = NO_ENCRYPT;
-       AUTHTYPE_T tenuAuth_type = ANY;
+       enum AUTHTYPE tenuAuth_type = ANY;
        char *pcgroup_encrypt_val = NULL;
        char *pccipher_group = NULL;
        char *pcwpa_version = NULL;
@@ -1009,7 +996,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
        PRINT_INFO(CFG80211_DBG, "Group encryption value = %s\n Cipher Group = %s\n WPA version = %s\n",
                   pcgroup_encrypt_val, pccipher_group, pcwpa_version);
 
-       u8CurrChannel = pstrNetworkInfo->u8channel;
+       curr_channel = pstrNetworkInfo->u8channel;
 
        if (!pstrWFIDrv->u8P2PConnect) {
                u8WLANChannel = pstrNetworkInfo->u8channel;
@@ -1098,7 +1085,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
        u8 u8mode = NO_ENCRYPT;
        u8 u8gmode = NO_ENCRYPT;
        u8 u8pmode = NO_ENCRYPT;
-       AUTHTYPE_T tenuAuth_type = ANY;
+       enum AUTHTYPE tenuAuth_type = ANY;
 
        priv = wiphy_priv(wiphy);
 
@@ -1626,11 +1613,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
 
                host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics);
 
-               /*
-                * tony: 2013-11-13
-                * tx_failed introduced more than
-                * kernel version 3.0.0
-                */
                sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
                                                BIT(NL80211_STA_INFO_RX_PACKETS) |
                                                BIT(NL80211_STA_INFO_TX_PACKETS) |
@@ -2111,7 +2093,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
                PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]);
 
                /*Upper layer is informed that the frame is received on this freq*/
-               s32Freq = ieee80211_channel_to_frequency(u8CurrChannel, IEEE80211_BAND_2GHZ);
+               s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ);
 
                if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
                        PRINT_D(GENERIC_DBG, "Rx Action Frame Type: %x %x\n", buff[ACTION_SUBTYPE_ID], buff[P2P_PUB_ACTION_SUBTYPE]);
@@ -2291,7 +2273,7 @@ static int remain_on_channel(struct wiphy *wiphy,
                return s32Error;
        }
 
-       u8CurrChannel = chan->hw_value;
+       curr_channel = chan->hw_value;
 
        /*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/
        priv->strRemainOnChanParams.pstrListenChan = chan;
@@ -2363,10 +2345,10 @@ void WILC_WFI_add_wilcvendorspec(u8 *buff)
  */
 extern linux_wlan_t *g_linux_wlan;
 extern bool bEnablePS;
-int mgmt_tx(struct wiphy *wiphy,
-           struct wireless_dev *wdev,
-           struct cfg80211_mgmt_tx_params *params,
-           u64 *cookie)
+static int mgmt_tx(struct wiphy *wiphy,
+                  struct wireless_dev *wdev,
+                  struct cfg80211_mgmt_tx_params *params,
+                  u64 *cookie)
 {
        struct ieee80211_channel *chan = params->chan;
        unsigned int wait = params->wait;
@@ -2412,7 +2394,7 @@ int mgmt_tx(struct wiphy *wiphy,
                        PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
                        host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
                        /*Save the current channel after we tune to it*/
-                       u8CurrChannel = chan->hw_value;
+                       curr_channel = chan->hw_value;
                } else if (ieee80211_is_action(mgmt->frame_control))   {
                        PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control);
 
@@ -2427,7 +2409,7 @@ int mgmt_tx(struct wiphy *wiphy,
                                        PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
                                        host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
                                        /*Save the current channel after we tune to it*/
-                                       u8CurrChannel = chan->hw_value;
+                                       curr_channel = chan->hw_value;
                                }
                                switch (buf[ACTION_SUBTYPE_ID]) {
                                case GAS_INTIAL_REQ:
@@ -2507,16 +2489,18 @@ int mgmt_tx(struct wiphy *wiphy,
 
                }
 
-               g_linux_wlan->oup.wlan_add_mgmt_to_tx_que(mgmt_tx, mgmt_tx->buff, mgmt_tx->size, WILC_WFI_mgmt_tx_complete);
+               wilc_wlan_txq_add_mgmt_pkt(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");
        }
        return s32Error;
 }
 
-int mgmt_tx_cancel_wait(struct wiphy *wiphy,
-                       struct wireless_dev *wdev,
-                       u64 cookie)
+static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
+                              struct wireless_dev *wdev,
+                              u64 cookie)
 {
        struct wilc_priv *priv;
        tstrWILC_WFIDrv *pstrWFIDrv;
@@ -2539,7 +2523,7 @@ int mgmt_tx_cancel_wait(struct wiphy *wiphy,
 }
 
 /**
- *  @brief      WILC_WFI_frame_register
+ *  @brief      wilc_mgmt_frame_register
  *  @details Notify driver that a management frame type was
  *              registered. Note that this callback may not sleep, and cannot run
  *                      concurrently with itself.
@@ -2549,9 +2533,8 @@ int mgmt_tx_cancel_wait(struct wiphy *wiphy,
  *  @date      01 JUL 2012
  *  @version
  */
-void    WILC_WFI_frame_register(struct wiphy *wiphy,
-                               struct wireless_dev *wdev,
-                               u16 frame_type, bool reg)
+void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
+                             u16 frame_type, bool reg)
 {
 
        struct wilc_priv *priv;
@@ -2599,7 +2582,7 @@ void    WILC_WFI_frame_register(struct wiphy *wiphy,
 }
 
 /**
- *  @brief      WILC_WFI_set_cqm_rssi_config
+ *  @brief      set_cqm_rssi_config
  *  @details    Configure connection quality monitor RSSI threshold.
  *  @param[in]   struct wiphy *wiphy:
  *  @param[in] struct net_device *dev:
@@ -2610,8 +2593,8 @@ void    WILC_WFI_frame_register(struct wiphy *wiphy,
  *  @date      01 MAR 2012
  *  @version   1.0
  */
-static int    WILC_WFI_set_cqm_rssi_config(struct wiphy *wiphy,
-                                          struct net_device *dev,  s32 rssi_thold, u32 rssi_hyst)
+static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
+                              s32 rssi_thold, u32 rssi_hyst)
 {
        PRINT_D(CFG80211_DBG, "Setting CQM RSSi Function\n");
        return 0;
@@ -2652,16 +2635,16 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
 
 
 /**
- *  @brief      WILC_WFI_set_power_mgmt
+ *  @brief      set_power_mgmt
  *  @details
  *  @param[in]
  *  @return     int : Return 0 on Success.
  *  @author    mdaftedar
  *  @date      01 JUL 2012
- *  @version   1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ *  @version   1.0
  */
-int WILC_WFI_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
-                           bool enabled, int timeout)
+static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+                         bool enabled, int timeout)
 {
        struct wilc_priv *priv;
 
@@ -2717,11 +2700,9 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 
        bWilc_ie = false;
 
-       #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
        g_obtainingIP = false;
        del_timer(&hDuringIpTimer);
        PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
-       #endif
        /*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/
        if (g_ptk_keys_saved && g_gtk_keys_saved) {
                Set_machw_change_vir_if(true);
@@ -2928,10 +2909,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
        case NL80211_IFTYPE_P2P_GO:
                PRINT_D(GENERIC_DBG, "start duringIP timer\n");
 
-               #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
                g_obtainingIP = true;
                mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME));
-               #endif
                host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
                /*Delete block ack has to be the latest config packet*/
                /*sent before downloading new FW. This is because it blocks on*/
@@ -3155,7 +3134,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
 {
        s32 s32Error = 0;
        struct wilc_priv *priv;
-       tstrWILC_AddStaParam strStaParams = { {0} };
+       struct add_sta_param strStaParams = { {0} };
        perInterface_wlan_t *nic;
 
        if (!wiphy)
@@ -3266,7 +3245,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
 {
        s32 s32Error = 0;
        struct wilc_priv *priv;
-       tstrWILC_AddStaParam strStaParams = { {0} };
+       struct add_sta_param strStaParams = { {0} };
        perInterface_wlan_t *nic;
 
 
@@ -3331,10 +3310,12 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
  *  @date      01 JUL 2012
  *  @version   1.0
  */
-struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, const char *name,
-                                     unsigned char name_assign_type,
-                                     enum nl80211_iftype type, u32 *flags,
-                                     struct vif_params *params)
+static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
+                                            const char *name,
+                                            unsigned char name_assign_type,
+                                            enum nl80211_iftype type,
+                                            u32 *flags,
+                                            struct vif_params *params)
 {
        perInterface_wlan_t *nic;
        struct wilc_priv *priv;
@@ -3372,7 +3353,7 @@ struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, const char *name,
  *  @date      01 JUL 2012
  *  @version   1.0
  */
-int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)      /* tony for v3.8 support */
+static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 {
        PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
        return 0;
@@ -3410,9 +3391,9 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
        .cancel_remain_on_channel = cancel_remain_on_channel,
        .mgmt_tx_cancel_wait = mgmt_tx_cancel_wait,
        .mgmt_tx = mgmt_tx,
-       .mgmt_frame_register = WILC_WFI_frame_register,
-       .set_power_mgmt = WILC_WFI_set_power_mgmt,
-       .set_cqm_rssi_config = WILC_WFI_set_cqm_rssi_config,
+       .mgmt_frame_register = wilc_mgmt_frame_register,
+       .set_power_mgmt = set_power_mgmt,
+       .set_cqm_rssi_config = set_cqm_rssi_config,
 
 };
 
@@ -3427,7 +3408,7 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
  *  @return     int : Return 0 on Success.
  *  @author    mdaftedar
  *  @date      01 MAR 2012
- *  @version   1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ *  @version   1.0
  */
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
 {
@@ -3435,7 +3416,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
        struct wilc_priv *priv;
 
        priv = wiphy_priv(wiphy);
-#if 1
        switch (changed) {
 
        case WILC_WFI_RX_PKT:
@@ -3458,7 +3438,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
        default:
                break;
        }
-#endif
        return 0;
 }
 
@@ -3574,7 +3553,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
                   wdev->wiphy->interface_modes, wdev->iftype);
 
        #ifdef WILC_SDIO
-       set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev); /* tony */
+       set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev);
        #endif
 
        /*Register wiphy structure*/
@@ -3600,7 +3579,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
  *  @date      01 MAR 2012
  *  @version   1.0
  */
-int WILC_WFI_InitHostInt(struct net_device *net)
+int wilc_init_host_int(struct net_device *net)
 {
 
        int s32Error = 0;
@@ -3611,9 +3590,7 @@ int WILC_WFI_InitHostInt(struct net_device *net)
        priv = wdev_priv(net->ieee80211_ptr);
        if (op_ifcs == 0) {
                setup_timer(&hAgingTimer, remove_network_from_shadow, 0);
-               #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
                setup_timer(&hDuringIpTimer, clear_duringIP, 0);
-               #endif
        }
        op_ifcs++;
        if (s32Error < 0) {
@@ -3660,12 +3637,10 @@ int wilc_deinit_host_int(struct net_device *net)
 
        /* Clear the Shadow scan */
        clear_shadow_scan(priv);
-       #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
        if (op_ifcs == 0) {
                PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
                del_timer_sync(&hDuringIpTimer);
        }
-       #endif
 
        if (s32Error)
                PRINT_ER("Error while deintializing host interface\n");