diff options
author | Ajay Singh <ajay.kathat@microchip.com> | 2019-09-26 15:14:56 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-30 21:58:02 +0200 |
commit | fb2d74342fedca6074dd3c4ae9339f76d35caac3 (patch) | |
tree | f088f1d68a2525e21aff7f074b1ae5d4407e9a44 /drivers/staging/wilc1000 | |
parent | 82e465642f93e3134227a4e5bd3418238695ad54 (diff) |
staging: wilc1000: move wlan_deinit_locks() in wilc_netdev_cleanup()
Move deinitialization of lock during the module remove and the
initialization of lock wilc_cfg80211_init(). This to ensure locks are
available during module load and gets free during unload.
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20190926151436.27819-2-ajay.kathat@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r-- | drivers/staging/wilc1000/wilc_netdev.c | 14 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 1 |
3 files changed, 14 insertions, 15 deletions
diff --git a/drivers/staging/wilc1000/wilc_netdev.c b/drivers/staging/wilc1000/wilc_netdev.c index 508acb8bb089..d931fb2b2745 100644 --- a/drivers/staging/wilc1000/wilc_netdev.c +++ b/drivers/staging/wilc1000/wilc_netdev.c @@ -424,18 +424,6 @@ fail: return -1; } -static void wlan_deinit_locks(struct net_device *dev) -{ - struct wilc_vif *vif = netdev_priv(dev); - struct wilc *wilc = vif->wilc; - - mutex_destroy(&wilc->hif_cs); - mutex_destroy(&wilc->rxq_cs); - mutex_destroy(&wilc->cfg_cmd_lock); - mutex_destroy(&wilc->txq_add_to_head_cs); - mutex_destroy(&wilc->vif_mutex); -} - static void wlan_deinitialize_threads(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); @@ -477,7 +465,6 @@ static void wilc_wlan_deinitialize(struct net_device *dev) wilc_wlan_stop(wl, vif); wilc_wlan_cleanup(dev); - wlan_deinit_locks(dev); wl->initialized = false; @@ -875,6 +862,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) flush_workqueue(wilc->hif_workqueue); destroy_workqueue(wilc->hif_workqueue); wilc_wlan_cfg_deinit(wilc); + wlan_deinit_locks(wilc); kfree(wilc->bus_data); wiphy_unregister(wilc->wiphy); wiphy_free(wilc->wiphy); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index a1ca700e045a..549b1d078198 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1802,6 +1802,15 @@ static void wlan_init_locks(struct wilc *wl) init_completion(&wl->txq_thread_started); } +void wlan_deinit_locks(struct wilc *wilc) +{ + mutex_destroy(&wilc->hif_cs); + mutex_destroy(&wilc->rxq_cs); + mutex_destroy(&wilc->cfg_cmd_lock); + mutex_destroy(&wilc->txq_add_to_head_cs); + mutex_destroy(&wilc->vif_mutex); +} + int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, const struct wilc_hif_func *ops) { @@ -1813,6 +1822,8 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, if (!wl) return -EINVAL; + wlan_init_locks(wl); + ret = wilc_wlan_cfg_init(wl); if (ret) goto free_wl; @@ -1836,8 +1847,6 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, goto free_hq; } - wlan_init_locks(wl); - return 0; free_hq: @@ -1847,6 +1856,7 @@ free_cfg: wilc_wlan_cfg_deinit(wl); free_wl: + wlan_deinit_locks(wl); wiphy_unregister(wl->wiphy); wiphy_free(wl->wiphy); return ret; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 234faaabdb82..d802f884e525 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -24,4 +24,5 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl, void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg); struct wilc_vif *wilc_get_interface(struct wilc *wl); +void wlan_deinit_locks(struct wilc *wilc); #endif |