OLD | NEW |
1 /* | 1 /* |
2 * This is the new netlink-based wireless configuration interface. | 2 * This is the new netlink-based 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/slab.h> | 10 #include <linux/slab.h> |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) | 756 static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) |
757 { | 757 { |
758 struct cfg80211_registered_device *rdev; | 758 struct cfg80211_registered_device *rdev; |
759 struct net_device *netdev; | 759 struct net_device *netdev; |
760 int result; | 760 int result; |
761 | 761 |
762 rtnl_lock(); | 762 rtnl_lock(); |
763 | 763 |
764 result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); | 764 result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); |
765 if (result) | 765 if (result) |
766 » » goto unlock; | 766 » » goto unlock_rtnl; |
767 | 767 |
768 result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); | 768 result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); |
769 | 769 |
770 unlock: | 770 » dev_put(netdev); |
| 771 » cfg80211_unlock_rdev(rdev); |
| 772 unlock_rtnl: |
771 rtnl_unlock(); | 773 rtnl_unlock(); |
772 | 774 |
773 return result; | 775 return result; |
774 } | 776 } |
775 | 777 |
776 static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | 778 static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) |
777 { | 779 { |
778 struct cfg80211_registered_device *rdev; | 780 struct cfg80211_registered_device *rdev; |
779 struct net_device *netdev = NULL; | 781 struct net_device *netdev = NULL; |
780 struct wireless_dev *wdev; | 782 struct wireless_dev *wdev; |
(...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4995 struct net_device *dev; | 4997 struct net_device *dev; |
4996 int err; | 4998 int err; |
4997 | 4999 |
4998 if (threshold > 0) | 5000 if (threshold > 0) |
4999 return -EINVAL; | 5001 return -EINVAL; |
5000 | 5002 |
5001 rtnl_lock(); | 5003 rtnl_lock(); |
5002 | 5004 |
5003 err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); | 5005 err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); |
5004 if (err) | 5006 if (err) |
5005 » » goto unlock_rdev; | 5007 » » goto unlock_rtnl; |
5006 | 5008 |
5007 wdev = dev->ieee80211_ptr; | 5009 wdev = dev->ieee80211_ptr; |
5008 | 5010 |
5009 if (!rdev->ops->set_cqm_rssi_config) { | 5011 if (!rdev->ops->set_cqm_rssi_config) { |
5010 err = -EOPNOTSUPP; | 5012 err = -EOPNOTSUPP; |
5011 goto unlock_rdev; | 5013 goto unlock_rdev; |
5012 } | 5014 } |
5013 | 5015 |
5014 if (wdev->iftype != NL80211_IFTYPE_STATION) { | 5016 if (wdev->iftype != NL80211_IFTYPE_STATION) { |
5015 err = -EOPNOTSUPP; | 5017 err = -EOPNOTSUPP; |
5016 goto unlock_rdev; | 5018 goto unlock_rdev; |
5017 } | 5019 } |
5018 | 5020 |
5019 err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, | 5021 err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, |
5020 threshold, hysteresis); | 5022 threshold, hysteresis); |
5021 | 5023 |
5022 unlock_rdev: | 5024 unlock_rdev: |
5023 cfg80211_unlock_rdev(rdev); | 5025 cfg80211_unlock_rdev(rdev); |
5024 dev_put(dev); | 5026 dev_put(dev); |
| 5027 unlock_rtnl: |
5025 rtnl_unlock(); | 5028 rtnl_unlock(); |
5026 | 5029 |
5027 return err; | 5030 return err; |
5028 } | 5031 } |
5029 | 5032 |
5030 static int nl80211_set_cqm_bitrate(struct genl_info *info, | 5033 static int nl80211_set_cqm_bitrate(struct genl_info *info, |
5031 u32 trigger_rate) | 5034 u32 trigger_rate) |
5032 { | 5035 { |
5033 struct cfg80211_registered_device *rdev; | 5036 struct cfg80211_registered_device *rdev; |
5034 struct wireless_dev *wdev; | 5037 struct wireless_dev *wdev; |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6333 err_out: | 6336 err_out: |
6334 genl_unregister_family(&nl80211_fam); | 6337 genl_unregister_family(&nl80211_fam); |
6335 return err; | 6338 return err; |
6336 } | 6339 } |
6337 | 6340 |
6338 void nl80211_exit(void) | 6341 void nl80211_exit(void) |
6339 { | 6342 { |
6340 netlink_unregister_notifier(&nl80211_netlink_notifier); | 6343 netlink_unregister_notifier(&nl80211_netlink_notifier); |
6341 genl_unregister_family(&nl80211_fam); | 6344 genl_unregister_family(&nl80211_fam); |
6342 } | 6345 } |
OLD | NEW |