File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1865,6 +1865,9 @@ struct wiphy {
18651865 * you need use set_wiphy_dev() (see below) */
18661866 struct device dev ;
18671867
1868+ /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
1869+ bool registered ;
1870+
18681871 /* dir in debugfs: ieee80211/<wiphyname> */
18691872 struct dentry * debugfsdir ;
18701873
Original file line number Diff line number Diff line change @@ -1012,7 +1012,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
10121012 cancel_work_sync (& local -> reconfig_filter );
10131013
10141014 ieee80211_clear_tx_pending (local );
1015- sta_info_stop (local );
10161015 rate_control_deinitialize (local );
10171016
10181017 if (skb_queue_len (& local -> skb_queue ) ||
@@ -1024,6 +1023,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
10241023
10251024 destroy_workqueue (local -> workqueue );
10261025 wiphy_unregister (local -> hw .wiphy );
1026+ sta_info_stop (local );
10271027 ieee80211_wep_free (local );
10281028 ieee80211_led_exit (local );
10291029 kfree (local -> int_scan_req );
Original file line number Diff line number Diff line change @@ -616,6 +616,9 @@ int wiphy_register(struct wiphy *wiphy)
616616 if (res )
617617 goto out_rm_dev ;
618618
619+ rtnl_lock ();
620+ rdev -> wiphy .registered = true;
621+ rtnl_unlock ();
619622 return 0 ;
620623
621624out_rm_dev :
@@ -647,6 +650,10 @@ void wiphy_unregister(struct wiphy *wiphy)
647650{
648651 struct cfg80211_registered_device * rdev = wiphy_to_dev (wiphy );
649652
653+ rtnl_lock ();
654+ rdev -> wiphy .registered = false;
655+ rtnl_unlock ();
656+
650657 rfkill_unregister (rdev -> rfkill );
651658
652659 /* protect the device list */
Original file line number Diff line number Diff line change @@ -93,7 +93,8 @@ static int wiphy_suspend(struct device *dev, pm_message_t state)
9393
9494 if (rdev -> ops -> suspend ) {
9595 rtnl_lock ();
96- ret = rdev -> ops -> suspend (& rdev -> wiphy , rdev -> wowlan );
96+ if (rdev -> wiphy .registered )
97+ ret = rdev -> ops -> suspend (& rdev -> wiphy , rdev -> wowlan );
9798 rtnl_unlock ();
9899 }
99100
@@ -112,7 +113,8 @@ static int wiphy_resume(struct device *dev)
112113
113114 if (rdev -> ops -> resume ) {
114115 rtnl_lock ();
115- ret = rdev -> ops -> resume (& rdev -> wiphy );
116+ if (rdev -> wiphy .registered )
117+ ret = rdev -> ops -> resume (& rdev -> wiphy );
116118 rtnl_unlock ();
117119 }
118120
You can’t perform that action at this time.
0 commit comments