diff options
Diffstat (limited to 'drivers/staging/wilc1000/wilc_wfi_cfgoperations.c')
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 347 |
1 files changed, 118 insertions, 229 deletions
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e248702ee519..7cd033004651 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1,4 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + #include "wilc_wfi_cfgoperations.h" #define NO_ENCRYPT 0 @@ -77,11 +82,6 @@ static const struct wiphy_wowlan_support wowlan_support = { .flags = WIPHY_WOWLAN_ANY }; -#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 -#define DEFAULT_LINK_SPEED 72 - -#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff) - static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; @@ -468,28 +468,22 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, struct disconnect_info *disconn_info, void *priv_data) { - struct wilc_priv *priv; - struct net_device *dev; - struct host_if_drv *wfi_drv; + struct wilc_priv *priv = priv_data; + struct net_device *dev = priv->dev; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wl = vif->wilc; + struct host_if_drv *wfi_drv = priv->hif_drv; u8 null_bssid[ETH_ALEN] = {0}; - struct wilc *wl; - struct wilc_vif *vif; wilc_connecting = 0; - priv = priv_data; - dev = priv->dev; - vif = netdev_priv(dev); - wl = vif->wilc; - wfi_drv = (struct host_if_drv *)priv->hif_drv; - if (conn_disconn_evt == CONN_DISCONN_EVENT_CONN_RESP) { u16 connect_status; connect_status = conn_info->status; if (mac_status == MAC_STATUS_DISCONNECTED && - conn_info->status == SUCCESSFUL_STATUSCODE) { + conn_info->status == WLAN_STATUS_SUCCESS) { connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE; wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); @@ -529,7 +523,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, conn_info->resp_ies, conn_info->resp_ies_len, connect_status, GFP_KERNEL); - } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) { + } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) { wilc_optaining_ip = false; p2p_local_random = 0x01; p2p_recv_random = 0x00; @@ -540,9 +534,9 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, if (!wfi_drv->p2p_connect) wlan_channel = INVALID_CHANNEL; - if (wfi_drv->IFC_UP && dev == wl->vif[1]->ndev) + if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev) disconn_info->reason = 3; - else if (!wfi_drv->IFC_UP && dev == wl->vif[1]->ndev) + else if (!wfi_drv->ifc_up && dev == wl->vif[1]->ndev) disconn_info->reason = 1; cfg80211_disconnected(dev, disconn_info->reason, @@ -555,12 +549,9 @@ static int set_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef) { u32 channelnum = 0; - struct wilc_priv *priv; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); int result = 0; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq); @@ -618,15 +609,12 @@ out: static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) { - struct wilc_priv *priv; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); u32 i; - s32 ret = 0; + int ret = 0; u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS]; struct hidden_network hidden_ntwk; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); priv->scan_req = request; @@ -674,21 +662,18 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) static int connect(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_connect_params *sme) { - s32 ret = 0; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + struct host_if_drv *wfi_drv = priv->hif_drv; + struct network_info *nw_info; + int ret; u32 i; u32 sel_bssi_idx = UINT_MAX; u8 security = NO_ENCRYPT; - enum AUTHTYPE auth_type = ANY; + enum authtype auth_type = ANY; u32 cipher_group; - struct wilc_priv *priv; - struct host_if_drv *wfi_drv; - struct network_info *nw_info = NULL; - struct wilc_vif *vif; wilc_connecting = 1; - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); - wfi_drv = (struct host_if_drv *)priv->hif_drv; if (!(strncmp(sme->ssid, "DIRECT-", 7))) wfi_drv->p2p_connect = 1; @@ -761,7 +746,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, security = ENCRYPT_ENABLED | WPA | AES; } else { ret = -ENOTSUPP; - netdev_err(dev, "Not supported cipher\n"); + netdev_err(dev, "%s: Unsupported cipher\n", + __func__); wilc_connecting = 0; return ret; } @@ -823,17 +809,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code) { - s32 ret = 0; - struct wilc_priv *priv; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + struct wilc *wilc = vif->wilc; struct host_if_drv *wfi_drv; - struct wilc_vif *vif; - struct wilc *wilc; + int ret; u8 null_bssid[ETH_ALEN] = {0}; wilc_connecting = 0; - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); - wilc = vif->wilc; if (!wilc) return -EIO; @@ -919,16 +902,13 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params) { - s32 ret = 0, keylen = params->key_len; - struct wilc_priv *priv; + int ret = 0, keylen = params->key_len; + struct wilc_priv *priv = wiphy_priv(wiphy); const u8 *rx_mic = NULL; const u8 *tx_mic = NULL; u8 mode = NO_ENCRYPT; u8 op_mode; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(netdev); + struct wilc_vif *vif = netdev_priv(netdev); switch (params->cipher) { case WLAN_CIPHER_SUITE_WEP40: @@ -1021,7 +1001,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, break; default: - netdev_err(netdev, "Not supported cipher\n"); + netdev_err(netdev, "%s: Unsupported cipher\n", __func__); ret = -ENOTSUPP; } @@ -1033,13 +1013,9 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, bool pairwise, const u8 *mac_addr) { - struct wilc_priv *priv; - struct wilc *wl; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(netdev); - wl = vif->wilc; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(netdev); + struct wilc *wl = vif->wilc; if (netdev == wl->vif[0]->ndev) { if (priv->wilc_gtk[key_index]) { @@ -1076,11 +1052,9 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *)) { - struct wilc_priv *priv; + struct wilc_priv *priv = wiphy_priv(wiphy); struct key_params key_params; - priv = wiphy_priv(wiphy); - if (!pairwise) { key_params.key = priv->wilc_gtk[key_index]->key; key_params.cipher = priv->wilc_gtk[key_index]->cipher; @@ -1103,11 +1077,8 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool unicast, bool multicast) { - struct wilc_priv *priv; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); wilc_set_wep_default_keyid(vif, key_index); @@ -1117,15 +1088,12 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, static int get_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_info *sinfo) { - struct wilc_priv *priv; - struct wilc_vif *vif; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(dev); u32 i = 0; u32 associatedsta = ~0; u32 inactive_time = 0; - priv = wiphy_priv(wiphy); - vif = netdev_priv(dev); - if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { for (i = 0; i < NUM_STA_ASSOCIATED; i++) { if (!(memcmp(mac, @@ -1141,20 +1109,20 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, return -ENOENT; } - sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); wilc_get_inactive_time(vif, mac, &inactive_time); sinfo->inactive_time = 1000 * inactive_time; } else if (vif->iftype == STATION_MODE) { struct rf_info stats; - wilc_get_statistics(vif, &stats); + wilc_get_statistics(vif, &stats, true); - sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | - BIT(NL80211_STA_INFO_RX_PACKETS) | - BIT(NL80211_STA_INFO_TX_PACKETS) | - BIT(NL80211_STA_INFO_TX_FAILED) | - BIT(NL80211_STA_INFO_TX_BITRATE); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) | + BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | + BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | + BIT_ULL(NL80211_STA_INFO_TX_FAILED) | + BIT_ULL(NL80211_STA_INFO_TX_BITRATE); sinfo->signal = stats.rssi; sinfo->rx_packets = stats.rx_cnt; @@ -1179,13 +1147,10 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev, static int set_wiphy_params(struct wiphy *wiphy, u32 changed) { - s32 ret = 0; + int ret; struct cfg_param_attr cfg_param_val; - struct wilc_priv *priv; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); cfg_param_val.flag = 0; @@ -1217,13 +1182,11 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); u32 i; - s32 ret = 0; + int ret = 0; u8 flag = 0; - struct wilc_vif *vif; - struct wilc_priv *priv = wiphy_priv(wiphy); - - vif = netdev_priv(priv->dev); for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, @@ -1254,8 +1217,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { u32 i; - s32 ret = 0; - + int ret = 0; struct wilc_priv *priv = wiphy_priv(wiphy); for (i = 0; i < priv->pmkid_list.numpmkid; i++) { @@ -1320,7 +1282,6 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx, static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len) { u32 index = 0; - u8 op_channel_attr_index = 0; u8 channel_list_attr_index = 0; @@ -1343,7 +1304,6 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, u8 iftype) { u32 index = 0; - u8 op_channel_attr_index = 0; u8 channel_list_attr_index = 0; @@ -1405,16 +1365,14 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) { - struct wilc_priv *priv; + struct wilc_priv *priv = wiphy_priv(dev->ieee80211_ptr->wiphy); + struct host_if_drv *wfi_drv = priv->hif_drv; u32 header, pkt_offset; - struct host_if_drv *wfi_drv; s32 freq; - - priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - wfi_drv = (struct host_if_drv *)priv->hif_drv; + __le16 fc; memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); - + le32_to_cpus(&header); pkt_offset = GET_PKT_OFFSET(header); if (pkt_offset & IS_MANAGMEMENT_CALLBACK) { @@ -1431,7 +1389,8 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) freq = ieee80211_channel_to_frequency(curr_channel, NL80211_BAND_2GHZ); - if (!ieee80211_is_action(buff[FRAME_TYPE_ID])) { + fc = ((struct ieee80211_hdr *)buff)->frame_control; + if (!ieee80211_is_action(fc)) { cfg80211_rx_mgmt(priv->wdev, freq, 0, buff, size, 0); return; } @@ -1462,8 +1421,8 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) default: netdev_dbg(dev, - "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", - buff[ACTION_SUBTYPE_ID]); + "%s: Not handled action frame type:%x\n", + __func__, buff[ACTION_SUBTYPE_ID]); break; } } @@ -1513,12 +1472,9 @@ static int remain_on_channel(struct wiphy *wiphy, struct ieee80211_channel *chan, unsigned int duration, u64 *cookie) { - s32 ret = 0; - struct wilc_priv *priv; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); + int ret = 0; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); if (wdev->iftype == NL80211_IFTYPE_AP) { netdev_dbg(vif->ndev, "Required while in AP mode\n"); @@ -1543,11 +1499,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, u64 cookie) { - struct wilc_priv *priv; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); return wilc_listen_state_expired(vif, priv->remain_on_ch_params.listen_session_id); @@ -1613,16 +1566,12 @@ static int mgmt_tx(struct wiphy *wiphy, size_t len = params->len; const struct ieee80211_mgmt *mgmt; struct p2p_mgmt_data *mgmt_tx; - struct wilc_priv *priv; - struct host_if_drv *wfi_drv; - struct wilc_vif *vif; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct host_if_drv *wfi_drv = priv->hif_drv; + struct wilc_vif *vif = netdev_priv(wdev->netdev); u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random); int ret = 0; - vif = netdev_priv(wdev->netdev); - priv = wiphy_priv(wiphy); - wfi_drv = (struct host_if_drv *)priv->hif_drv; - *cookie = (unsigned long)buf; priv->tx_cookie = *cookie; mgmt = (const struct ieee80211_mgmt *)buf; @@ -1679,8 +1628,8 @@ static int mgmt_tx(struct wiphy *wiphy, default: netdev_dbg(vif->ndev, - "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", - buf[ACTION_SUBTYPE_ID]); + "%s: Not handled action frame type:%x\n", + __func__, buf[ACTION_SUBTYPE_ID]); break; } } @@ -1702,11 +1651,9 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, struct wireless_dev *wdev, u64 cookie) { - struct wilc_priv *priv; - struct host_if_drv *wfi_drv; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct host_if_drv *wfi_drv = priv->hif_drv; - priv = wiphy_priv(wiphy); - wfi_drv = (struct host_if_drv *)priv->hif_drv; wfi_drv->p2p_timeout = jiffies; if (!priv->p2p_listen_state) { @@ -1726,13 +1673,9 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg) { - struct wilc_priv *priv; - struct wilc_vif *vif; - struct wilc *wl; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->wdev->netdev); - wl = vif->wilc; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->wdev->netdev); + struct wilc *wl = vif->wilc; if (!frame_type) return; @@ -1766,16 +1709,13 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, static int dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { - struct wilc_priv *priv; - struct wilc_vif *vif; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); if (idx != 0) return -ENOENT; - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); - - sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); wilc_get_rssi(vif, &sinfo->signal); @@ -1786,14 +1726,9 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, bool enabled, int timeout) { - struct wilc_priv *priv; - struct wilc_vif *vif; - - if (!wiphy) - return -ENOENT; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); if (!priv->hif_drv) return -EIO; @@ -1807,13 +1742,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, enum nl80211_iftype type, struct vif_params *params) { - struct wilc_priv *priv; - struct wilc_vif *vif; - struct wilc *wl; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wl = vif->wilc; - vif = netdev_priv(dev); - priv = wiphy_priv(wiphy); - wl = vif->wilc; p2p_local_random = 0x01; p2p_recv_random = 0x00; wilc_ie = false; @@ -1886,13 +1818,10 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, static int start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) { + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wl = vif->wilc; struct cfg80211_beacon_data *beacon = &settings->beacon; - s32 ret = 0; - struct wilc *wl; - struct wilc_vif *vif; - - vif = netdev_priv(dev); - wl = vif->wilc; + int ret; ret = set_channel(wiphy, &settings->chandef); @@ -1911,11 +1840,8 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, static int change_beacon(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_beacon_data *beacon) { - struct wilc_priv *priv; - struct wilc_vif *vif; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); return wilc_add_beacon(vif, 0, 0, beacon->head_len, (u8 *)beacon->head, beacon->tail_len, @@ -1924,17 +1850,11 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, static int stop_ap(struct wiphy *wiphy, struct net_device *dev) { - s32 ret = 0; - struct wilc_priv *priv; - struct wilc_vif *vif; + int ret; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); u8 null_bssid[ETH_ALEN] = {0}; - if (!wiphy) - return -EFAULT; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->dev); - wilc_wlan_set_bssid(dev, null_bssid, AP_MODE); ret = wilc_del_beacon(vif); @@ -1948,16 +1868,10 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) static int add_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { - s32 ret = 0; - struct wilc_priv *priv; + int ret = 0; + struct wilc_priv *priv = wiphy_priv(wiphy); struct add_sta_param sta_params = { {0} }; - struct wilc_vif *vif; - - if (!wiphy) - return -EFAULT; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(dev); + struct wilc_vif *vif = netdev_priv(dev); if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { memcpy(sta_params.bssid, mac, ETH_ALEN); @@ -1989,17 +1903,11 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, struct station_del_parameters *params) { const u8 *mac = params->mac; - s32 ret = 0; - struct wilc_priv *priv; - struct wilc_vif *vif; + int ret = 0; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(dev); struct sta_info *info; - if (!wiphy) - return -EFAULT; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(dev); - if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE)) return ret; @@ -2017,14 +1925,9 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, static int change_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { - s32 ret = 0; + int ret = 0; struct add_sta_param sta_params = { {0} }; - struct wilc_vif *vif; - - if (!wiphy) - return -EFAULT; - - vif = netdev_priv(dev); + struct wilc_vif *vif = netdev_priv(dev); if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { memcpy(sta_params.bssid, mac, ETH_ALEN); @@ -2055,12 +1958,9 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, enum nl80211_iftype type, struct vif_params *params) { - struct wilc_vif *vif; - struct wilc_priv *priv; - struct net_device *new_ifc = NULL; - - priv = wiphy_priv(wiphy); - vif = netdev_priv(priv->wdev->netdev); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->wdev->netdev); + struct net_device *new_ifc; if (type == NL80211_IFTYPE_MONITOR) { new_ifc = wilc_wfi_init_mon_interface(name, vif->ndev); @@ -2132,9 +2032,7 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int ret; struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); - struct wilc *wl; - - wl = vif->wilc; + struct wilc *wl = vif->wilc; /* If firmware is not started, return. */ if (!wl->initialized) @@ -2196,11 +2094,11 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void) wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); if (!wdev) - goto _fail_; + goto out; wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv)); if (!wdev->wiphy) - goto _fail_mem_; + goto free_mem; wilc_band_2ghz.ht_cap.ht_supported = 1; wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); @@ -2212,9 +2110,9 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void) return wdev; -_fail_mem_: +free_mem: kfree(wdev); -_fail_: +out: return NULL; } @@ -2223,7 +2121,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, { struct wilc_priv *priv; struct wireless_dev *wdev; - s32 ret = 0; + int ret; wdev = wilc_wfi_cfg_alloc(); if (!wdev) { @@ -2265,19 +2163,15 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, int wilc_init_host_int(struct net_device *net) { - int ret = 0; - - struct wilc_priv *priv; + int ret; + struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); - priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { timer_setup(&aging_timer, remove_network_from_shadow, 0); timer_setup(&wilc_during_ip_timer, clear_during_ip, 0); } op_ifcs++; - priv->auto_rate_adjusted = false; - priv->p2p_listen_state = false; mutex_init(&priv->scan_req_lock); @@ -2290,14 +2184,9 @@ int wilc_init_host_int(struct net_device *net) int wilc_deinit_host_int(struct net_device *net) { - int ret = 0; - struct wilc_vif *vif; - struct wilc_priv *priv; - - priv = wdev_priv(net->ieee80211_ptr); - vif = netdev_priv(priv->dev); - - priv->auto_rate_adjusted = false; + int ret; + struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); + struct wilc_vif *vif = netdev_priv(priv->dev); priv->p2p_listen_state = false; |