]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/wireless/core.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[net-next-2.6.git] / net / wireless / core.c
index 541e2fff5e9c5a0fab346fa55ac9f078630dcf43..9c21ebf9780ea21ff22c9326da29a423061d088b 100644 (file)
@@ -253,11 +253,16 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                        WARN_ON(err);
                        wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
                }
+
+               return err;
        }
 
        wiphy_net_set(&rdev->wiphy, net);
 
-       return err;
+       err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
+       WARN_ON(err);
+
+       return 0;
 }
 
 static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
@@ -428,7 +433,7 @@ int wiphy_register(struct wiphy *wiphy)
 
        /* sanity check ifmodes */
        WARN_ON(!ifmodes);
-       ifmodes &= ((1 << __NL80211_IFTYPE_AFTER_LAST) - 1) & ~1;
+       ifmodes &= ((1 << NUM_NL80211_IFTYPES) - 1) & ~1;
        if (WARN_ON(ifmodes != wiphy->interface_modes))
                wiphy->interface_modes = ifmodes;
 
@@ -475,12 +480,10 @@ int wiphy_register(struct wiphy *wiphy)
        mutex_lock(&cfg80211_mutex);
 
        res = device_add(&rdev->wiphy.dev);
-       if (res)
-               goto out_unlock;
-
-       res = rfkill_register(rdev->rfkill);
-       if (res)
-               goto out_rm_dev;
+       if (res) {
+               mutex_unlock(&cfg80211_mutex);
+               return res;
+       }
 
        /* set up regulatory info */
        wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
@@ -509,13 +512,18 @@ int wiphy_register(struct wiphy *wiphy)
        cfg80211_debugfs_rdev_add(rdev);
        mutex_unlock(&cfg80211_mutex);
 
+       /*
+        * due to a locking dependency this has to be outside of the
+        * cfg80211_mutex lock
+        */
+       res = rfkill_register(rdev->rfkill);
+       if (res)
+               goto out_rm_dev;
+
        return 0;
 
 out_rm_dev:
        device_del(&rdev->wiphy.dev);
-
-out_unlock:
-       mutex_unlock(&cfg80211_mutex);
        return res;
 }
 EXPORT_SYMBOL(wiphy_register);
@@ -680,8 +688,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                INIT_WORK(&wdev->cleanup_work, wdev_cleanup_work);
                INIT_LIST_HEAD(&wdev->event_list);
                spin_lock_init(&wdev->event_lock);
-               INIT_LIST_HEAD(&wdev->action_registrations);
-               spin_lock_init(&wdev->action_registrations_lock);
+               INIT_LIST_HEAD(&wdev->mgmt_registrations);
+               spin_lock_init(&wdev->mgmt_registrations_lock);
 
                mutex_lock(&rdev->devlist_mtx);
                list_add_rcu(&wdev->list, &rdev->netdev_list);
@@ -721,6 +729,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                        dev->ethtool_ops = &cfg80211_ethtool_ops;
 
                if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+                    wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
                     wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
                        dev->priv_flags |= IFF_DONT_BRIDGE;
                break;
@@ -729,6 +738,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                case NL80211_IFTYPE_ADHOC:
                        cfg80211_leave_ibss(rdev, dev, true);
                        break;
+               case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_STATION:
                        wdev_lock(wdev);
 #ifdef CONFIG_CFG80211_WEXT
@@ -801,7 +811,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
                        sysfs_remove_link(&dev->dev.kobj, "phy80211");
                        list_del_rcu(&wdev->list);
                        rdev->devlist_generation++;
-                       cfg80211_mlme_purge_actions(wdev);
+                       cfg80211_mlme_purge_registrations(wdev);
 #ifdef CONFIG_CFG80211_WEXT
                        kfree(wdev->wext.keys);
 #endif
@@ -907,52 +917,3 @@ static void __exit cfg80211_exit(void)
        destroy_workqueue(cfg80211_wq);
 }
 module_exit(cfg80211_exit);
-
-static int ___wiphy_printk(const char *level, const struct wiphy *wiphy,
-                          struct va_format *vaf)
-{
-       if (!wiphy)
-               return printk("%s(NULL wiphy *): %pV", level, vaf);
-
-       return printk("%s%s: %pV", level, wiphy_name(wiphy), vaf);
-}
-
-int __wiphy_printk(const char *level, const struct wiphy *wiphy,
-                  const char *fmt, ...)
-{
-       struct va_format vaf;
-       va_list args;
-       int r;
-
-       va_start(args, fmt);
-
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       r = ___wiphy_printk(level, wiphy, &vaf);
-       va_end(args);
-
-       return r;
-}
-EXPORT_SYMBOL(__wiphy_printk);
-
-#define define_wiphy_printk_level(func, kern_level)            \
-int func(const struct wiphy *wiphy, const char *fmt, ...)      \
-{                                                              \
-       struct va_format vaf;                                   \
-       va_list args;                                           \
-       int r;                                                  \
-                                                               \
-       va_start(args, fmt);                                    \
-                                                               \
-       vaf.fmt = fmt;                                          \
-       vaf.va = &args;                                         \
-                                                               \
-       r = ___wiphy_printk(kern_level, wiphy, &vaf);           \
-       va_end(args);                                           \
-                                                               \
-       return r;                                               \
-}                                                              \
-EXPORT_SYMBOL(func);
-
-define_wiphy_printk_level(wiphy_debug, KERN_DEBUG);