Commit 5fefe58f authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: move 'periodic_rssi' as part of 'wilc_vif' struct

Refactor code to move 'periodic_rssi' as part of wilc_vif struct. Move
'dummy_statistics' from 'wilc' struct to 'wilc_vif' to maintain for
each interface separately.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87de37fe
...@@ -190,8 +190,6 @@ static struct host_if_drv *terminated_handle; ...@@ -190,8 +190,6 @@ static struct host_if_drv *terminated_handle;
static u8 p2p_listen_state; static u8 p2p_listen_state;
static struct completion hif_driver_comp; static struct completion hif_driver_comp;
static struct mutex hif_deinit_lock; static struct mutex hif_deinit_lock;
static struct timer_list periodic_rssi;
static struct wilc_vif *periodic_rssi_vif;
static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
...@@ -3422,9 +3420,9 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, ...@@ -3422,9 +3420,9 @@ int wilc_hif_set_cfg(struct wilc_vif *vif,
return result; return result;
} }
static void get_periodic_rssi(struct timer_list *unused) static void get_periodic_rssi(struct timer_list *t)
{ {
struct wilc_vif *vif = periodic_rssi_vif; struct wilc_vif *vif = from_timer(vif, t, periodic_rssi);
if (!vif->hif_drv) { if (!vif->hif_drv) {
netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
...@@ -3432,9 +3430,9 @@ static void get_periodic_rssi(struct timer_list *unused) ...@@ -3432,9 +3430,9 @@ static void get_periodic_rssi(struct timer_list *unused)
} }
if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
wilc_get_statistics(vif, &vif->wilc->dummy_statistics, false); wilc_get_statistics(vif, &vif->dummy_statistics, false);
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
} }
int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
...@@ -3468,12 +3466,11 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) ...@@ -3468,12 +3466,11 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
kfree(hif_drv); kfree(hif_drv);
return -ENOMEM; return -ENOMEM;
} }
periodic_rssi_vif = vif;
timer_setup(&periodic_rssi, get_periodic_rssi, 0);
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
} }
timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0);
mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000));
timer_setup(&hif_drv->scan_timer, timer_scan_cb, 0); timer_setup(&hif_drv->scan_timer, timer_scan_cb, 0);
timer_setup(&hif_drv->connect_timer, timer_connect_cb, 0); timer_setup(&hif_drv->connect_timer, timer_connect_cb, 0);
timer_setup(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0); timer_setup(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0);
...@@ -3513,7 +3510,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -3513,7 +3510,7 @@ int wilc_deinit(struct wilc_vif *vif)
del_timer_sync(&hif_drv->scan_timer); del_timer_sync(&hif_drv->scan_timer);
del_timer_sync(&hif_drv->connect_timer); del_timer_sync(&hif_drv->connect_timer);
del_timer_sync(&periodic_rssi); del_timer_sync(&vif->periodic_rssi);
del_timer_sync(&hif_drv->remain_on_ch_timer); del_timer_sync(&hif_drv->remain_on_ch_timer);
wilc_set_wfi_drv_handler(vif, 0, 0, 0); wilc_set_wfi_drv_handler(vif, 0, 0, 0);
......
...@@ -120,6 +120,8 @@ struct wilc_vif { ...@@ -120,6 +120,8 @@ struct wilc_vif {
u8 ifc_id; u8 ifc_id;
struct timer_list during_ip_timer; struct timer_list during_ip_timer;
bool obtaining_ip; bool obtaining_ip;
struct timer_list periodic_rssi;
struct rf_info dummy_statistics;
}; };
struct wilc { struct wilc {
...@@ -169,7 +171,6 @@ struct wilc { ...@@ -169,7 +171,6 @@ struct wilc {
struct device *dev; struct device *dev;
bool suspend_event; bool suspend_event;
struct rf_info dummy_statistics;
bool enable_ps; bool enable_ps;
int clients_count; int clients_count;
struct workqueue_struct *hif_workqueue; struct workqueue_struct *hif_workqueue;
......
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