Commit 1803da60 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: move 'aging_timer' static variable to wilc_priv struct

Moved 'aging_timer' to wilc_priv struct instead of having it as static
variable.
As 'aging_timer' is maintained for each interfaces so 'op_ifcs' check is
not required before the timer_setup() and del_timer_sync() call.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4cf13399
...@@ -85,7 +85,6 @@ static const struct wiphy_wowlan_support wowlan_support = { ...@@ -85,7 +85,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
static u32 last_scanned_cnt; static u32 last_scanned_cnt;
struct timer_list wilc_during_ip_timer; struct timer_list wilc_during_ip_timer;
static struct timer_list aging_timer;
static u8 op_ifcs; static u8 op_ifcs;
#define CHAN2G(_channel, _freq, _flags) { \ #define CHAN2G(_channel, _freq, _flags) { \
...@@ -165,8 +164,6 @@ static void clear_shadow_scan(void) ...@@ -165,8 +164,6 @@ static void clear_shadow_scan(void)
if (op_ifcs != 0) if (op_ifcs != 0)
return; return;
del_timer_sync(&aging_timer);
for (i = 0; i < last_scanned_cnt; i++) { for (i = 0; i < last_scanned_cnt; i++) {
if (last_scanned_shadow[last_scanned_cnt].ies) { if (last_scanned_shadow[last_scanned_cnt].ies) {
kfree(last_scanned_shadow[i].ies); kfree(last_scanned_shadow[i].ies);
...@@ -245,8 +242,9 @@ static void update_scan_time(void) ...@@ -245,8 +242,9 @@ static void update_scan_time(void)
last_scanned_shadow[i].time_scan = jiffies; last_scanned_shadow[i].time_scan = jiffies;
} }
static void remove_network_from_shadow(struct timer_list *unused) static void remove_network_from_shadow(struct timer_list *t)
{ {
struct wilc_priv *priv = from_timer(priv, t, aging_timer);
unsigned long now = jiffies; unsigned long now = jiffies;
int i, j; int i, j;
...@@ -266,7 +264,8 @@ static void remove_network_from_shadow(struct timer_list *unused) ...@@ -266,7 +264,8 @@ static void remove_network_from_shadow(struct timer_list *unused)
} }
if (last_scanned_cnt != 0) if (last_scanned_cnt != 0)
mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); mod_timer(&priv->aging_timer,
jiffies + msecs_to_jiffies(AGING_TIME));
} }
static void clear_during_ip(struct timer_list *unused) static void clear_during_ip(struct timer_list *unused)
...@@ -274,13 +273,15 @@ static void clear_during_ip(struct timer_list *unused) ...@@ -274,13 +273,15 @@ static void clear_during_ip(struct timer_list *unused)
wilc_optaining_ip = false; wilc_optaining_ip = false;
} }
static int is_network_in_shadow(struct network_info *nw_info, void *user_void) static int is_network_in_shadow(struct network_info *nw_info,
struct wilc_priv *priv)
{ {
int state = -1; int state = -1;
int i; int i;
if (last_scanned_cnt == 0) { if (last_scanned_cnt == 0) {
mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); mod_timer(&priv->aging_timer,
jiffies + msecs_to_jiffies(AGING_TIME));
state = -1; state = -1;
} else { } else {
for (i = 0; i < last_scanned_cnt; i++) { for (i = 0; i < last_scanned_cnt; i++) {
...@@ -295,9 +296,9 @@ static int is_network_in_shadow(struct network_info *nw_info, void *user_void) ...@@ -295,9 +296,9 @@ static int is_network_in_shadow(struct network_info *nw_info, void *user_void)
} }
static void add_network_to_shadow(struct network_info *nw_info, static void add_network_to_shadow(struct network_info *nw_info,
void *user_void, void *join_params) struct wilc_priv *priv, void *join_params)
{ {
int ap_found = is_network_in_shadow(nw_info, user_void); int ap_found = is_network_in_shadow(nw_info, priv);
u32 ap_index = 0; u32 ap_index = 0;
u8 rssi_index = 0; u8 rssi_index = 0;
struct network_info *shadow_nw_info; struct network_info *shadow_nw_info;
...@@ -2166,10 +2167,9 @@ int wilc_init_host_int(struct net_device *net) ...@@ -2166,10 +2167,9 @@ int wilc_init_host_int(struct net_device *net)
int ret; int ret;
struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) { timer_setup(&priv->aging_timer, remove_network_from_shadow, 0);
timer_setup(&aging_timer, remove_network_from_shadow, 0); if (op_ifcs == 0)
timer_setup(&wilc_during_ip_timer, clear_during_ip, 0); timer_setup(&wilc_during_ip_timer, clear_during_ip, 0);
}
op_ifcs++; op_ifcs++;
priv->p2p_listen_state = false; priv->p2p_listen_state = false;
...@@ -2195,6 +2195,7 @@ int wilc_deinit_host_int(struct net_device *net) ...@@ -2195,6 +2195,7 @@ int wilc_deinit_host_int(struct net_device *net)
mutex_destroy(&priv->scan_req_lock); mutex_destroy(&priv->scan_req_lock);
ret = wilc_deinit(vif); ret = wilc_deinit(vif);
del_timer_sync(&priv->aging_timer);
clear_shadow_scan(); clear_shadow_scan();
if (op_ifcs == 0) if (op_ifcs == 0)
del_timer_sync(&wilc_during_ip_timer); del_timer_sync(&wilc_during_ip_timer);
......
...@@ -94,7 +94,7 @@ struct wilc_priv { ...@@ -94,7 +94,7 @@ struct wilc_priv {
/* mutexes */ /* mutexes */
struct mutex scan_req_lock; struct mutex scan_req_lock;
bool p2p_listen_state; bool p2p_listen_state;
struct timer_list aging_timer;
}; };
struct frame_reg { struct frame_reg {
......
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