diff options
author | John W. Linville <linville@tuxdriver.com> | 2013-01-28 14:43:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-28 14:43:00 -0500 |
commit | 4205e6ef4ee747aa81930537b6035086ba5f1e28 (patch) | |
tree | b2ebe2b4621f5f531f283cb9bf0005cd3c04ca7b /net/wireless/core.c | |
parent | cef401de7be8c4e155c6746bfccf721a4fa5fab9 (diff) | |
parent | 9ebea3829fac7505e0cd2642fbd13cfa9c038831 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index b677eab55b68..9245729694d2 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -57,9 +57,6 @@ struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) | |||
57 | { | 57 | { |
58 | struct cfg80211_registered_device *result = NULL, *rdev; | 58 | struct cfg80211_registered_device *result = NULL, *rdev; |
59 | 59 | ||
60 | if (!wiphy_idx_valid(wiphy_idx)) | ||
61 | return NULL; | ||
62 | |||
63 | assert_cfg80211_lock(); | 60 | assert_cfg80211_lock(); |
64 | 61 | ||
65 | list_for_each_entry(rdev, &cfg80211_rdev_list, list) { | 62 | list_for_each_entry(rdev, &cfg80211_rdev_list, list) { |
@@ -74,10 +71,8 @@ struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) | |||
74 | 71 | ||
75 | int get_wiphy_idx(struct wiphy *wiphy) | 72 | int get_wiphy_idx(struct wiphy *wiphy) |
76 | { | 73 | { |
77 | struct cfg80211_registered_device *rdev; | 74 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
78 | if (!wiphy) | 75 | |
79 | return WIPHY_IDX_STALE; | ||
80 | rdev = wiphy_to_dev(wiphy); | ||
81 | return rdev->wiphy_idx; | 76 | return rdev->wiphy_idx; |
82 | } | 77 | } |
83 | 78 | ||
@@ -86,9 +81,6 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) | |||
86 | { | 81 | { |
87 | struct cfg80211_registered_device *rdev; | 82 | struct cfg80211_registered_device *rdev; |
88 | 83 | ||
89 | if (!wiphy_idx_valid(wiphy_idx)) | ||
90 | return NULL; | ||
91 | |||
92 | assert_cfg80211_lock(); | 84 | assert_cfg80211_lock(); |
93 | 85 | ||
94 | rdev = cfg80211_rdev_by_wiphy_idx(wiphy_idx); | 86 | rdev = cfg80211_rdev_by_wiphy_idx(wiphy_idx); |
@@ -309,7 +301,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) | |||
309 | 301 | ||
310 | rdev->wiphy_idx = wiphy_counter++; | 302 | rdev->wiphy_idx = wiphy_counter++; |
311 | 303 | ||
312 | if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) { | 304 | if (unlikely(rdev->wiphy_idx < 0)) { |
313 | wiphy_counter--; | 305 | wiphy_counter--; |
314 | mutex_unlock(&cfg80211_mutex); | 306 | mutex_unlock(&cfg80211_mutex); |
315 | /* ugh, wrapped! */ | 307 | /* ugh, wrapped! */ |
@@ -390,8 +382,11 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
390 | 382 | ||
391 | c = &wiphy->iface_combinations[i]; | 383 | c = &wiphy->iface_combinations[i]; |
392 | 384 | ||
393 | /* Combinations with just one interface aren't real */ | 385 | /* |
394 | if (WARN_ON(c->max_interfaces < 2)) | 386 | * Combinations with just one interface aren't real, |
387 | * however we make an exception for DFS. | ||
388 | */ | ||
389 | if (WARN_ON((c->max_interfaces < 2) && !c->radar_detect_widths)) | ||
395 | return -EINVAL; | 390 | return -EINVAL; |
396 | 391 | ||
397 | /* Need at least one channel */ | 392 | /* Need at least one channel */ |
@@ -406,6 +401,11 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
406 | CFG80211_MAX_NUM_DIFFERENT_CHANNELS)) | 401 | CFG80211_MAX_NUM_DIFFERENT_CHANNELS)) |
407 | return -EINVAL; | 402 | return -EINVAL; |
408 | 403 | ||
404 | /* DFS only works on one channel. */ | ||
405 | if (WARN_ON(c->radar_detect_widths && | ||
406 | (c->num_different_channels > 1))) | ||
407 | return -EINVAL; | ||
408 | |||
409 | if (WARN_ON(!c->n_limits)) | 409 | if (WARN_ON(!c->n_limits)) |
410 | return -EINVAL; | 410 | return -EINVAL; |
411 | 411 | ||