diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-02-21 00:04:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:56 -0500 |
commit | 806a9e39670be4f1f861c346ec102a79e81b90c3 (patch) | |
tree | a83d6c06a1be211722385fd60433849db3a08625 /net/wireless/core.c | |
parent | 761cf7ecffc4bc079679e65c3b1ab107c1c1fb56 (diff) |
cfg80211: make regulatory_request use wiphy_idx instead of wiphy
We do this so later on we can move the pending requests onto a
workqueue. By using the wiphy_idx instead of the wiphy we can
later easily check if the wiphy has disappeared or not.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index e347093ccc7..b1a354b7fc0 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -40,9 +40,8 @@ DEFINE_MUTEX(cfg80211_mutex); | |||
40 | /* for debugfs */ | 40 | /* for debugfs */ |
41 | static struct dentry *ieee80211_debugfs_dir; | 41 | static struct dentry *ieee80211_debugfs_dir; |
42 | 42 | ||
43 | /* requires cfg80211_drv_mutex to be held! */ | 43 | /* requires cfg80211_mutex to be held! */ |
44 | static struct cfg80211_registered_device * | 44 | struct cfg80211_registered_device *cfg80211_drv_by_wiphy_idx(int wiphy_idx) |
45 | cfg80211_drv_by_wiphy_idx(int wiphy_idx) | ||
46 | { | 45 | { |
47 | struct cfg80211_registered_device *result = NULL, *drv; | 46 | struct cfg80211_registered_device *result = NULL, *drv; |
48 | 47 | ||
@@ -61,6 +60,31 @@ cfg80211_drv_by_wiphy_idx(int wiphy_idx) | |||
61 | return result; | 60 | return result; |
62 | } | 61 | } |
63 | 62 | ||
63 | int get_wiphy_idx(struct wiphy *wiphy) | ||
64 | { | ||
65 | struct cfg80211_registered_device *drv; | ||
66 | if (!wiphy) | ||
67 | return WIPHY_IDX_STALE; | ||
68 | drv = wiphy_to_dev(wiphy); | ||
69 | return drv->wiphy_idx; | ||
70 | } | ||
71 | |||
72 | /* requires cfg80211_drv_mutex to be held! */ | ||
73 | struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) | ||
74 | { | ||
75 | struct cfg80211_registered_device *drv; | ||
76 | |||
77 | if (!wiphy_idx_valid(wiphy_idx)) | ||
78 | return NULL; | ||
79 | |||
80 | assert_cfg80211_lock(); | ||
81 | |||
82 | drv = cfg80211_drv_by_wiphy_idx(wiphy_idx); | ||
83 | if (!drv) | ||
84 | return NULL; | ||
85 | return &drv->wiphy; | ||
86 | } | ||
87 | |||
64 | /* requires cfg80211_mutex to be held! */ | 88 | /* requires cfg80211_mutex to be held! */ |
65 | static struct cfg80211_registered_device * | 89 | static struct cfg80211_registered_device * |
66 | __cfg80211_drv_from_info(struct genl_info *info) | 90 | __cfg80211_drv_from_info(struct genl_info *info) |