diff options
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 65 |
1 files changed, 58 insertions, 7 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 37d0e0ab4432..541e2fff5e9c 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -472,24 +472,22 @@ int wiphy_register(struct wiphy *wiphy) | |||
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); | ||
476 | |||
475 | res = device_add(&rdev->wiphy.dev); | 477 | res = device_add(&rdev->wiphy.dev); |
476 | if (res) | 478 | if (res) |
477 | return res; | 479 | goto out_unlock; |
478 | 480 | ||
479 | res = rfkill_register(rdev->rfkill); | 481 | res = rfkill_register(rdev->rfkill); |
480 | if (res) | 482 | if (res) |
481 | goto out_rm_dev; | 483 | goto out_rm_dev; |
482 | 484 | ||
483 | mutex_lock(&cfg80211_mutex); | ||
484 | |||
485 | /* set up regulatory info */ | 485 | /* set up regulatory info */ |
486 | wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); | 486 | wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); |
487 | 487 | ||
488 | list_add_rcu(&rdev->list, &cfg80211_rdev_list); | 488 | list_add_rcu(&rdev->list, &cfg80211_rdev_list); |
489 | cfg80211_rdev_list_generation++; | 489 | cfg80211_rdev_list_generation++; |
490 | 490 | ||
491 | mutex_unlock(&cfg80211_mutex); | ||
492 | |||
493 | /* add to debugfs */ | 491 | /* add to debugfs */ |
494 | rdev->wiphy.debugfsdir = | 492 | rdev->wiphy.debugfsdir = |
495 | debugfs_create_dir(wiphy_name(&rdev->wiphy), | 493 | debugfs_create_dir(wiphy_name(&rdev->wiphy), |
@@ -509,11 +507,15 @@ int wiphy_register(struct wiphy *wiphy) | |||
509 | } | 507 | } |
510 | 508 | ||
511 | cfg80211_debugfs_rdev_add(rdev); | 509 | cfg80211_debugfs_rdev_add(rdev); |
510 | mutex_unlock(&cfg80211_mutex); | ||
512 | 511 | ||
513 | return 0; | 512 | return 0; |
514 | 513 | ||
515 | out_rm_dev: | 514 | out_rm_dev: |
516 | device_del(&rdev->wiphy.dev); | 515 | device_del(&rdev->wiphy.dev); |
516 | |||
517 | out_unlock: | ||
518 | mutex_unlock(&cfg80211_mutex); | ||
517 | return res; | 519 | return res; |
518 | } | 520 | } |
519 | EXPORT_SYMBOL(wiphy_register); | 521 | EXPORT_SYMBOL(wiphy_register); |
@@ -894,7 +896,7 @@ out_fail_pernet: | |||
894 | } | 896 | } |
895 | subsys_initcall(cfg80211_init); | 897 | subsys_initcall(cfg80211_init); |
896 | 898 | ||
897 | static void cfg80211_exit(void) | 899 | static void __exit cfg80211_exit(void) |
898 | { | 900 | { |
899 | debugfs_remove(ieee80211_debugfs_dir); | 901 | debugfs_remove(ieee80211_debugfs_dir); |
900 | nl80211_exit(); | 902 | nl80211_exit(); |
@@ -905,3 +907,52 @@ static void cfg80211_exit(void) | |||
905 | destroy_workqueue(cfg80211_wq); | 907 | destroy_workqueue(cfg80211_wq); |
906 | } | 908 | } |
907 | module_exit(cfg80211_exit); | 909 | module_exit(cfg80211_exit); |
910 | |||
911 | static int ___wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
912 | struct va_format *vaf) | ||
913 | { | ||
914 | if (!wiphy) | ||
915 | return printk("%s(NULL wiphy *): %pV", level, vaf); | ||
916 | |||
917 | return printk("%s%s: %pV", level, wiphy_name(wiphy), vaf); | ||
918 | } | ||
919 | |||
920 | int __wiphy_printk(const char *level, const struct wiphy *wiphy, | ||
921 | const char *fmt, ...) | ||
922 | { | ||
923 | struct va_format vaf; | ||
924 | va_list args; | ||
925 | int r; | ||
926 | |||
927 | va_start(args, fmt); | ||
928 | |||
929 | vaf.fmt = fmt; | ||
930 | vaf.va = &args; | ||
931 | |||
932 | r = ___wiphy_printk(level, wiphy, &vaf); | ||
933 | va_end(args); | ||
934 | |||
935 | return r; | ||
936 | } | ||
937 | EXPORT_SYMBOL(__wiphy_printk); | ||
938 | |||
939 | #define define_wiphy_printk_level(func, kern_level) \ | ||
940 | int func(const struct wiphy *wiphy, const char *fmt, ...) \ | ||
941 | { \ | ||
942 | struct va_format vaf; \ | ||
943 | va_list args; \ | ||
944 | int r; \ | ||
945 | \ | ||
946 | va_start(args, fmt); \ | ||
947 | \ | ||
948 | vaf.fmt = fmt; \ | ||
949 | vaf.va = &args; \ | ||
950 | \ | ||
951 | r = ___wiphy_printk(kern_level, wiphy, &vaf); \ | ||
952 | va_end(args); \ | ||
953 | \ | ||
954 | return r; \ | ||
955 | } \ | ||
956 | EXPORT_SYMBOL(func); | ||
957 | |||
958 | define_wiphy_printk_level(wiphy_debug, KERN_DEBUG); | ||