OLD | NEW |
1 /* | 1 /* |
2 * This is the linux wireless configuration interface. | 2 * This is the linux wireless configuration interface. |
3 * | 3 * |
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> | 4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> |
5 */ | 5 */ |
6 | 6 |
7 #include <linux/if.h> | 7 #include <linux/if.h> |
8 #include <linux/module.h> | 8 #include <linux/module.h> |
9 #include <linux/err.h> | 9 #include <linux/err.h> |
10 #include <linux/list.h> | 10 #include <linux/list.h> |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 WARN_ON(1); | 468 WARN_ON(1); |
469 return -EINVAL; | 469 return -EINVAL; |
470 } | 470 } |
471 | 471 |
472 /* check and set up bitrates */ | 472 /* check and set up bitrates */ |
473 ieee80211_set_bitrate_flags(wiphy); | 473 ieee80211_set_bitrate_flags(wiphy); |
474 | 474 |
475 mutex_lock(&cfg80211_mutex); | 475 mutex_lock(&cfg80211_mutex); |
476 | 476 |
477 res = device_add(&rdev->wiphy.dev); | 477 res = device_add(&rdev->wiphy.dev); |
478 » if (res) | 478 » if (res) { |
479 » » goto out_unlock; | 479 » » mutex_unlock(&cfg80211_mutex); |
480 | 480 » » return res; |
481 » res = rfkill_register(rdev->rfkill); | 481 » } |
482 » if (res) | |
483 » » goto out_rm_dev; | |
484 | 482 |
485 /* set up regulatory info */ | 483 /* set up regulatory info */ |
486 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); | 484 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); |
487 | 485 |
488 list_add_rcu(&rdev->list, &cfg80211_rdev_list); | 486 list_add_rcu(&rdev->list, &cfg80211_rdev_list); |
489 cfg80211_rdev_list_generation++; | 487 cfg80211_rdev_list_generation++; |
490 | 488 |
491 /* add to debugfs */ | 489 /* add to debugfs */ |
492 rdev->wiphy.debugfsdir = | 490 rdev->wiphy.debugfsdir = |
493 debugfs_create_dir(wiphy_name(&rdev->wiphy), | 491 debugfs_create_dir(wiphy_name(&rdev->wiphy), |
494 ieee80211_debugfs_dir); | 492 ieee80211_debugfs_dir); |
495 if (IS_ERR(rdev->wiphy.debugfsdir)) | 493 if (IS_ERR(rdev->wiphy.debugfsdir)) |
496 rdev->wiphy.debugfsdir = NULL; | 494 rdev->wiphy.debugfsdir = NULL; |
497 | 495 |
498 if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { | 496 if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { |
499 struct regulatory_request request; | 497 struct regulatory_request request; |
500 | 498 |
501 request.wiphy_idx = get_wiphy_idx(wiphy); | 499 request.wiphy_idx = get_wiphy_idx(wiphy); |
502 request.initiator = NL80211_REGDOM_SET_BY_DRIVER; | 500 request.initiator = NL80211_REGDOM_SET_BY_DRIVER; |
503 request.alpha2[0] = '9'; | 501 request.alpha2[0] = '9'; |
504 request.alpha2[1] = '9'; | 502 request.alpha2[1] = '9'; |
505 | 503 |
506 nl80211_send_reg_change_event(&request); | 504 nl80211_send_reg_change_event(&request); |
507 } | 505 } |
508 | 506 |
509 cfg80211_debugfs_rdev_add(rdev); | 507 cfg80211_debugfs_rdev_add(rdev); |
510 mutex_unlock(&cfg80211_mutex); | 508 mutex_unlock(&cfg80211_mutex); |
511 | 509 |
| 510 /* |
| 511 * due to a locking dependency this has to be outside of the |
| 512 * cfg80211_mutex lock |
| 513 */ |
| 514 res = rfkill_register(rdev->rfkill); |
| 515 if (res) |
| 516 goto out_rm_dev; |
| 517 |
512 return 0; | 518 return 0; |
513 | 519 |
514 out_rm_dev: | 520 out_rm_dev: |
515 device_del(&rdev->wiphy.dev); | 521 device_del(&rdev->wiphy.dev); |
516 | |
517 out_unlock: | |
518 mutex_unlock(&cfg80211_mutex); | |
519 return res; | 522 return res; |
520 } | 523 } |
521 EXPORT_SYMBOL(wiphy_register); | 524 EXPORT_SYMBOL(wiphy_register); |
522 | 525 |
523 void wiphy_rfkill_start_polling(struct wiphy *wiphy) | 526 void wiphy_rfkill_start_polling(struct wiphy *wiphy) |
524 { | 527 { |
525 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 528 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
526 | 529 |
527 if (!rdev->ops->rfkill_poll) | 530 if (!rdev->ops->rfkill_poll) |
528 return; | 531 return; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 vaf.va = &args; \ | 966 vaf.va = &args; \ |
964 \ | 967 \ |
965 r = ___wiphy_printk(kern_level, wiphy, &vaf); \ | 968 r = ___wiphy_printk(kern_level, wiphy, &vaf); \ |
966 va_end(args); \ | 969 va_end(args); \ |
967 \ | 970 \ |
968 return r; \ | 971 return r; \ |
969 } \ | 972 } \ |
970 EXPORT_SYMBOL(func); | 973 EXPORT_SYMBOL(func); |
971 | 974 |
972 define_wiphy_printk_level(wiphy_debug, KERN_DEBUG); | 975 define_wiphy_printk_level(wiphy_debug, KERN_DEBUG); |
OLD | NEW |