Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263535
b: refs/heads/master
c: ecb4433
h: refs/heads/master
i:
  263533: 463267f
  263531: 3be6528
  263527: f7c0e32
  263519: 7d0537d
v: v3
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Aug 22, 2011
1 parent 1cf3e0b commit 7dc5157
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4475a0a93f368e57d5306d4cbe9318e8c1c90c41
refs/heads/master: ecb4433550f0620f3d1471ae7099037ede30a91e
3 changes: 3 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,9 @@ struct wiphy {
* you need use set_wiphy_dev() (see below) */
struct device dev;

/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
bool registered;

/* dir in debugfs: ieee80211/<wiphyname> */
struct dentry *debugfsdir;

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
cancel_work_sync(&local->reconfig_filter);

ieee80211_clear_tx_pending(local);
sta_info_stop(local);
rate_control_deinitialize(local);

if (skb_queue_len(&local->skb_queue) ||
Expand All @@ -1024,6 +1023,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)

destroy_workqueue(local->workqueue);
wiphy_unregister(local->hw.wiphy);
sta_info_stop(local);
ieee80211_wep_free(local);
ieee80211_led_exit(local);
kfree(local->int_scan_req);
Expand Down
7 changes: 7 additions & 0 deletions trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ int wiphy_register(struct wiphy *wiphy)
if (res)
goto out_rm_dev;

rtnl_lock();
rdev->wiphy.registered = true;
rtnl_unlock();
return 0;

out_rm_dev:
Expand Down Expand Up @@ -647,6 +650,10 @@ void wiphy_unregister(struct wiphy *wiphy)
{
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);

rtnl_lock();
rdev->wiphy.registered = false;
rtnl_unlock();

rfkill_unregister(rdev->rfkill);

/* protect the device list */
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/wireless/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ static int wiphy_suspend(struct device *dev, pm_message_t state)

if (rdev->ops->suspend) {
rtnl_lock();
ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
if (rdev->wiphy.registered)
ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
rtnl_unlock();
}

Expand All @@ -112,7 +113,8 @@ static int wiphy_resume(struct device *dev)

if (rdev->ops->resume) {
rtnl_lock();
ret = rdev->ops->resume(&rdev->wiphy);
if (rdev->wiphy.registered)
ret = rdev->ops->resume(&rdev->wiphy);
rtnl_unlock();
}

Expand Down

0 comments on commit 7dc5157

Please sign in to comment.