Merge tag 'driver-core-3.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6.git] / net / wireless / ap.c
blob324e8d851dc4ca67fd0ded84a927e782c3647c8c
1 #include <linux/ieee80211.h>
2 #include <linux/export.h>
3 #include <net/cfg80211.h>
4 #include "nl80211.h"
5 #include "core.h"
6 #include "rdev-ops.h"
9 static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
10 struct net_device *dev)
12 struct wireless_dev *wdev = dev->ieee80211_ptr;
13 int err;
15 ASSERT_WDEV_LOCK(wdev);
17 if (!rdev->ops->stop_ap)
18 return -EOPNOTSUPP;
20 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
21 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
22 return -EOPNOTSUPP;
24 if (!wdev->beacon_interval)
25 return -ENOENT;
27 err = rdev_stop_ap(rdev, dev);
28 if (!err) {
29 wdev->beacon_interval = 0;
30 wdev->channel = NULL;
31 wdev->ssid_len = 0;
34 return err;
37 int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
38 struct net_device *dev)
40 struct wireless_dev *wdev = dev->ieee80211_ptr;
41 int err;
43 wdev_lock(wdev);
44 err = __cfg80211_stop_ap(rdev, dev);
45 wdev_unlock(wdev);
47 return err;