aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-05-13 05:37:30 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-05-16 16:39:42 -0400
commit7ade7036043e2e8e2831ae189ce5c248386062f1 (patch)
treeb88431f4f1e7205b55785376c9bf07bab4cf3fa4
parentbd500af223c9aed7083730b7044d53162065e418 (diff)
cfg80211: use C99 initialisers to simplify code a bit
Use C99 initialisers for the auth, deauth and disassoc requests to simplify the code. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/mlme.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 0c7b7dd855f6..c21e32f9549c 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -264,7 +264,16 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
264 const u8 *sae_data, int sae_data_len) 264 const u8 *sae_data, int sae_data_len)
265{ 265{
266 struct wireless_dev *wdev = dev->ieee80211_ptr; 266 struct wireless_dev *wdev = dev->ieee80211_ptr;
267 struct cfg80211_auth_request req; 267 struct cfg80211_auth_request req = {
268 .ie = ie,
269 .ie_len = ie_len,
270 .sae_data = sae_data,
271 .sae_data_len = sae_data_len,
272 .auth_type = auth_type,
273 .key = key,
274 .key_len = key_len,
275 .key_idx = key_idx,
276 };
268 int err; 277 int err;
269 278
270 ASSERT_WDEV_LOCK(wdev); 279 ASSERT_WDEV_LOCK(wdev);
@@ -277,18 +286,8 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
277 ether_addr_equal(bssid, wdev->current_bss->pub.bssid)) 286 ether_addr_equal(bssid, wdev->current_bss->pub.bssid))
278 return -EALREADY; 287 return -EALREADY;
279 288
280 memset(&req, 0, sizeof(req));
281
282 req.ie = ie;
283 req.ie_len = ie_len;
284 req.sae_data = sae_data;
285 req.sae_data_len = sae_data_len;
286 req.auth_type = auth_type;
287 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len, 289 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
288 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); 290 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
289 req.key = key;
290 req.key_len = key_len;
291 req.key_idx = key_idx;
292 if (!req.bss) 291 if (!req.bss)
293 return -ENOENT; 292 return -ENOENT;
294 293
@@ -480,7 +479,12 @@ static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
480 bool local_state_change) 479 bool local_state_change)
481{ 480{
482 struct wireless_dev *wdev = dev->ieee80211_ptr; 481 struct wireless_dev *wdev = dev->ieee80211_ptr;
483 struct cfg80211_disassoc_request req; 482 struct cfg80211_disassoc_request req = {
483 .reason_code = reason,
484 .local_state_change = local_state_change,
485 .ie = ie,
486 .ie_len = ie_len,
487 };
484 488
485 ASSERT_WDEV_LOCK(wdev); 489 ASSERT_WDEV_LOCK(wdev);
486 490
@@ -490,11 +494,6 @@ static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
490 if (WARN(!wdev->current_bss, "sme_state=%d\n", wdev->sme_state)) 494 if (WARN(!wdev->current_bss, "sme_state=%d\n", wdev->sme_state))
491 return -ENOTCONN; 495 return -ENOTCONN;
492 496
493 memset(&req, 0, sizeof(req));
494 req.reason_code = reason;
495 req.local_state_change = local_state_change;
496 req.ie = ie;
497 req.ie_len = ie_len;
498 if (ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) 497 if (ether_addr_equal(wdev->current_bss->pub.bssid, bssid))
499 req.bss = &wdev->current_bss->pub; 498 req.bss = &wdev->current_bss->pub;
500 else 499 else
@@ -523,24 +522,21 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
523 struct net_device *dev) 522 struct net_device *dev)
524{ 523{
525 struct wireless_dev *wdev = dev->ieee80211_ptr; 524 struct wireless_dev *wdev = dev->ieee80211_ptr;
526 struct cfg80211_deauth_request req;
527 u8 bssid[ETH_ALEN]; 525 u8 bssid[ETH_ALEN];
526 struct cfg80211_deauth_request req = {
527 .reason_code = WLAN_REASON_DEAUTH_LEAVING,
528 .bssid = bssid,
529 };
528 530
529 ASSERT_WDEV_LOCK(wdev); 531 ASSERT_WDEV_LOCK(wdev);
530 532
531 if (!rdev->ops->deauth) 533 if (!rdev->ops->deauth)
532 return; 534 return;
533 535
534 memset(&req, 0, sizeof(req));
535 req.reason_code = WLAN_REASON_DEAUTH_LEAVING;
536 req.ie = NULL;
537 req.ie_len = 0;
538
539 if (!wdev->current_bss) 536 if (!wdev->current_bss)
540 return; 537 return;
541 538
542 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); 539 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
543 req.bssid = bssid;
544 rdev_deauth(rdev, dev, &req); 540 rdev_deauth(rdev, dev, &req);
545 541
546 if (wdev->current_bss) { 542 if (wdev->current_bss) {