Commit d4e25108 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: wilc1000: Neaten refresh_scan - remove always 1 argument

All uses of refresh_scan() have a constant 1 as the second argument.
Remove it and neaten the function declaration.

Miscellanea:

o Remove overly deep indentation by using continue;
o Remove unnecessary test of the address of a static array as it's
  always non-zero
o Rename and use proper type for the first void * argument as it's
  always the struct wilc_priv *
o Move variables into loop where used
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55c0698a
...@@ -214,48 +214,39 @@ static u32 get_rssi_avg(struct network_info *network_info) ...@@ -214,48 +214,39 @@ static u32 get_rssi_avg(struct network_info *network_info)
return rssi_v; return rssi_v;
} }
static void refresh_scan(void *user_void, u8 all, bool direct_scan) static void refresh_scan(struct wilc_priv *priv, bool direct_scan)
{ {
struct wilc_priv *priv; struct wiphy *wiphy = priv->dev->ieee80211_ptr->wiphy;
struct wiphy *wiphy;
struct cfg80211_bss *bss = NULL;
int i; int i;
int rssi = 0;
priv = user_void;
wiphy = priv->dev->ieee80211_ptr->wiphy;
for (i = 0; i < last_scanned_cnt; i++) { for (i = 0; i < last_scanned_cnt; i++) {
struct network_info *network_info; struct network_info *network_info;
s32 freq;
struct ieee80211_channel *channel;
int rssi;
struct cfg80211_bss *bss;
network_info = &last_scanned_shadow[i]; network_info = &last_scanned_shadow[i];
if (!network_info->found || all) { if (!memcmp("DIRECT-", network_info->ssid, 7) && !direct_scan)
s32 freq; continue;
struct ieee80211_channel *channel;
freq = ieee80211_channel_to_frequency((s32)network_info->ch,
if (network_info) { NL80211_BAND_2GHZ);
freq = ieee80211_channel_to_frequency((s32)network_info->ch, NL80211_BAND_2GHZ); channel = ieee80211_get_channel(wiphy, freq);
channel = ieee80211_get_channel(wiphy, freq); rssi = get_rssi_avg(network_info);
bss = cfg80211_inform_bss(wiphy,
rssi = get_rssi_avg(network_info); channel,
if (memcmp("DIRECT-", network_info->ssid, 7) || CFG80211_BSS_FTYPE_UNKNOWN,
direct_scan) { network_info->bssid,
bss = cfg80211_inform_bss(wiphy, network_info->tsf_hi,
channel, network_info->cap_info,
CFG80211_BSS_FTYPE_UNKNOWN, network_info->beacon_period,
network_info->bssid, (const u8 *)network_info->ies,
network_info->tsf_hi, (size_t)network_info->ies_len,
network_info->cap_info, (s32)rssi * 100,
network_info->beacon_period, GFP_KERNEL);
(const u8 *)network_info->ies, cfg80211_put_bss(wiphy, bss);
(size_t)network_info->ies_len,
(s32)rssi * 100,
GFP_KERNEL);
cfg80211_put_bss(wiphy, bss);
}
}
}
} }
} }
...@@ -442,7 +433,7 @@ static void CfgScanResult(enum scan_event scan_event, ...@@ -442,7 +433,7 @@ static void CfgScanResult(enum scan_event scan_event,
} }
} }
} else if (scan_event == SCAN_EVENT_DONE) { } else if (scan_event == SCAN_EVENT_DONE) {
refresh_scan(priv, 1, false); refresh_scan(priv, false);
mutex_lock(&priv->scan_req_lock); mutex_lock(&priv->scan_req_lock);
...@@ -466,7 +457,7 @@ static void CfgScanResult(enum scan_event scan_event, ...@@ -466,7 +457,7 @@ static void CfgScanResult(enum scan_event scan_event,
}; };
update_scan_time(); update_scan_time();
refresh_scan(priv, 1, false); refresh_scan(priv, false);
cfg80211_scan_done(priv->pstrScanReq, &info); cfg80211_scan_done(priv->pstrScanReq, &info);
priv->bCfgScanning = false; priv->bCfgScanning = false;
...@@ -540,7 +531,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, ...@@ -540,7 +531,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
} }
if (bNeedScanRefresh) if (bNeedScanRefresh)
refresh_scan(priv, 1, true); refresh_scan(priv, true);
} }
cfg80211_connect_result(dev, pstrConnectInfo->bssid, cfg80211_connect_result(dev, pstrConnectInfo->bssid,
......
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